From f72845e0c1ed399d31bcd5cbb8cc663f8e1e80ae Mon Sep 17 00:00:00 2001 From: Tomas Twardzik Date: Tue, 14 Jan 2025 11:49:29 +0100 Subject: [PATCH] [add] Decoupling boat and rover in the commander module --- msg/versioned/VehicleStatus.msg | 1 + src/modules/commander/Commander.cpp | 8 ++++++-- src/modules/commander/commander_helper.cpp | 10 ++++++++++ src/modules/commander/commander_helper.h | 2 ++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/msg/versioned/VehicleStatus.msg b/msg/versioned/VehicleStatus.msg index a347dfce3d..6f3938a0af 100644 --- a/msg/versioned/VehicleStatus.msg +++ b/msg/versioned/VehicleStatus.msg @@ -94,6 +94,7 @@ uint8 VEHICLE_TYPE_ROTARY_WING = 1 uint8 VEHICLE_TYPE_FIXED_WING = 2 uint8 VEHICLE_TYPE_ROVER = 3 uint8 VEHICLE_TYPE_AIRSHIP = 4 +uint8 VEHICLE_TYPE_BOAT = 5 uint8 FAILSAFE_DEFER_STATE_DISABLED = 0 uint8 FAILSAFE_DEFER_STATE_ENABLED = 1 diff --git a/src/modules/commander/Commander.cpp b/src/modules/commander/Commander.cpp index a5e1583175..75c869dff2 100644 --- a/src/modules/commander/Commander.cpp +++ b/src/modules/commander/Commander.cpp @@ -1725,7 +1725,8 @@ void Commander::updateParameters() && _vtol_vehicle_status.vehicle_vtol_state != vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW); const bool is_fixed = is_fixed_wing(_vehicle_status) || (is_vtol(_vehicle_status) && _vtol_vehicle_status.vehicle_vtol_state == vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW); - const bool is_ground = is_ground_vehicle(_vehicle_status); + const bool is_rover = is_rover_type(_vehicle_status); + const bool is_boat = is_boat_type(_vehicle_status); /* disable manual override for all systems that rely on electronic stabilization */ if (is_rotary) { @@ -1734,10 +1735,13 @@ void Commander::updateParameters() } else if (is_fixed) { _vehicle_status.vehicle_type = vehicle_status_s::VEHICLE_TYPE_FIXED_WING; - } else if (is_ground) { + } else if (is_rover) { _vehicle_status.vehicle_type = vehicle_status_s::VEHICLE_TYPE_ROVER; + } else if (is_boat) { + _vehicle_status.vehicle_type = vehicle_status_s::VEHICLE_TYPE_BOAT; } + _vehicle_status.is_vtol = is_vtol(_vehicle_status); _vehicle_status.is_vtol_tailsitter = is_vtol_tailsitter(_vehicle_status); diff --git a/src/modules/commander/commander_helper.cpp b/src/modules/commander/commander_helper.cpp index 48c9398249..6924c530e8 100644 --- a/src/modules/commander/commander_helper.cpp +++ b/src/modules/commander/commander_helper.cpp @@ -122,6 +122,16 @@ bool is_ground_vehicle(const vehicle_status_s ¤t_status) return (current_status.system_type == VEHICLE_TYPE_BOAT || current_status.system_type == VEHICLE_TYPE_GROUND_ROVER); } +bool is_rover_type(const vehicle_status_s ¤t_status) +{ + return current_status.system_type == VEHICLE_TYPE_GROUND_ROVER; +} + +bool is_boat_type(const vehicle_status_s ¤t_status) +{ + return current_status.system_type == VEHICLE_TYPE_BOAT; +} + // End time for currently blinking LED message, 0 if no blink message static hrt_abstime blink_msg_end = 0; static int fd_leds{-1}; diff --git a/src/modules/commander/commander_helper.h b/src/modules/commander/commander_helper.h index 3e96a636e5..f90eacdeeb 100644 --- a/src/modules/commander/commander_helper.h +++ b/src/modules/commander/commander_helper.h @@ -56,6 +56,8 @@ bool is_vtol(const vehicle_status_s ¤t_status); bool is_vtol_tailsitter(const vehicle_status_s ¤t_status); bool is_fixed_wing(const vehicle_status_s ¤t_status); bool is_ground_vehicle(const vehicle_status_s ¤t_status); +bool is_rover_type(const vehicle_status_s ¤t_status); +bool is_boat_type(const vehicle_status_s ¤t_status); int buzzer_init(void); void buzzer_deinit(void);