Browse Source

FlightTaskAuto - Recover position control after local position reset (#11636)

* FlightTaskAuto - Explicitly check is _triplet_target is finite to decide if the target has to be updated or not. If the _target is NAN, always try to update it to get a valid setpoint.
sbg
bresch 6 years ago committed by Daniel Agar
parent
commit
c5706f6283
  1. 8
      src/lib/FlightTasks/tasks/Auto/FlightTaskAuto.cpp

8
src/lib/FlightTasks/tasks/Auto/FlightTaskAuto.cpp

@ -153,8 +153,12 @@ bool FlightTaskAuto::_evaluateTriplets() @@ -153,8 +153,12 @@ bool FlightTaskAuto::_evaluateTriplets()
bool triplet_update = true;
if (!(fabsf(_triplet_target(0) - tmp_target(0)) > 0.001f || fabsf(_triplet_target(1) - tmp_target(1)) > 0.001f
|| fabsf(_triplet_target(2) - tmp_target(2)) > 0.001f)) {
if (PX4_ISFINITE(_triplet_target(0))
&& PX4_ISFINITE(_triplet_target(1))
&& PX4_ISFINITE(_triplet_target(2))
&& fabsf(_triplet_target(0) - tmp_target(0)) < 0.001f
&& fabsf(_triplet_target(1) - tmp_target(1)) < 0.001f
&& fabsf(_triplet_target(2) - tmp_target(2)) < 0.001f) {
// Nothing has changed: just keep old waypoints.
triplet_update = false;

Loading…
Cancel
Save