@@ -254,41 +254,31 @@ VtolAttitudeControl::parameters_update()
254
254
}
255
255
256
256
void
257
- VtolAttitudeControl::update_registrations ()
257
+ VtolAttitudeControl::update_callbacks ()
258
258
{
259
259
mode current_vtol_mode = _vtol_type->get_mode ();
260
260
261
261
switch (current_vtol_mode) {
262
262
case mode::TRANSITION_TO_FW:
263
263
case mode::TRANSITION_TO_MC:
264
264
case mode::ROTARY_WING:
265
- register_mc_callbacks ();
265
+ if (_vehicle_torque_setpoint_virtual_mc_sub.registerCallback ()) {
266
+ _vehicle_torque_setpoint_virtual_fw_sub.unregisterCallback ();
267
+ }
268
+
266
269
break ;
267
270
268
271
case mode::FIXED_WING:
269
- register_fw_callbacks ();
272
+ if (_vehicle_torque_setpoint_virtual_fw_sub.registerCallback ()) {
273
+ _vehicle_torque_setpoint_virtual_mc_sub.unregisterCallback ();
274
+ }
275
+
270
276
break ;
271
277
}
272
278
273
279
_previous_vtol_mode = current_vtol_mode;
274
280
}
275
281
276
- void
277
- VtolAttitudeControl::register_mc_callbacks ()
278
- {
279
- if (_vehicle_torque_setpoint_virtual_mc_sub.registerCallback ()) {
280
- _vehicle_torque_setpoint_virtual_fw_sub.unregisterCallback ();
281
- }
282
- }
283
-
284
- void
285
- VtolAttitudeControl::register_fw_callbacks ()
286
- {
287
- if (_vehicle_torque_setpoint_virtual_fw_sub.registerCallback ()) {
288
- _vehicle_torque_setpoint_virtual_mc_sub.unregisterCallback ();
289
- }
290
- }
291
-
292
282
void
293
283
VtolAttitudeControl::Run ()
294
284
{
@@ -313,7 +303,7 @@ VtolAttitudeControl::Run()
313
303
if (!_initialized) {
314
304
315
305
if (_vtol_type->init ()) {
316
- update_registrations ();
306
+ update_callbacks ();
317
307
_initialized = true ;
318
308
319
309
} else {
@@ -334,7 +324,7 @@ VtolAttitudeControl::Run()
334
324
mode current_vtol_mode = _vtol_type->get_mode ();
335
325
336
326
if (current_vtol_mode != _previous_vtol_mode) {
337
- update_registrations ();
327
+ update_callbacks ();
338
328
}
339
329
340
330
switch (current_vtol_mode) {
0 commit comments