mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-06 11:28:52 +08:00
mc_pos_control: enter FlighttaskFailsafe if Flighttask wants to be started, but all of
the Flighttask fail. A failure of the Flighttask can occur if the demanded Flighttask does not have the required data.
This commit is contained in:
committed by
ChristophTobler
parent
06c10f61c1
commit
81c5025ad8
@@ -742,7 +742,6 @@ MulticopterPositionControl::task_main()
|
||||
publish_avoidance_desired_waypoint();
|
||||
|
||||
} else {
|
||||
|
||||
// no flighttask is active: set attitude setpoint to idle
|
||||
_att_sp.roll_body = _att_sp.pitch_body = 0.0f;
|
||||
_att_sp.yaw_body = _local_pos.yaw;
|
||||
@@ -864,7 +863,6 @@ MulticopterPositionControl::start_flight_task()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// manual stabilized control
|
||||
if (_vehicle_status.nav_state == vehicle_status_s::NAVIGATION_STATE_MANUAL
|
||||
|| _vehicle_status.nav_state == vehicle_status_s::NAVIGATION_STATE_STAB || task_failure) {
|
||||
@@ -883,9 +881,17 @@ MulticopterPositionControl::start_flight_task()
|
||||
|
||||
// check task failure
|
||||
if (task_failure) {
|
||||
// No task was activated.
|
||||
_flight_tasks.switchTask(FlightTaskIndex::None);
|
||||
warn_rate_limited("No Flighttask is running");
|
||||
|
||||
// for some reason no flighttask was able to start.
|
||||
// go into failsafe flighttask
|
||||
int error = _flight_tasks.switchTask(FlightTaskIndex::Failsafe);
|
||||
task_failure = false;
|
||||
|
||||
if (error != 0) {
|
||||
// No task was activated.
|
||||
_flight_tasks.switchTask(FlightTaskIndex::None);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user