mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-28 06:00:34 +08:00
Merge branch 'master' into linux
Signed-off-by: Mark Charlebois <charlebm@gmail.com> Conflicts: makefiles/firmware.mk
This commit is contained in:
@@ -1127,6 +1127,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 */
|
||||
@@ -1206,15 +1210,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 {
|
||||
@@ -1222,8 +1218,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));
|
||||
@@ -1424,8 +1419,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;
|
||||
}
|
||||
}
|
||||
@@ -1604,7 +1599,11 @@ int commander_thread_main(int argc, char *argv[])
|
||||
|
||||
if (arming_ret == TRANSITION_CHANGED) {
|
||||
arming_state_changed = true;
|
||||
mavlink_and_console_log_critical(mavlink_fd, "LOW BATTERY, LOCKING ARMING DOWN");
|
||||
}
|
||||
|
||||
} else {
|
||||
mavlink_and_console_log_emergency(mavlink_fd, "CRITICAL BATTERY, LAND IMMEDIATELY");
|
||||
}
|
||||
|
||||
status_changed = true;
|
||||
@@ -2222,13 +2221,34 @@ set_main_state_rc(struct vehicle_status_s *status_local, struct manual_control_s
|
||||
|
||||
if (res == TRANSITION_DENIED) {
|
||||
print_reject_mode(status_local, "OFFBOARD");
|
||||
/* mode rejected, continue to evaluate the main system mode */
|
||||
|
||||
} else {
|
||||
/* changed successfully or already in this state */
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
/* offboard switched off or denied, check main mode switch */
|
||||
/* RTL switch overrides main switch */
|
||||
if (sp_man->return_switch == manual_control_setpoint_s::SWITCH_POS_ON) {
|
||||
res = main_state_transition(status_local,vehicle_status_s::MAIN_STATE_AUTO_RTL);
|
||||
|
||||
if (res == TRANSITION_DENIED) {
|
||||
print_reject_mode(status_local, "AUTO_RTL");
|
||||
|
||||
/* fallback to LOITER if home position not set */
|
||||
res = main_state_transition(status_local,vehicle_status_s::MAIN_STATE_AUTO_LOITER);
|
||||
}
|
||||
|
||||
if (res != TRANSITION_DENIED) {
|
||||
/* changed successfully or already in this state */
|
||||
return res;
|
||||
}
|
||||
|
||||
/* if we get here mode was rejected, continue to evaluate the main system mode */
|
||||
}
|
||||
|
||||
/* offboard and RTL switches off or denied, check main mode switch */
|
||||
switch (sp_man->mode_switch) {
|
||||
case manual_control_setpoint_s::SWITCH_POS_NONE:
|
||||
res = TRANSITION_NOT_CHANGED;
|
||||
@@ -2273,23 +2293,7 @@ set_main_state_rc(struct vehicle_status_s *status_local, struct manual_control_s
|
||||
break;
|
||||
|
||||
case manual_control_setpoint_s::SWITCH_POS_ON: // AUTO
|
||||
if (sp_man->return_switch == manual_control_setpoint_s::SWITCH_POS_ON) {
|
||||
res = main_state_transition(status_local,vehicle_status_s::MAIN_STATE_AUTO_RTL);
|
||||
|
||||
if (res != TRANSITION_DENIED) {
|
||||
break; // changed successfully or already in this state
|
||||
}
|
||||
|
||||
print_reject_mode(status_local, "AUTO_RTL");
|
||||
|
||||
// fallback to LOITER if home position not set
|
||||
res = main_state_transition(status_local,vehicle_status_s::MAIN_STATE_AUTO_LOITER);
|
||||
|
||||
if (res != TRANSITION_DENIED) {
|
||||
break; // changed successfully or already in this state
|
||||
}
|
||||
|
||||
} else if (sp_man->loiter_switch == manual_control_setpoint_s::SWITCH_POS_ON) {
|
||||
if (sp_man->loiter_switch == manual_control_setpoint_s::SWITCH_POS_ON) {
|
||||
res = main_state_transition(status_local,vehicle_status_s::MAIN_STATE_AUTO_LOITER);
|
||||
|
||||
if (res != TRANSITION_DENIED) {
|
||||
|
||||
Reference in New Issue
Block a user