mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-14 22:13:33 +08:00
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:
co-authored by
Matthias Grob
parent
25ef76b3b8
commit
ef6209ba03
@@ -78,6 +78,7 @@ set(msg_files
|
||||
log_message.msg
|
||||
logger_status.msg
|
||||
manual_control_setpoint.msg
|
||||
manual_control_switches.msg
|
||||
mavlink_log.msg
|
||||
mission.msg
|
||||
mission_result.msg
|
||||
|
||||
@@ -1,23 +1,15 @@
|
||||
uint64 timestamp # time since system start (microseconds)
|
||||
|
||||
uint8 SWITCH_POS_NONE = 0 # switch is not mapped
|
||||
uint8 SWITCH_POS_ON = 1 # switch activated (value = 1)
|
||||
uint8 SWITCH_POS_MIDDLE = 2 # middle position (value = 0)
|
||||
uint8 SWITCH_POS_OFF = 3 # switch not activated (value = -1)
|
||||
uint8 MODE_SLOT_NONE = 0 # no mode slot assigned
|
||||
uint8 MODE_SLOT_1 = 1 # mode slot 1 selected
|
||||
uint8 MODE_SLOT_2 = 2 # mode slot 2 selected
|
||||
uint8 MODE_SLOT_3 = 3 # mode slot 3 selected
|
||||
uint8 MODE_SLOT_4 = 4 # mode slot 4 selected
|
||||
uint8 MODE_SLOT_5 = 5 # mode slot 5 selected
|
||||
uint8 MODE_SLOT_6 = 6 # mode slot 6 selected
|
||||
uint8 MODE_SLOT_NUM = 6 # number of slots
|
||||
uint64 timestamp_sample # the timestamp of the raw data (microseconds)
|
||||
|
||||
uint8 SOURCE_RC = 1 # radio control
|
||||
uint8 SOURCE_MAVLINK_0 = 2 # mavlink instance 0
|
||||
uint8 SOURCE_MAVLINK_1 = 3 # mavlink instance 1
|
||||
uint8 SOURCE_MAVLINK_2 = 4 # mavlink instance 2
|
||||
uint8 SOURCE_MAVLINK_3 = 5 # mavlink instance 4
|
||||
|
||||
uint8 data_source # where this input is coming from
|
||||
|
||||
# Any of the channels may not be available and be set to NaN
|
||||
# to indicate that it does not contain valid data.
|
||||
# The variable names follow the definition of the
|
||||
@@ -30,19 +22,24 @@ float32 x # stick position in x direction -1..1
|
||||
# in general corresponds to forward/back motion or pitch of vehicle,
|
||||
# in general a positive value means forward or negative pitch and
|
||||
# a negative value means backward or positive pitch
|
||||
|
||||
float32 y # stick position in y direction -1..1
|
||||
# in general corresponds to right/left motion or roll of vehicle,
|
||||
# in general a positive value means right or positive roll and
|
||||
# a negative value means left or negative roll
|
||||
|
||||
float32 z # throttle stick position 0..1
|
||||
# in general corresponds to up/down motion or thrust of vehicle,
|
||||
# in general the value corresponds to the demanded throttle by the user,
|
||||
# if the input is used for setting the setpoint of a vertical position
|
||||
# controller any value > 0.5 means up and any value < 0.5 means down
|
||||
|
||||
float32 r # yaw stick/twist position, -1..1
|
||||
# in general corresponds to the righthand rotation around the vertical
|
||||
# (downwards) axis of the vehicle
|
||||
|
||||
float32 flaps # flap position
|
||||
|
||||
float32 aux1 # default function: camera yaw / azimuth
|
||||
float32 aux2 # default function: camera pitch / tilt
|
||||
float32 aux3 # default function: camera trigger
|
||||
@@ -50,18 +47,3 @@ float32 aux4 # default function: camera roll
|
||||
float32 aux5 # default function: payload drop
|
||||
float32 aux6
|
||||
|
||||
uint8 mode_switch # main mode 3 position switch (mandatory): _MANUAL_, ASSIST, AUTO
|
||||
uint8 return_switch # return to launch 2 position switch (mandatory): _NORMAL_, RTL
|
||||
uint8 rattitude_switch # rattitude control 2 position switch (optional): _MANUAL, RATTITUDE
|
||||
uint8 posctl_switch # position control 2 position switch (optional): _ALTCTL_, POSCTL
|
||||
uint8 loiter_switch # loiter 2 position switch (optional): _MISSION_, LOITER
|
||||
uint8 acro_switch # acro 2 position switch (optional): _MANUAL_, ACRO
|
||||
uint8 offboard_switch # offboard 2 position switch (optional): _NORMAL_, OFFBOARD
|
||||
uint8 kill_switch # throttle kill: _NORMAL_, KILL
|
||||
uint8 arm_switch # arm/disarm switch: _DISARMED_, ARMED
|
||||
uint8 transition_switch # VTOL transition switch: _HOVER, FORWARD_FLIGHT
|
||||
uint8 gear_switch # landing gear switch: _DOWN_, UP
|
||||
uint8 mode_slot # the slot a specific model selector is in
|
||||
uint8 data_source # where this input is coming from
|
||||
uint8 stab_switch # stabilize switch (only relevant for fixed wings, optional): _MANUAL, STABILIZED
|
||||
uint8 man_switch # manual switch (only relevant for fixed wings, optional): _STABILIZED_, MANUAL
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
uint64 timestamp # time since system start (microseconds)
|
||||
|
||||
uint64 timestamp_sample # the timestamp of the raw data (microseconds)
|
||||
|
||||
uint8 SWITCH_POS_NONE = 0 # switch is not mapped
|
||||
uint8 SWITCH_POS_ON = 1 # switch activated (value = 1)
|
||||
uint8 SWITCH_POS_MIDDLE = 2 # middle position (value = 0)
|
||||
uint8 SWITCH_POS_OFF = 3 # switch not activated (value = -1)
|
||||
|
||||
uint8 MODE_SLOT_NONE = 0 # no mode slot assigned
|
||||
uint8 MODE_SLOT_1 = 1 # mode slot 1 selected
|
||||
uint8 MODE_SLOT_2 = 2 # mode slot 2 selected
|
||||
uint8 MODE_SLOT_3 = 3 # mode slot 3 selected
|
||||
uint8 MODE_SLOT_4 = 4 # mode slot 4 selected
|
||||
uint8 MODE_SLOT_5 = 5 # mode slot 5 selected
|
||||
uint8 MODE_SLOT_6 = 6 # mode slot 6 selected
|
||||
uint8 MODE_SLOT_NUM = 6 # number of slots
|
||||
|
||||
uint8 mode_slot # the slot a specific model selector is in
|
||||
|
||||
uint8 arm_switch # arm/disarm switch: _DISARMED_, ARMED
|
||||
uint8 return_switch # return to launch 2 position switch (mandatory): _NORMAL_, RTL
|
||||
uint8 loiter_switch # loiter 2 position switch (optional): _MISSION_, LOITER
|
||||
uint8 offboard_switch # offboard 2 position switch (optional): _NORMAL_, OFFBOARD
|
||||
uint8 kill_switch # throttle kill: _NORMAL_, KILL
|
||||
uint8 gear_switch # landing gear switch: _DOWN_, UP
|
||||
uint8 transition_switch # VTOL transition switch: _HOVER, FORWARD_FLIGHT
|
||||
|
||||
# legacy "advanced" switch configuration (will be removed soon)
|
||||
uint8 mode_switch # main mode 3 position switch (mandatory): _MANUAL_, ASSIST, AUTO
|
||||
uint8 man_switch # manual switch (only relevant for fixed wings, optional): _STABILIZED_, MANUAL
|
||||
uint8 acro_switch # acro 2 position switch (optional): _MANUAL_, ACRO
|
||||
uint8 rattitude_switch # rattitude control 2 position switch (optional): _MANUAL, RATTITUDE
|
||||
uint8 stab_switch # stabilize switch (only relevant for fixed wings, optional): _MANUAL, STABILIZED
|
||||
uint8 posctl_switch # position control 2 position switch (optional): _ALTCTL_, POSCTL
|
||||
|
||||
uint32 switch_changes # number of switch changes
|
||||
+27
-27
@@ -1,32 +1,32 @@
|
||||
uint64 timestamp # time since system start (microseconds)
|
||||
|
||||
uint8 RC_CHANNELS_FUNCTION_THROTTLE=0
|
||||
uint8 RC_CHANNELS_FUNCTION_ROLL=1
|
||||
uint8 RC_CHANNELS_FUNCTION_PITCH=2
|
||||
uint8 RC_CHANNELS_FUNCTION_YAW=3
|
||||
uint8 RC_CHANNELS_FUNCTION_MODE=4
|
||||
uint8 RC_CHANNELS_FUNCTION_RETURN=5
|
||||
uint8 RC_CHANNELS_FUNCTION_POSCTL=6
|
||||
uint8 RC_CHANNELS_FUNCTION_LOITER=7
|
||||
uint8 RC_CHANNELS_FUNCTION_OFFBOARD=8
|
||||
uint8 RC_CHANNELS_FUNCTION_ACRO=9
|
||||
uint8 RC_CHANNELS_FUNCTION_FLAPS=10
|
||||
uint8 RC_CHANNELS_FUNCTION_AUX_1=11
|
||||
uint8 RC_CHANNELS_FUNCTION_AUX_2=12
|
||||
uint8 RC_CHANNELS_FUNCTION_AUX_3=13
|
||||
uint8 RC_CHANNELS_FUNCTION_AUX_4=14
|
||||
uint8 RC_CHANNELS_FUNCTION_AUX_5=15
|
||||
uint8 RC_CHANNELS_FUNCTION_PARAM_1=16
|
||||
uint8 RC_CHANNELS_FUNCTION_PARAM_2=17
|
||||
uint8 RC_CHANNELS_FUNCTION_PARAM_3_5=18
|
||||
uint8 RC_CHANNELS_FUNCTION_RATTITUDE=19
|
||||
uint8 RC_CHANNELS_FUNCTION_KILLSWITCH=20
|
||||
uint8 RC_CHANNELS_FUNCTION_TRANSITION=21
|
||||
uint8 RC_CHANNELS_FUNCTION_GEAR=22
|
||||
uint8 RC_CHANNELS_FUNCTION_ARMSWITCH=23
|
||||
uint8 RC_CHANNELS_FUNCTION_STAB=24
|
||||
uint8 RC_CHANNELS_FUNCTION_AUX_6=25
|
||||
uint8 RC_CHANNELS_FUNCTION_MAN=26
|
||||
uint8 FUNCTION_THROTTLE=0
|
||||
uint8 FUNCTION_ROLL=1
|
||||
uint8 FUNCTION_PITCH=2
|
||||
uint8 FUNCTION_YAW=3
|
||||
uint8 FUNCTION_MODE=4
|
||||
uint8 FUNCTION_RETURN=5
|
||||
uint8 FUNCTION_POSCTL=6
|
||||
uint8 FUNCTION_LOITER=7
|
||||
uint8 FUNCTION_OFFBOARD=8
|
||||
uint8 FUNCTION_ACRO=9
|
||||
uint8 FUNCTION_FLAPS=10
|
||||
uint8 FUNCTION_AUX_1=11
|
||||
uint8 FUNCTION_AUX_2=12
|
||||
uint8 FUNCTION_AUX_3=13
|
||||
uint8 FUNCTION_AUX_4=14
|
||||
uint8 FUNCTION_AUX_5=15
|
||||
uint8 FUNCTION_PARAM_1=16
|
||||
uint8 FUNCTION_PARAM_2=17
|
||||
uint8 FUNCTION_PARAM_3_5=18
|
||||
uint8 FUNCTION_RATTITUDE=19
|
||||
uint8 FUNCTION_KILLSWITCH=20
|
||||
uint8 FUNCTION_TRANSITION=21
|
||||
uint8 FUNCTION_GEAR=22
|
||||
uint8 FUNCTION_ARMSWITCH=23
|
||||
uint8 FUNCTION_STAB=24
|
||||
uint8 FUNCTION_AUX_6=25
|
||||
uint8 FUNCTION_MAN=26
|
||||
|
||||
uint64 timestamp_last_valid # Timestamp of last valid RC signal
|
||||
float32[18] channels # Scaled to -1..1 (throttle: 0..1)
|
||||
|
||||
@@ -289,6 +289,8 @@ rtps:
|
||||
id: 138
|
||||
- msg: estimator_selector_status
|
||||
id: 139
|
||||
- msg: manual_control_switches
|
||||
id: 140
|
||||
########## multi topics: begin ##########
|
||||
- msg: actuator_controls_0
|
||||
id: 150
|
||||
|
||||
Reference in New Issue
Block a user