mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-10 01:11:35 +08:00
precland: also check flight mode
So far flight mode manager was checking navigator states, but not if commander switches to precland on its own. For example "commander mode auto:precland" or the flight mode menu in QGC
This commit is contained in:
@@ -147,6 +147,8 @@ void FlightModeManager::start_flight_task()
|
|||||||
const bool precland_mission_item_active = _vehicle_status_sub.get().nav_state ==
|
const bool precland_mission_item_active = _vehicle_status_sub.get().nav_state ==
|
||||||
vehicle_status_s::NAVIGATION_STATE_AUTO_MISSION &&
|
vehicle_status_s::NAVIGATION_STATE_AUTO_MISSION &&
|
||||||
_navigator_mission_item_sub.get().nav_sub_cmd == navigator_mission_item_s::WORK_ITEM_TYPE_PRECISION_LAND;
|
_navigator_mission_item_sub.get().nav_sub_cmd == navigator_mission_item_s::WORK_ITEM_TYPE_PRECISION_LAND;
|
||||||
|
const bool precland_flight_mode = _vehicle_status_sub.get().nav_state ==
|
||||||
|
vehicle_status_s::NAVIGATION_STATE_AUTO_PRECLAND;
|
||||||
|
|
||||||
// Do not run any flight task for VTOLs in fixed-wing mode
|
// Do not run any flight task for VTOLs in fixed-wing mode
|
||||||
if (_vehicle_status_sub.get().vehicle_type == vehicle_status_s::VEHICLE_TYPE_FIXED_WING) {
|
if (_vehicle_status_sub.get().vehicle_type == vehicle_status_s::VEHICLE_TYPE_FIXED_WING) {
|
||||||
@@ -173,7 +175,7 @@ void FlightModeManager::start_flight_task()
|
|||||||
task_failure = true;
|
task_failure = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (land_should_be_precland || precland_mission_item_active) {
|
} else if (land_should_be_precland || precland_mission_item_active || precland_flight_mode) {
|
||||||
// Take-over landing from navigator if precision landing is enabled
|
// Take-over landing from navigator if precision landing is enabled
|
||||||
should_disable_task = false;
|
should_disable_task = false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user