From 3a6b48bc1cfb8bd805bc7b79b895bb4db389c4c6 Mon Sep 17 00:00:00 2001 From: Hamish Willee Date: Thu, 19 Sep 2024 14:44:07 +1000 Subject: [PATCH 1/5] AUTOPILOT.capabilities includes gimbal manager protocol bit Sets MAV_PROTOCOL_CAPABILITY_COMPONENT_IMPLEMENTS_GIMBAL_MANAGER bit in AUTOPILOT.capabilities --- src/modules/mavlink/mavlink_main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index e0a4a9c2baa6..6cd8d80769c6 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -1074,6 +1074,7 @@ Mavlink::send_autopilot_capabilities() msg.capabilities |= MAV_PROTOCOL_CAPABILITY_MAVLINK2; msg.capabilities |= MAV_PROTOCOL_CAPABILITY_MISSION_FENCE; msg.capabilities |= MAV_PROTOCOL_CAPABILITY_MISSION_RALLY; + 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(); From c5c3642ebd604f729d1a6b0fd6c00fc2d8be5edf Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 9 Oct 2024 21:04:43 +1300 Subject: [PATCH 2/5] mavlink: update submodule --- src/modules/mavlink/mavlink | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 899b98431209e2f255d8fb3239be26eec5d7ea35 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 9 Oct 2024 21:04:54 +1300 Subject: [PATCH 3/5] 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. --- src/modules/mavlink/mavlink_main.cpp | 6 +++++- src/modules/mavlink/mavlink_main.h | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index 6cd8d80769c6..d93a7a417698 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -1074,7 +1074,11 @@ Mavlink::send_autopilot_capabilities() msg.capabilities |= MAV_PROTOCOL_CAPABILITY_MAVLINK2; msg.capabilities |= MAV_PROTOCOL_CAPABILITY_MISSION_FENCE; msg.capabilities |= MAV_PROTOCOL_CAPABILITY_MISSION_RALLY; - msg.capabilities |= MAV_PROTOCOL_CAPABILITY_COMPONENT_IMPLEMENTS_GIMBAL_MANAGER; + + if (_param_mnt_mode_in.get() == 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(); diff --git a/src/modules/mavlink/mavlink_main.h b/src/modules/mavlink/mavlink_main.h index d7a7307b3ebf..0560f922bee7 100644 --- a/src/modules/mavlink/mavlink_main.h +++ b/src/modules/mavlink/mavlink_main.h @@ -664,7 +664,8 @@ class Mavlink final : public ModuleParams (ParamBool) _param_mav_hb_forw_en, (ParamInt) _param_mav_radio_timeout, (ParamInt) _param_sys_hitl, - (ParamBool) _param_sys_failure_injection_enabled + (ParamBool) _param_sys_failure_injection_enabled, + (ParamInt) _param_mnt_mode_in ) perf_counter_t _loop_perf{perf_alloc(PC_ELAPSED, MODULE_NAME": tx run elapsed")}; /**< loop performance counter */ From 79ff33a35d64c54d4338f61e30898ceb192e1b99 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 9 Oct 2024 21:16:55 +1300 Subject: [PATCH 4/5] 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. --- src/modules/mavlink/mavlink_main.cpp | 14 ++++++++++++-- src/modules/mavlink/mavlink_main.h | 3 +-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index d93a7a417698..d3258023ff1b 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -1075,8 +1075,18 @@ Mavlink::send_autopilot_capabilities() msg.capabilities |= MAV_PROTOCOL_CAPABILITY_MISSION_FENCE; msg.capabilities |= MAV_PROTOCOL_CAPABILITY_MISSION_RALLY; - if (_param_mnt_mode_in.get() == 4) { - msg.capabilities |= MAV_PROTOCOL_CAPABILITY_COMPONENT_IMPLEMENTS_GIMBAL_MANAGER; + + { + 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(); diff --git a/src/modules/mavlink/mavlink_main.h b/src/modules/mavlink/mavlink_main.h index 0560f922bee7..d7a7307b3ebf 100644 --- a/src/modules/mavlink/mavlink_main.h +++ b/src/modules/mavlink/mavlink_main.h @@ -664,8 +664,7 @@ class Mavlink final : public ModuleParams (ParamBool) _param_mav_hb_forw_en, (ParamInt) _param_mav_radio_timeout, (ParamInt) _param_sys_hitl, - (ParamBool) _param_sys_failure_injection_enabled, - (ParamInt) _param_mnt_mode_in + (ParamBool) _param_sys_failure_injection_enabled ) perf_counter_t _loop_perf{perf_alloc(PC_ELAPSED, MODULE_NAME": tx run elapsed")}; /**< loop performance counter */ From 828ed0d11f15b3b47f21f3157ef56c9d3fd13213 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 10 Oct 2024 19:12:19 +1300 Subject: [PATCH 5/5] gazebo-classic: update submodule --- Tools/simulation/gazebo-classic/sitl_gazebo-classic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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