Commit Graph

616 Commits

Author SHA1 Message Date
Andrew Tridgell b3d84cd577 Plane: improve target airspeed in landing approach
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
2022-08-12 02:49:51 -04:00
Andrew Tridgell 4f9800ca41 Plane: base yaw in overshoot on target speed not scaled speed
this prevents an oscillating due to the speed changing as we yaw,
resulting in a different yaw target
2022-08-12 02:49:51 -04:00
Andrew Tridgell e0b4da9f68 Plane: improve target airspeed in landing approach
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
2022-08-12 02:49:51 -04:00
Andrew Tridgell baa84a7fdd Plane: in overshoot allow up to the Q WP speed
this prevents us using too much battery when we are a long way from
the landing point
2022-08-12 02:49:51 -04:00
Andrew Tridgell 29ccd0e106 Plane: limit target accel in POSITION1
don't ask for more than 2* transition limit, and reset when we enter
overshoot case
2022-08-12 02:49:51 -04:00
Andrew Tridgell b2f17e7553 Plane: adjust target vector for wind in overshoot
at low speeds we want to keep the nose pointed into the wind on
landings
2022-08-12 02:49:51 -04:00
Andrew Tridgell 473804f11c Plane: cope with overshoot in POSITION1 VTOL land state
when we overshoot run a simple position controller that tries to point
the nose at the landing point and aims for the position2 speed
threshold
2022-08-12 02:49:51 -04:00
Andrew Tridgell 341ef82ab1 Plane: added Q_NAVALT_MIN
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
2022-06-21 19:41:54 +09:00
Iampete1 fd47504905 Plane: Quadplane: force convertions of Q_M_PMW_* params if invalid and add arming check 2022-06-21 19:41:54 +09:00
Andrew Tridgell f133ef6b12 Plane: adjust down default quadplane gains
make it better for a typical quadplane, the defaults were more
suitable on smaller aircraft
2022-06-21 19:41:54 +09:00
Andrew Tridgell b0c8c49643 Plane: fixed false positive in landing detector
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
2022-05-28 16:08:17 +09:00
Andrew Tridgell d010bc8b55 Plane: increased safety of guided -> auto quadplane takeoff
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
2022-05-28 16:08:17 +09:00
Andrew Tridgell 669e11b80d Plane: account for sprung throttle in VTOL throttle suppression
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
2022-05-28 16:08:17 +09:00
Andrew Tridgell de168fe827 Plane: update gyro fft throttle
allows for updating or learned FFT freq
2022-05-28 16:08:17 +09:00
Andrew Tridgell 04de0cb382 Plane: add Q_OPTION for RTL always on RC failsafe for ship landing 2022-04-29 08:06:29 +09:00
Andrew Tridgell aeed2b1a9d Plane: fixed rudder control when ARMING_RUDDER != 2
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
2022-04-09 17:12:27 +09:00
Andrew Tridgell a51f595ef0 Plane: fixed yaw on the ground when rudder disarming in AUTO
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
2022-03-30 19:12:45 +09:00
Andrew Tridgell a977898bd3 Plane: when shutting down motors force outputs to minimum
this fixes issue #20354 where a long spool time can lead to motors
running without control for an extended period of time.
2022-03-30 19:12:45 +09:00
Andrew Tridgell 77bc475ad6 Plane: adjust throttle mix for auto landing
use mix-max during landing approach and initial descent, use min in
land final. As discussed with Leonard
2022-03-30 19:12:45 +09:00
Andrew Tridgell dfd9ead46f Plane: added airspeed based pitch limit check
prevent using too much pitch when at low airspeed, which can lead to
severe instability in SLT quadplanes
2022-03-30 19:12:45 +09:00
Andrew Tridgell 513afb046f Plane: added an arming check for Q_ASSIST_SPEED
Q_ASSIST should really be enabled for all non-tailsitter
quadplanes. This arming check will help users remember to configure it
2022-03-30 19:12:45 +09:00
Andrew Tridgell 06b77f2cf1 Plane: use set_lean_angle_max_cd()
allows for a wider range of Q_TRANS_DECEL while landing on the desired
landing point
2022-03-30 19:12:45 +09:00
Andrew Tridgell d1a2cafb01 Plane: improvements to POSITION1 controller
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
2022-03-30 19:12:45 +09:00
Andrew Tridgell d666f6ed02 Plane: fixed pitch envelope after AIRBRAKE
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
2022-03-30 19:12:45 +09:00
Andrew Tridgell 743f0bc3f9 Plane: protect against short stop_distance 2022-03-12 08:00:49 +09:00
Iampete1 9f32204f15 Plane: quadplane: double log QPOS state change 2022-03-12 08:00:49 +09:00
Peter Barker 4631392f31 Plane: use has_valid_input in place of checking throttle counter 2022-03-12 08:00:49 +09:00
Andrew Tridgell fbe1672d22 Plane: use pos control for most of LAND_FINAL
this gives more accurate landing with some velocity drift
2022-03-12 08:00:49 +09:00
Andrew Tridgell 49e83841d4 Plane: review fixes
thanks Pete!
2022-03-12 08:00:49 +09:00
Andrew Tridgell 0a2f347c36 Plane: wait till motors are fully up before takeoff in guided mode
this allows for guided mode takeoff in tilt-rotors. Otherwise motors
till be pointing forward and takeoff will go very badly
2022-03-12 08:00:49 +09:00
Andrew Tridgell 9d1e218f4c Plane: cope with high angle error in airbrake state
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
2022-03-12 08:00:49 +09:00
Andrew Tridgell 993248b6d5 Plane: setup target accel in POSITION1 state 2022-03-12 08:00:49 +09:00
Andrew Tridgell c5b7fd03d8 Plane: allow for a trans decel margin
so if we are behind the velocity curve we are less likely to overshoot
landing
2022-03-12 08:00:49 +09:00
Andrew Tridgell d7913104cb Plane: fix NAV_CONTROLLER_OUTPUT in Q modes
Q modes don't always use wp_nav, but do use pos_control

