From 8e9e9f8a8be960824c9fc231e73bb9ffc7e61377 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 24 Feb 2016 10:27:00 +0000 Subject: [PATCH] vehicle_status: move vtol_vehicle_status enum It makes more sense to have the VTOL status in its own message. --- msg/vehicle_status.msg | 7 ------- msg/vtol_vehicle_status.msg | 7 +++++++ src/modules/navigator/mission_block.cpp | 2 +- src/modules/navigator/mission_block.h | 1 + src/modules/vtol_att_control/vtol_att_control_main.cpp | 6 +++--- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/msg/vehicle_status.msg b/msg/vehicle_status.msg index a34bc78463..c5c02fed5b 100644 --- a/msg/vehicle_status.msg +++ b/msg/vehicle_status.msg @@ -51,13 +51,6 @@ uint8 NAVIGATION_STATE_AUTO_LAND = 18 # Land uint8 NAVIGATION_STATE_AUTO_FOLLOW_TARGET = 19 # Auto Follow uint8 NAVIGATION_STATE_MAX = 20 -# VEHICLE_VTOL_STATE, should match 1:1 MAVLinks's MAV_VTOL_STATE -uint8 VEHICLE_VTOL_STATE_UNDEFINED = 0 -uint8 VEHICLE_VTOL_STATE_TRANSITION_TO_FW = 1 -uint8 VEHICLE_VTOL_STATE_TRANSITION_TO_MC = 2 -uint8 VEHICLE_VTOL_STATE_MC = 3 -uint8 VEHICLE_VTOL_STATE_FW = 4 - uint8 VEHICLE_BATTERY_WARNING_NONE = 0 # no battery low voltage warning active uint8 VEHICLE_BATTERY_WARNING_LOW = 1 # warning of low voltage uint8 VEHICLE_BATTERY_WARNING_CRITICAL = 2 # alerting of critical voltage diff --git a/msg/vtol_vehicle_status.msg b/msg/vtol_vehicle_status.msg index 6fce6b330e..27b804c437 100644 --- a/msg/vtol_vehicle_status.msg +++ b/msg/vtol_vehicle_status.msg @@ -1,3 +1,10 @@ +# VEHICLE_VTOL_STATE, should match 1:1 MAVLinks's MAV_VTOL_STATE +uint8 VEHICLE_VTOL_STATE_UNDEFINED = 0 +uint8 VEHICLE_VTOL_STATE_TRANSITION_TO_FW = 1 +uint8 VEHICLE_VTOL_STATE_TRANSITION_TO_MC = 2 +uint8 VEHICLE_VTOL_STATE_MC = 3 +uint8 VEHICLE_VTOL_STATE_FW = 4 + uint64 timestamp # Microseconds since system boot bool vtol_in_rw_mode # true: vtol vehicle is in rotating wing mode bool vtol_in_trans_mode diff --git a/src/modules/navigator/mission_block.cpp b/src/modules/navigator/mission_block.cpp index 9440d8442a..eca686a9b3 100644 --- a/src/modules/navigator/mission_block.cpp +++ b/src/modules/navigator/mission_block.cpp @@ -523,7 +523,7 @@ MissionBlock::set_land_item(struct mission_item_s *item, bool at_current_locatio if(_navigator->get_vstatus()->is_vtol && !_navigator->get_vstatus()->is_rotary_wing){ struct vehicle_command_s cmd = {}; cmd.command = NAV_CMD_DO_VTOL_TRANSITION; - cmd.param1 = vehicle_status_s::VEHICLE_VTOL_STATE_MC; + cmd.param1 = vtol_vehicle_status_s::VEHICLE_VTOL_STATE_MC; if (_cmd_pub != nullptr) { orb_publish(ORB_ID(vehicle_command), _cmd_pub, &cmd); } else { diff --git a/src/modules/navigator/mission_block.h b/src/modules/navigator/mission_block.h index a95fd8410a..5f6e00a764 100644 --- a/src/modules/navigator/mission_block.h +++ b/src/modules/navigator/mission_block.h @@ -48,6 +48,7 @@ #include #include #include +#include #include #include diff --git a/src/modules/vtol_att_control/vtol_att_control_main.cpp b/src/modules/vtol_att_control/vtol_att_control_main.cpp index 26352dcd69..b247df4a3f 100644 --- a/src/modules/vtol_att_control/vtol_att_control_main.cpp +++ b/src/modules/vtol_att_control/vtol_att_control_main.cpp @@ -467,7 +467,7 @@ VtolAttitudeControl::is_fixed_wing_requested() // listen to transition commands if not in manual if (!_v_control_mode.flag_control_manual_enabled) { - to_fw = _transition_command == vehicle_status_s::VEHICLE_VTOL_STATE_FW; + to_fw = _transition_command == vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW; } // handle abort request @@ -699,10 +699,10 @@ void VtolAttitudeControl::task_main() // reset transition command if not auto control if (_v_control_mode.flag_control_manual_enabled) { if (_vtol_type->get_mode() == ROTARY_WING) { - _transition_command = vehicle_status_s::VEHICLE_VTOL_STATE_MC; + _transition_command = vtol_vehicle_status_s::VEHICLE_VTOL_STATE_MC; } else if (_vtol_type->get_mode() == FIXED_WING) { - _transition_command = vehicle_status_s::VEHICLE_VTOL_STATE_FW; + _transition_command = vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW; } }