new manual_control_switches msg (split out of manual_control_setpoint) (#16270)

- split out switches from manual_control_setpoint into new message manual_control_switches
 - manual_control_switches published at minimal rate (~ 1 Hz) or immediately on change
 - simple switch debounce in rc_update (2 consecutive identical decodes required)
 - manual_control_switches logged at full rate rather than sampled at (5-10% of messages logged)
 - manual_control_setpoint publish at minimal rate unless changing
 - commander handle landing gear switch for manual modes
 - processing of mode_slot and mode_switch is now split so we only do one or the other (not both)
     - a future step will be to finally drop mode_switch and accompanying switches entirely

Co-authored-by: Matthias Grob <maetugr@gmail.com>
This commit is contained in:
Daniel Agar
2020-12-11 12:11:35 -05:00
committed by GitHub
parent 25ef76b3b8
commit ef6209ba03
25 changed files with 670 additions and 587 deletions
@@ -336,8 +336,6 @@ void MulticopterPositionControl::Run()
// publish trajectory setpoint
_traj_sp_pub.publish(setpoint);
landing_gear_s gear = _flight_tasks.getGear();
// check if all local states are valid and map accordingly
set_vehicle_states(setpoint.vz);
@@ -445,14 +443,16 @@ void MulticopterPositionControl::Run()
_wv_dcm_z_sp_prev = Quatf(attitude_setpoint.q_d).dcm_z();
// if there's any change in landing gear setpoint publish it
if (gear.landing_gear != _old_landing_gear_position
&& gear.landing_gear != landing_gear_s::GEAR_KEEP) {
_landing_gear.timestamp = time_stamp_now;
_landing_gear.landing_gear = gear.landing_gear;
_landing_gear_pub.publish(_landing_gear);
landing_gear_s landing_gear = _flight_tasks.getGear();
if (landing_gear.landing_gear != _old_landing_gear_position
&& landing_gear.landing_gear != landing_gear_s::GEAR_KEEP) {
landing_gear.timestamp = hrt_absolute_time();
_landing_gear_pub.publish(landing_gear);
}
_old_landing_gear_position = gear.landing_gear;
_old_landing_gear_position = landing_gear.landing_gear;
} else {
// reset the numerical derivatives to not generate d term spikes when coming from non-position controlled operation