This resolves issue #461 by giving the pilot a minimum of 10 seconds to
attempt to manually recover before the autopilot will attempt to retake
control to bring the copter home or land.
This ensures invalid pilot desired accelerations are cleared from the
loiter controller. This is probably not strictly necessary because the
vehicle should switch out of Loiter and into RTL during failsafe.
Resolves issue in which vehicle would get stuck at RTL_ALT_FINAL if
failsafe occured.
Also clear out pilot acceleration from loiter controller if failsafe
occurs during the final descent.
This resolves an issue in which the parachute could be suddenly released
when the user enabled the parachute. The sequence that could have
caused this bad behaviour were (1) the parachute is triggered (2) the
user disables the parachute in the 0.5sec between the trigger and the
actual release, (3) the user re-enables the parachute and the old
release time from (1) is used.
This fixes the issue in which a short RTL_LOIT_TIME could cause the
vehicle's heading to be caught between it's heading when it arrived at
home and the initial armed heading. With this fix it now waits above
home until the timer has run out AND the heading is within 2degrees of
the initial armed heading.
Note that an RTL command executed in AUTO mode will also disarm when it
lands and pilot's throttle is put to zero and no further commands will
be executed. This is normally not an issue because missions generally
end with an RTL (instead of having the RTL in the middle) and a work
around is available in that the LAND command could be used instead of
RTL.
Resolves bug in which do-set-speed allowed reducing the speed during the
mission but not increasing it.
Slow down distance is also recalculated.
Unnecessary call to calc_wp_leash_length removed from
set_spline_origin_and_destination.
Removed useless call of function
hybrid_get_wind_comp_lean_angles(hybrid.wind_comp_roll,
hybrid.wind_comp_pitch);
Removed 10Hz filter for hybrid_update_wind_comp_estimate()
when you exit auto and a takeoff is still in progress the flight stage
was not updated, which led to the throttle staying at maximum
Many thanks to Marco for finding this!
There was an error in the velocity axis used to update
brake_timeout_pitch (vel_right instead of vel_fw)
The wind_comp was not enough filtered for the Pixhawk (400Hz), so I
added a specific time constant (TC_WIND_COMP) to have the expected
filter with 400Hz controllers.
About throttle peaks, after some tests and from logs, they happen when
hybrid switches to loiter.
There is always a difference between Alt and DesiredAlt (DAlt), but,
when loiter engages, it initializes DAlt = Alt and the copter tries
immediatelly to reach that new setpoint. So the solution would be to
init_loiter_target() just as it was in pre-onion code : only x/y and not
z. and to be able to pass parameters like that
wp_nav.init_loiter_target(inertial_nav.get_position(), Vector3f(0,0,0));
Well, from this new code structure, it seems not possible with current
functions so I've used set_loiter_target that init position passed as
parameter and velocity to 0 (as expected).
BTW, I think there was something wrong with set_loiter_target function,
the "Vector3f& position" parameter was not used at all...
I moved the reset flag from init_loiter_target to set_loiter_target.
Corrected timer init values and wind_comp time constant to get the best
behaviour
Check if wider deadband required (current is 30).
We were using a comparison to a 70-100 cdeg deadband in our initial
code. The deadband was there to avoid unwanted switches in case of
inaccurate fingers/radio
Adjusted timers to 100/400Hz
I_term does not init when in hybrid loiter