AUTO and QRTL setup the plane navigation as well, so can use the L1
data
2022-03-12 08:00:49 +09:00
Andrew Tridgell 2b257663dc Plane: added APIs for lua ship landing 2022-03-12 08:00:49 +09:00
Andrew Tridgell fc7a8a1a19 Plane: added Q_LAND_ALTCHG parameter
this is the threshold height change over 4 seconds for a landing to be
detected. It can be raised if landing detection is very slow
2022-03-12 08:00:49 +09:00
Iampete1 267583db55 Plane: quadplane: never reset yaw target rates when entering QPOS1 2022-02-21 09:35:06 +11:00
Iampete1 9fd14dbf94 Plane: quadplane: set IO failsafe limit for all motors 2022-02-17 12:31:16 +11:00
Andrew Tridgell 1bdc9b5bf8 Plane: fixed in_vtol logic so QRTL can AIRBRAKE 2022-02-16 07:43:01 +11:00
Andrew Tridgell aab6c94936 Plane: don't weathervane in AIRBRAKE state
this prevents unwanted VTOL motor throttle while trying to slow
down. In this stage the slaving of yaw rate to fixed wing roll control
is sufficient
2022-02-16 07:43:01 +11:00
Andrew Tridgell 2846f87eeb Plane: reduce height gain in auto landing for tiltrotors
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
2022-02-16 07:43:01 +11:00
Iampete1 1ca1707f9f Plane: quadpalne: keep motors interlock state upto date with E-stop 2022-02-10 07:43:40 +09:00
Peter Hall 717b18a680 Plane: quadplane: add allow_weathervane transtion class method 2022-02-08 10:38:16 +11:00
Peter Hall 6a719664d3 Plane: quadplane: pass takeoff and landing state to weathervane 2022-02-08 10:38:16 +11:00
Gone4Dirt a79359dc67 Plane: use new weathervane library 2022-02-08 10:38:16 +11:00
murata f8383df5a4 Plane: Remove meaningless semicolons 2022-02-07 08:27:34 +09:00
Bill Geyer 54bdde8845 Copter: fix parameter issue with quadplane 2022-02-01 23:06:51 -05:00
Peter Barker 266d384ca7 ArduPlane: rename AP_AHRS::get_position to get_location 2022-01-25 10:47:22 +11:00
Iampete1 32488a5e3a Plane: add MOTB logging at 10hz 2022-01-18 10:18:10 +11:00
Iampete1 3a5c7ea8fc Plane: quadplane: add transtion fail action param 2022-01-11 11:02:33 +11:00