Browse Source

update vehicle status before doing preflight checks

sbg
Roman Bapst 10 years ago
parent
commit
5b772e5720
  1. 21
      src/modules/commander/commander.cpp
  2. 5
      src/modules/commander/commander_helper.cpp
  3. 1
      src/modules/commander/commander_helper.h

21
src/modules/commander/commander.cpp

@ -1125,6 +1125,10 @@ int commander_thread_main(int argc, char *argv[]) @@ -1125,6 +1125,10 @@ int commander_thread_main(int argc, char *argv[])
commander_initialized = true;
thread_running = true;
/* update vehicle status to find out vehicle type (required for preflight checks) */
param_get(_param_sys_type, &(status.system_type)); // get system type
status.is_rotary_wing = is_rotary_wing(&status) || is_vtol(&status);
bool checkAirspeed = false;
/* Perform airspeed check only if circuit breaker is not
* engaged and it's not a rotary wing */
@ -1204,15 +1208,7 @@ int commander_thread_main(int argc, char *argv[]) @@ -1204,15 +1208,7 @@ int commander_thread_main(int argc, char *argv[])
}
/* disable manual override for all systems that rely on electronic stabilization */
if (status.system_type == vehicle_status_s::VEHICLE_TYPE_COAXIAL ||
status.system_type == vehicle_status_s::VEHICLE_TYPE_HELICOPTER ||
status.system_type == vehicle_status_s::VEHICLE_TYPE_TRICOPTER ||
status.system_type == vehicle_status_s::VEHICLE_TYPE_QUADROTOR ||
status.system_type == vehicle_status_s::VEHICLE_TYPE_HEXAROTOR ||
status.system_type == vehicle_status_s::VEHICLE_TYPE_OCTOROTOR ||
(status.system_type == vehicle_status_s::VEHICLE_TYPE_VTOL_DUOROTOR && vtol_status.vtol_in_rw_mode) ||
(status.system_type == vehicle_status_s::VEHICLE_TYPE_VTOL_QUADROTOR && vtol_status.vtol_in_rw_mode)) {
if (is_rotary_wing(&status) || (is_vtol(&status) && vtol_status.vtol_in_rw_mode)) {
status.is_rotary_wing = true;
} else {
@ -1220,8 +1216,7 @@ int commander_thread_main(int argc, char *argv[]) @@ -1220,8 +1216,7 @@ int commander_thread_main(int argc, char *argv[])
}
/* set vehicle_status.is_vtol flag */
status.is_vtol = (status.system_type == vehicle_status_s::VEHICLE_TYPE_VTOL_DUOROTOR) ||
(status.system_type == vehicle_status_s::VEHICLE_TYPE_VTOL_QUADROTOR);
status.is_vtol = is_vtol(&status);
/* check and update system / component ID */
param_get(_param_system_id, &(status.system_id));
@ -1422,8 +1417,8 @@ int commander_thread_main(int argc, char *argv[]) @@ -1422,8 +1417,8 @@ int commander_thread_main(int argc, char *argv[])
orb_copy(ORB_ID(vtol_vehicle_status), vtol_vehicle_status_sub, &vtol_status);
status.vtol_fw_permanent_stab = vtol_status.fw_permanent_stab;
/* Make sure that this is only adjusted if vehicle realy is of type vtol*/
if ((status.system_type == vehicle_status_s::VEHICLE_TYPE_VTOL_DUOROTOR) || (status.system_type == vehicle_status_s::VEHICLE_TYPE_VTOL_QUADROTOR)) {
/* Make sure that this is only adjusted if vehicle really is of type vtol*/
if (is_vtol(&status)) {
status.is_rotary_wing = vtol_status.vtol_in_rw_mode;
}
}

5
src/modules/commander/commander_helper.cpp

@ -84,6 +84,11 @@ bool is_rotary_wing(const struct vehicle_status_s *current_status) @@ -84,6 +84,11 @@ bool is_rotary_wing(const struct vehicle_status_s *current_status)
|| (current_status->system_type == vehicle_status_s::VEHICLE_TYPE_COAXIAL);
}
bool is_vtol(const struct vehicle_status_s * current_status) {
return current_status->system_type == vehicle_status_s::VEHICLE_TYPE_VTOL_DUOROTOR ||
current_status->system_type == vehicle_status_s::VEHICLE_TYPE_VTOL_QUADROTOR;
}
static int buzzer = -1;
static hrt_abstime blink_msg_end = 0; // end time for currently blinking LED message, 0 if no blink message
static hrt_abstime tune_end = 0; // end time of currently played tune, 0 for repeating tunes or silence

1
src/modules/commander/commander_helper.h

@ -51,6 +51,7 @@ @@ -51,6 +51,7 @@
bool is_multirotor(const struct vehicle_status_s *current_status);
bool is_rotary_wing(const struct vehicle_status_s *current_status);
bool is_vtol(const struct vehicle_status_s *current_status);
int buzzer_init(void);
void buzzer_deinit(void);

Loading…
Cancel
Save