From cda7c6ceaae3c9e20a01915fc84db3465de65908 Mon Sep 17 00:00:00 2001 From: JaeyoungLim Date: Sun, 7 Nov 2021 21:38:42 +0100 Subject: [PATCH] Enable offboard actuator setpoints --- msg/offboard_control_mode.msg | 1 + src/modules/commander/Commander.cpp | 5 +++-- src/modules/mavlink/mavlink_receiver.cpp | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/msg/offboard_control_mode.msg b/msg/offboard_control_mode.msg index 73d4cba081..319ba1ac50 100644 --- a/msg/offboard_control_mode.msg +++ b/msg/offboard_control_mode.msg @@ -7,3 +7,4 @@ bool velocity bool acceleration bool attitude bool body_rate +bool actuator diff --git a/src/modules/commander/Commander.cpp b/src/modules/commander/Commander.cpp index 548bdecd5f..e1a275cfc4 100644 --- a/src/modules/commander/Commander.cpp +++ b/src/modules/commander/Commander.cpp @@ -4066,12 +4066,13 @@ Commander::offboard_control_update() old.velocity != ocm.velocity || old.acceleration != ocm.acceleration || old.attitude != ocm.attitude || - old.body_rate != ocm.body_rate) { + old.body_rate != ocm.body_rate || + old.actuator != ocm.actuator) { _status_changed = true; } - if (ocm.position || ocm.velocity || ocm.acceleration || ocm.attitude || ocm.body_rate) { + if (ocm.position || ocm.velocity || ocm.acceleration || ocm.attitude || ocm.body_rate || ocm.actuator) { offboard_available = true; } } diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index 38c1c3bc7e..d47c5e296a 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -1271,6 +1271,7 @@ MavlinkReceiver::handle_message_set_actuator_control_target(mavlink_message_t *m //bool ignore_setpoints = bool(actuator_target.group_mlx != 2); offboard_control_mode_s offboard_control_mode{}; + offboard_control_mode.actuator = true; offboard_control_mode.timestamp = hrt_absolute_time(); _offboard_control_mode_pub.publish(offboard_control_mode);