Skip to content

Commit

Permalink
Send mavlink manual control buttons field in manual control input top…
Browse files Browse the repository at this point in the history
…ic (PX4#22988)

Pass along button states from manual control mavlink message in new buttons field in manual control input topic
  • Loading branch information
katzfey authored Apr 9, 2024
1 parent a73df47 commit d8fabd1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void elrs_led_task()

orb_copy(ORB_ID(manual_control_input), manual_control_input_fd, &setpoint_req);

_cmd = (ControllerInput)setpoint_req.aux1;
_cmd = (ControllerInput)setpoint_req.buttons;

// skip duplicate cmds
if (_cmd == _prev_cmd) {
Expand Down
2 changes: 2 additions & 0 deletions msg/ManualControlSetpoint.msg
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ float32 aux6

bool sticks_moving

uint16 buttons # From uint16 buttons field of Mavlink manual_control message

# TOPICS manual_control_setpoint manual_control_input
# DEPRECATED: float32 x
# DEPRECATED: float32 y
Expand Down
2 changes: 2 additions & 0 deletions src/modules/mavlink/mavlink_receiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2089,6 +2089,8 @@ MavlinkReceiver::handle_message_manual_control(mavlink_message_t *msg)
// For backwards compatibility at the moment interpret throttle in range [0,1000]
manual_control_setpoint.throttle = ((mavlink_manual_control.z / 1000.f) * 2.f) - 1.f;
manual_control_setpoint.yaw = mavlink_manual_control.r / 1000.f;
// Pass along the button states
manual_control_setpoint.buttons = mavlink_manual_control.buttons;
manual_control_setpoint.data_source = manual_control_setpoint_s::SOURCE_MAVLINK_0 + _mavlink->get_instance_id();
manual_control_setpoint.timestamp = manual_control_setpoint.timestamp_sample = hrt_absolute_time();
manual_control_setpoint.valid = true;
Expand Down

0 comments on commit d8fabd1

Please sign in to comment.