You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instantiate class with callbacks and register them to the FCU:
161
+
Instantiate class with callbacks and register them to the FCU with the desired update rate in seconds:
172
162
```
173
163
App app;
174
164
175
-
fcu.subscribe(&App::onStatus, &app);
176
-
fcu.subscribe(&App::onImu, &app);
177
-
```
178
-
179
-
Messages can now be requested and handled in a loop:
180
-
```
181
-
while(true) {
182
-
fcu.sendRequests();
183
-
fcu.handleRequests();
184
-
}
165
+
fcu.subscribe(&App::onStatus, &app, 0.1);
166
+
fcu.subscribe(&App::onImu, &app, 0.01);
185
167
```
186
168
187
169
Requests are sent to and processed by the flight controller as fast as possible. It is important to note that the MultiWii FCU only processed a single message per cycle. All subscribed messages therefore share the effective bandwidth of 1/(2800 us) = 357 messages per second.
188
170
189
-
#### Register callbacks with different priorities
190
-
It is possible to provide a target update rate to the subscribe method that allows to use more frequent updates of important messages (such as Imu) and less frequent updates of less important messages (such as the battery voltage).
171
+
### Request and Send Messages
172
+
Additional messages that are not requested periodically can be requested by the method
the subscribed Request will periodically be sent by a background thread. In this case it is not required to call `sendRequests()` as this method will only send request of callbacks that have not been registered with a period time.
182
+
where the method will block until an acknowledge is received if `wait_ack=true` (default).
0 commit comments