mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-29 04:04:07 +08:00
FlightTaskAutoLine: if previous type was idle, set thrust to NAN again to ensure
thrust is not used. Also, if previous was not a loiter or position type, then reset setpoints to current state. This is needed because during line following, the previous setpoints are requires and cannot be NAN.
This commit is contained in:
parent
5f293cceac
commit
08a89ccdbb
@ -66,13 +66,29 @@ bool FlightTaskAutoLine::activate()
|
||||
|
||||
bool FlightTaskAutoLine::update()
|
||||
{
|
||||
bool follow_line = _type == WaypointType::loiter || _type == WaypointType::position;
|
||||
bool follow_line_prev = _type_previous == WaypointType::loiter || _type_previous == WaypointType::position;
|
||||
|
||||
/* 1st time that vehicle starts to follow line. Reset all setpoints to current vehicle state */
|
||||
if (follow_line && !follow_line_prev) {
|
||||
_reset();
|
||||
}
|
||||
|
||||
/* The only time a thrust setpoint is sent out is during
|
||||
* idle. Hence, reset thrust setpoint to NAN in case the
|
||||
* vehicle exits idle.
|
||||
*/
|
||||
if (_type_previous == WaypointType::idle) {
|
||||
_thrust_setpoint = Vector3f(NAN, NAN, NAN);
|
||||
}
|
||||
|
||||
if (_type == WaypointType::idle) {
|
||||
_generateIdleSetpoints();
|
||||
|
||||
} else if (_type == WaypointType::land) {
|
||||
_generateLandSetpoints();
|
||||
|
||||
} else if (_type == WaypointType::loiter || _type == WaypointType::position) {
|
||||
} else if (follow_line) {
|
||||
_generateSetpoints();
|
||||
|
||||
} else if (_type == WaypointType::takeoff) {
|
||||
@ -88,6 +104,9 @@ bool FlightTaskAutoLine::update()
|
||||
* same as during home... */
|
||||
_yaw_setpoint = _yaw_wp;
|
||||
|
||||
/* Update previous type */
|
||||
_type_previous = _type;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user