forked from Archive/PX4-Autopilot
FlightTaskAuto: set state to None if prev and current sp are equal
Otherwise if is set to Offtrack, which in turn leads to weird behavior. E.g. when triggering Land while flying fast forward, the vehcile doesn't descned to the land point it keeps getting a velocity setpoint from the smoother that pushes it away from the land point. Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
parent
6a34b63b60
commit
2734c44533
|
@ -636,7 +636,11 @@ State FlightTaskAuto::_getCurrentState()
|
||||||
|
|
||||||
State return_state = State::none;
|
State return_state = State::none;
|
||||||
|
|
||||||
if (u_prev_to_target_xy * pos_to_target_xy < 0.0f) {
|
if (u_prev_to_target_xy.length() < FLT_EPSILON) {
|
||||||
|
// Previous and target are the same point, so we better don't try to do any special line following
|
||||||
|
return_state = State::none;
|
||||||
|
|
||||||
|
} else if (u_prev_to_target_xy * pos_to_target_xy < 0.0f) {
|
||||||
// Target is behind
|
// Target is behind
|
||||||
return_state = State::target_behind;
|
return_state = State::target_behind;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue