From 8d03f1c4f53c2a86c5f808bd29a6c8d1b35efeb0 Mon Sep 17 00:00:00 2001 From: dhruvak001 Date: Sat, 29 Jun 2024 19:28:17 +0530 Subject: [PATCH 1/5] AP_Mount: mount_open servo output should work for all backends #26892 --- libraries/AP_Mount/AP_Mount_Backend.cpp | 14 +++++++++++++- libraries/AP_Mount/AP_Mount_Servo.cpp | 12 ++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/libraries/AP_Mount/AP_Mount_Backend.cpp b/libraries/AP_Mount/AP_Mount_Backend.cpp index 9d064633b1916..289a255478018 100644 --- a/libraries/AP_Mount/AP_Mount_Backend.cpp +++ b/libraries/AP_Mount/AP_Mount_Backend.cpp @@ -59,10 +59,22 @@ bool AP_Mount_Backend::valid_mode(MAV_MOUNT_MODE mode) const bool AP_Mount_Backend::set_mode(MAV_MOUNT_MODE mode) { - if (!valid_mode(mode)) { + // Add a check for the new mode + if (!valid_mode(mode) && mode != MAV_MOUNT_MODE_TOGGLE_RC) { return false; } + _mode = mode; + + // handle the toggle mode + if (_mode == MAV_MOUNT_MODE_TOGGLE_RC) { + if (_mode == MAV_MOUNT_MODE_RC_TARGETING) { + _mode = MAV_MOUNT_MODE_NEUTRAL; + } else { + _mode = MAV_MOUNT_MODE_RC_TARGETING; + } + } + return true; } diff --git a/libraries/AP_Mount/AP_Mount_Servo.cpp b/libraries/AP_Mount/AP_Mount_Servo.cpp index 1fba00e92a1be..63b7c2a551334 100644 --- a/libraries/AP_Mount/AP_Mount_Servo.cpp +++ b/libraries/AP_Mount/AP_Mount_Servo.cpp @@ -40,6 +40,15 @@ void AP_Mount_Servo::update() break; } + case MAV_MOUNT_MODE_TOGGLE_RC: { + if (_mode == MAV_MOUNT_MODE_RC_TARGETING) { + set_mode(MAV_MOUNT_MODE_NEUTRAL); + } else { + set_mode(MAV_MOUNT_MODE_RC_TARGETING); + } + break; + } + // move mount to a neutral position, typically pointing forward case MAV_MOUNT_MODE_NEUTRAL: { _angle_bf_output_rad = _params.neutral_angles.get() * DEG_TO_RAD; @@ -102,8 +111,7 @@ void AP_Mount_Servo::update() update_angle_target_from_rate(mnt_target.rate_rads, mnt_target.angle_rad); FALLTHROUGH; case MountTargetType::ANGLE: - // update _angle_bf_output_rad based on angle target - if ((mount_mode != MAV_MOUNT_MODE_RETRACT) & (mount_mode != MAV_MOUNT_MODE_NEUTRAL)) { + if ((mount_mode != MAV_MOUNT_MODE_RETRACT) && (mount_mode != MAV_MOUNT_MODE_NEUTRAL)) { update_angle_outputs(mnt_target.angle_rad); } break; From 194504086d51140b3880687ce866e72531e306d5 Mon Sep 17 00:00:00 2001 From: dhruvak001 Date: Sat, 29 Jun 2024 19:30:28 +0530 Subject: [PATCH 2/5] Update mavlink --- modules/mavlink | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mavlink b/modules/mavlink index 2825252d6d13e..bbaea2215a706 160000 --- a/modules/mavlink +++ b/modules/mavlink @@ -1 +1 @@ -Subproject commit 2825252d6d13eb347520f028b3c580ab29bd78e5 +Subproject commit bbaea2215a706abd722059c683d1dfb084418039 From 4e3c4db6f2020c784b828e1d644bd8bad4adbd91 Mon Sep 17 00:00:00 2001 From: dhruvak001 Date: Sat, 29 Jun 2024 19:55:01 +0530 Subject: [PATCH 3/5] update fatal error --- modules/ChibiOS | 2 +- modules/DroneCAN/libcanard | 2 +- modules/DroneCAN/pydronecan | 2 +- modules/gbenchmark | 2 +- modules/gtest | 2 +- modules/lwip | 2 +- modules/mavlink | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/ChibiOS b/modules/ChibiOS index 8fc176ac1d68c..9061fd6a2f8a9 160000 --- a/modules/ChibiOS +++ b/modules/ChibiOS @@ -1 +1 @@ -Subproject commit 8fc176ac1d68cde532a25c9b802372063a2246cb +Subproject commit 9061fd6a2f8a958a29e6e74a65643fa7e5491dab diff --git a/modules/DroneCAN/libcanard b/modules/DroneCAN/libcanard index 0ae477b82bc18..8ec1d469dac67 160000 --- a/modules/DroneCAN/libcanard +++ b/modules/DroneCAN/libcanard @@ -1 +1 @@ -Subproject commit 0ae477b82bc18daf642383079a02710f69294aa8 +Subproject commit 8ec1d469dac67fb149cdafba9a95812b8a085255 diff --git a/modules/DroneCAN/pydronecan b/modules/DroneCAN/pydronecan index 1f494e9a56ac9..8dd60c5abebde 160000 --- a/modules/DroneCAN/pydronecan +++ b/modules/DroneCAN/pydronecan @@ -1 +1 @@ -Subproject commit 1f494e9a56ac9930f1e11c2f453789414b10d54e +Subproject commit 8dd60c5abebde41260eccebb625f2d22449af11f diff --git a/modules/gbenchmark b/modules/gbenchmark index d572f4777349d..c2146397ac69e 160000 --- a/modules/gbenchmark +++ b/modules/gbenchmark @@ -1 +1 @@ -Subproject commit d572f4777349d43653b21d6c2fc63020ab326db2 +Subproject commit c2146397ac69e6589a50f6b4fc6a7355669caed5 diff --git a/modules/gtest b/modules/gtest index c5fed93f94186..13206d6f53aaf 160000 --- a/modules/gtest +++ b/modules/gtest @@ -1 +1 @@ -Subproject commit c5fed93f941865a0e912e9baf46ded713506590a +Subproject commit 13206d6f53aaff844f2d3595a01ac83a29e383db diff --git a/modules/lwip b/modules/lwip index 143a6a5cb8023..029d8982bfdca 160000 --- a/modules/lwip +++ b/modules/lwip @@ -1 +1 @@ -Subproject commit 143a6a5cb8023921b5dced55c30551ffb752b640 +Subproject commit 029d8982bfdcae08b73e7fea07ba3d7cd2cefeaa diff --git a/modules/mavlink b/modules/mavlink index bbaea2215a706..2825252d6d13e 160000 --- a/modules/mavlink +++ b/modules/mavlink @@ -1 +1 @@ -Subproject commit bbaea2215a706abd722059c683d1dfb084418039 +Subproject commit 2825252d6d13eb347520f028b3c580ab29bd78e5 From db908c4fd931de6f5795eada0562daea9074f7c3 Mon Sep 17 00:00:00 2001 From: dhruvak001 Date: Sat, 29 Jun 2024 19:56:02 +0530 Subject: [PATCH 4/5] Update mavlink --- modules/mavlink | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mavlink b/modules/mavlink index 2825252d6d13e..9d52ba8df0d68 160000 --- a/modules/mavlink +++ b/modules/mavlink @@ -1 +1 @@ -Subproject commit 2825252d6d13eb347520f028b3c580ab29bd78e5 +Subproject commit 9d52ba8df0d68587feb9aeeb055166968692cbdf From 9e97040bd200b582aef90a2d9d779ab59df900c2 Mon Sep 17 00:00:00 2001 From: dhruvak001 Date: Sat, 29 Jun 2024 19:56:18 +0530 Subject: [PATCH 5/5] Update CrashDebug --- modules/CrashDebug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/CrashDebug b/modules/CrashDebug index 5999650864371..b081dff799195 160000 --- a/modules/CrashDebug +++ b/modules/CrashDebug @@ -1 +1 @@ -Subproject commit 599965086437137ec0fe66e185611f43f335f889 +Subproject commit b081dff799195aa82cb11b2edc3aa0f5f4083f08