From b390d5876a4de6bd9be3cf2dee665ac4ff5da20e Mon Sep 17 00:00:00 2001 From: Hamish Willee Date: Thu, 17 Oct 2024 08:41:38 +1100 Subject: [PATCH] AUTOPILOT.capabilities includes gimbal manager protocol bit (#23692) * AUTOPILOT.capabilities includes gimbal manager protocol bit Sets MAV_PROTOCOL_CAPABILITY_COMPONENT_IMPLEMENTS_GIMBAL_MANAGER bit in AUTOPILOT.capabilities * mavlink: update submodule * mavlink: only set gimbal flag if gimbal param set We should probably only set the flag if the gimbal manager is actually set up using the MNT_MODE_IN parameter. * mavlink: make param optional If the gimbal module is not built in we don't have the MNT_MODE_IN param, so we need to deal with that. * gazebo-classic: update submodule --------- Co-authored-by: Julian Oes --- .../simulation/gazebo-classic/sitl_gazebo-classic | 2 +- src/modules/mavlink/mavlink | 2 +- src/modules/mavlink/mavlink_main.cpp | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Tools/simulation/gazebo-classic/sitl_gazebo-classic b/Tools/simulation/gazebo-classic/sitl_gazebo-classic index f1d11a612699..c0e0751341d4 160000 --- a/Tools/simulation/gazebo-classic/sitl_gazebo-classic +++ b/Tools/simulation/gazebo-classic/sitl_gazebo-classic @@ -1 +1 @@ -Subproject commit f1d11a6126990d487d4aa8ff68c23ff370516510 +Subproject commit c0e0751341d46108377bbae2ae1bb6da8a5d4106 diff --git a/src/modules/mavlink/mavlink b/src/modules/mavlink/mavlink index bb52e30d2b92..b4add5292992 160000 --- a/src/modules/mavlink/mavlink +++ b/src/modules/mavlink/mavlink @@ -1 +1 @@ -Subproject commit bb52e30d2b924d5a250f2400144d33012271a19d +Subproject commit b4add5292992cc43bd471b431b425338787982be diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index e0a4a9c2baa6..d3258023ff1b 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -1074,6 +1074,21 @@ Mavlink::send_autopilot_capabilities() msg.capabilities |= MAV_PROTOCOL_CAPABILITY_MAVLINK2; msg.capabilities |= MAV_PROTOCOL_CAPABILITY_MISSION_FENCE; msg.capabilities |= MAV_PROTOCOL_CAPABILITY_MISSION_RALLY; + + + { + param_t param_handle = param_find_no_notification("MNT_MODE_IN"); + int32_t mnt_mode_in = 0; + + if (mnt_mode_in != PARAM_INVALID) { + param_get(param_handle, &mnt_mode_in); + + if (mnt_mode_in == 4) { + msg.capabilities |= MAV_PROTOCOL_CAPABILITY_COMPONENT_IMPLEMENTS_GIMBAL_MANAGER; + } + } + } + msg.flight_sw_version = px4_firmware_version(); msg.middleware_sw_version = px4_firmware_version(); msg.os_sw_version = px4_os_version();