From e16fbcc2f915ac54af66118e45aacb0f5ac2ad31 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Mon, 3 Aug 2026 14:27:28 +1200 Subject: [PATCH] refactor(gimbal): drop unused external manager info topic to fit flash The ROI forwarding path only needs GIMBAL_MANAGER_STATUS from an external manager: it provides discovery (manager sysid/compid, gimbal device id) and control ownership. GIMBAL_MANAGER_INFORMATION only added capability flags and angle limits, which nothing uses until RC forwarding (deferred). Carrying the extra uORB topic and its receiver handler pushed the tightest board variant over its flash budget (ark_pi6x_encrypted_logs overflowed by 500 bytes). Drop the external_gimbal_manager_information topic; discovery and ownership come from the status topic. It can return with RC, which actually needs the angle limits. Signed-off-by: Julian Oes --- msg/CMakeLists.txt | 1 - msg/ExternalGimbalManagerInformation.msg | 23 -------------- src/modules/gimbal/output_gimbal_manager.cpp | 19 ++--------- src/modules/gimbal/output_gimbal_manager.h | 3 -- src/modules/mavlink/mavlink_receiver.cpp | 33 +------------------- src/modules/mavlink/mavlink_receiver.h | 3 -- 6 files changed, 3 insertions(+), 79 deletions(-) delete mode 100644 msg/ExternalGimbalManagerInformation.msg diff --git a/msg/CMakeLists.txt b/msg/CMakeLists.txt index 8e512f7c98c..f9f409c30b6 100644 --- a/msg/CMakeLists.txt +++ b/msg/CMakeLists.txt @@ -88,7 +88,6 @@ set(msg_files EstimatorStatus.msg EstimatorStatusFlags.msg versioned/Event.msg - ExternalGimbalManagerInformation.msg ExternalGimbalManagerStatus.msg FigureEightStatus.msg FailsafeFlags.msg diff --git a/msg/ExternalGimbalManagerInformation.msg b/msg/ExternalGimbalManagerInformation.msg deleted file mode 100644 index 7f3b5cee983..00000000000 --- a/msg/ExternalGimbalManagerInformation.msg +++ /dev/null @@ -1,23 +0,0 @@ -# External Gimbal Manager information -# -# Information about a gimbal manager running on another component (not us), -# decoded from an incoming GIMBAL_MANAGER_INFORMATION message. Used to discover -# external gimbal managers and their capabilities. - -uint64 timestamp # [us] Time since system start - -uint8 manager_sysid # [-] System id of the external gimbal manager -uint8 manager_compid # [-] Component id of the external gimbal manager - -uint32 cap_flags # GIMBAL_MANAGER_CAP_FLAGS bitmask - -uint8 gimbal_device_id # Gimbal device managed by this manager - -float32 roll_min # [rad] -float32 roll_max # [rad] - -float32 pitch_min # [rad] -float32 pitch_max # [rad] - -float32 yaw_min # [rad] -float32 yaw_max # [rad] diff --git a/src/modules/gimbal/output_gimbal_manager.cpp b/src/modules/gimbal/output_gimbal_manager.cpp index 003f9324458..64b8f935688 100644 --- a/src/modules/gimbal/output_gimbal_manager.cpp +++ b/src/modules/gimbal/output_gimbal_manager.cpp @@ -52,7 +52,6 @@ void OutputToGimbalManager::update(const ControlData &control_data, bool new_set const hrt_abstime now = hrt_absolute_time(); - _update_manager_info(); _update_manager_status(); if (!_manager_found) { @@ -115,20 +114,6 @@ void OutputToGimbalManager::update(const ControlData &control_data, bool new_set } } -void OutputToGimbalManager::_update_manager_info() -{ - external_gimbal_manager_information_s information; - - if (_information_sub.update(&information)) { - if (!_manager_found) { - _manager_found = true; - _manager_sysid = information.manager_sysid; - _manager_compid = information.manager_compid; - _gimbal_device_id = information.gimbal_device_id; - } - } -} - void OutputToGimbalManager::_update_manager_status() { external_gimbal_manager_status_s status; @@ -137,8 +122,8 @@ void OutputToGimbalManager::_update_manager_status() _status = status; _status_valid = true; - // The status is streamed periodically, so it also works as a discovery - // source if we haven't received the information message. + // The status is streamed periodically, so we use it to discover the + // manager as well as to track control ownership. if (!_manager_found) { _manager_found = true; _manager_sysid = status.manager_sysid; diff --git a/src/modules/gimbal/output_gimbal_manager.h b/src/modules/gimbal/output_gimbal_manager.h index 49c7c408c81..0e6739c7057 100644 --- a/src/modules/gimbal/output_gimbal_manager.h +++ b/src/modules/gimbal/output_gimbal_manager.h @@ -39,7 +39,6 @@ #include #include #include -#include #include namespace gimbal @@ -67,13 +66,11 @@ private: InControl // the manager reports us as primary control }; - void _update_manager_info(); void _update_manager_status(); bool _have_primary_control() const; void _send_configure(bool acquire); void _publish_set_pitchyaw(); - uORB::Subscription _information_sub{ORB_ID(external_gimbal_manager_information)}; uORB::Subscription _status_sub{ORB_ID(external_gimbal_manager_status)}; uORB::Publication _set_pitchyaw_pub{ORB_ID(gimbal_manager_set_pitchyaw)}; uORB::Publication _vehicle_command_pub{ORB_ID(vehicle_command)}; diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index 34c3fc82ac1..f10947f689f 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -364,10 +364,6 @@ MavlinkReceiver::handle_message(mavlink_message_t *msg) handle_message_gimbal_device_attitude_status(msg); break; - case MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION: - handle_message_gimbal_manager_information(msg); - break; - case MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS: handle_message_gimbal_manager_status(msg); break; @@ -3703,7 +3699,7 @@ MavlinkReceiver::handle_message_gimbal_device_attitude_status(mavlink_message_t } void -MavlinkReceiver::handle_message_gimbal_manager_information(mavlink_message_t *msg) +MavlinkReceiver::handle_message_gimbal_manager_status(mavlink_message_t *msg) { // Ignore our own gimbal manager: PX4 streams this itself from the autopilot // component, and we only care about external gimbal managers here. @@ -3711,33 +3707,6 @@ MavlinkReceiver::handle_message_gimbal_manager_information(mavlink_message_t *ms return; } - mavlink_gimbal_manager_information_t information_msg; - mavlink_msg_gimbal_manager_information_decode(msg, &information_msg); - - external_gimbal_manager_information_s information{}; - information.timestamp = hrt_absolute_time(); - information.manager_sysid = msg->sysid; - information.manager_compid = msg->compid; - information.cap_flags = information_msg.cap_flags; - information.gimbal_device_id = information_msg.gimbal_device_id; - information.roll_min = information_msg.roll_min; - information.roll_max = information_msg.roll_max; - information.pitch_min = information_msg.pitch_min; - information.pitch_max = information_msg.pitch_max; - information.yaw_min = information_msg.yaw_min; - information.yaw_max = information_msg.yaw_max; - - _external_gimbal_manager_information_pub.publish(information); -} - -void -MavlinkReceiver::handle_message_gimbal_manager_status(mavlink_message_t *msg) -{ - // Ignore our own gimbal manager (see handle_message_gimbal_manager_information). - if (msg->sysid == mavlink_system.sysid && msg->compid == mavlink_system.compid) { - return; - } - mavlink_gimbal_manager_status_t status_msg; mavlink_msg_gimbal_manager_status_decode(msg, &status_msg); diff --git a/src/modules/mavlink/mavlink_receiver.h b/src/modules/mavlink/mavlink_receiver.h index 5942a93c7f1..5ff36232afb 100644 --- a/src/modules/mavlink/mavlink_receiver.h +++ b/src/modules/mavlink/mavlink_receiver.h @@ -83,7 +83,6 @@ #include #include #include -#include #include #include #include @@ -240,7 +239,6 @@ private: void handle_message_gimbal_manager_set_manual_control(mavlink_message_t *msg); void handle_message_gimbal_device_information(mavlink_message_t *msg); void handle_message_gimbal_device_attitude_status(mavlink_message_t *msg); - void handle_message_gimbal_manager_information(mavlink_message_t *msg); void handle_message_gimbal_manager_status(mavlink_message_t *msg); void handle_message_global_position_sensor(mavlink_message_t *msg); #if defined(MAVLINK_MSG_ID_RANGING_BEACON) @@ -352,7 +350,6 @@ private: uORB::Publication _gimbal_manager_set_manual_control_pub{ORB_ID(gimbal_manager_set_manual_control)}; uORB::Publication _gimbal_device_information_pub{ORB_ID(gimbal_device_information)}; uORB::Publication _gimbal_device_attitude_status_pub{ORB_ID(gimbal_device_attitude_status)}; - uORB::Publication _external_gimbal_manager_information_pub{ORB_ID(external_gimbal_manager_information)}; uORB::Publication _external_gimbal_manager_status_pub{ORB_ID(external_gimbal_manager_status)}; uORB::Publication _irlock_report_pub{ORB_ID(irlock_report)}; uORB::Publication _landing_target_pose_pub{ORB_ID(landing_target_pose)};