the nav_roll_cd and nav_pitch_cd were not being set in the VTOL
takeoff code when disarmed. This led to small increments accumulating
in the stick mixing code, leading to large control surface movements
before arming
this fixes a bug where TECS maintains its slow integrator while in a
VTOL hover mode in AUTO or GUIDED.
Among other things this affects PAYLOAD_PLACE and
DO_VTOL_TRANSITION. In those states the height can change while
hovering outside the control of TECS. When TECS regains control in a
fwd transition then can lead to a very large height loss or gain until
the TECS integrator can catch up
this sets up the vwd integrator more reasonably when we are in
POSITION1 stage of VTOL landing. We need to have enough throttle to
cope with a headwind, but want it lower when we are at or above our
target closing speed so can minimise the amount of pitch up
This also makes the landing_desired_closing_velocity() consistent with
the landing speed used in approach, using average of airspeed min and
cruise speed if TECS_LAND_ARSPD is not set
The target airspeed for TECS during airbraking is now set to
ARSPD_FBW_MIN, on the basis we are trying to slow down to min speed,
and we have VTOL support which should prevent a stall.
To cope with a high headwind where ARSPD_FBW_MIN is below the headwind
we now check for too low achieved closing speed and switch to
POSITION1 which can use vfwd to get to the landing location
During POSITION1 back-transiton we scale the MC angle P gains with
airspeed to reduce the chance of oscillations. At higher airspeeds the
fixed wing controller dominates so we should use the fixed wing angle
P gain.
if the user hasn't set TECS_LAND_ARSPD then we can use an airspeed
between ARSPD_FBW_MIN and TRIM_ARSPD_CM when on approach
this also fixes landing_desired_closing_velocity() to never go above
the landing target speed, so we don't try to speed up if we are
starting the landing sequence too early
this is equivalent to copters WP_NAVALT_MIN parameter for takeoff. Not
implemented for land yet
this is useful for vehicles with significant GPS velocity noise on
takeoff, preventing dragging the landing gear
this fixes a case where we can get false positive on the landing
detector for quadplanes.
The issue happens if we cross the LAND_DESCEND to LAND_FINAL threshold
while pilot repositioning is active, with stale information in
landing_detect.lower_limit_start_ms as we don't run should_relax() in
LAND_DESCEND
when we arm in guided mode then enter a special guided_wait_takeoff
state. We keep motors suppressed until one of the following happens
1) disarm
2) guided takeoff command
3) change to AUTO with a takeoff waypoint as first nav waypoint
4) change to another mode
while in this state we don't go to throttle unlimited, and will refuse
a change to AUTO mode if the first waypoint is not a takeoff. If we
try to switch to RTL then we will instead use QLAND
This state is needed to cope with the takeoff sequence used by QGC on
common controllers such as the MX16, which do this on a "takeoff"
swipe:
- changes mode to GUIDED
- arms
- changes mode to AUTO
when RC_OPTIONS has been changed to not check throttle for arming then
treat this like a sprung throttle for quadplane throttle suppression
in auto-throttle modes, and only unsuppress when throttle goes above
trim+dz
when rudder disarm is disabled we should allow full yaw control
regardless of throttle level. We should also only disable left yaw
when throttle is at zero, as right yaw does not indicate pilot may be
trying to disarm
when a quadplane touches down in an auto throttle mode the pilot may
use rudder to disarm. The check for rudder disarm was only active in
modes without auto-throttle. This expands it to all modes if the
throttle has hit the lower limit
this improves 4 things in the POSITION1 controller based on logs from
4.2.0beta2. The changes are designed to increase the tolerance to
an incorrect value for Q_TRANS_DECEL, reducing landing overshoot
1) we fix the initialisation of the acceleration. The
init_xy_controller() function assumes zero accel, so we need to
call set_accel_desired_xy_cmss() just after that init to get the
correct accel. Thanks to Leonard for this fix
2) if we decel more than expected due to too low Q_TRANS_DECEL we
need to reduce the target speed, rather than putting the nose down
3) lower the default Q_P_JERK_XY to a value more appropriate for most
quadplanes (Leonard suggested a value of 2)
4) fixed the pitch envelope from Q_BACKTRANS_MS to start after the
airbrake phase is complete
we need to setup last_fw_mode_ms and last_fw_nav_pitch_cd when we
enter POSITION1 mode so that the expanding envelope pitch limit from
Q_BACKTRANS_MS is applied correctly
if we are flying too far off the target vector then exit airbrake
state. This prevents flying for a long distance away from the landing
point in airbrake mode
avoid running the motors while tilted past the tilt max if we are in
AIRBRAKE state. This stops a large amount of forward thrust from the
tilted motors while trying to slow down, while still maintaining
attitude control