Commit Graph

251 Commits

Author SHA1 Message Date
Andrew Tridgell 86c2404654 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-18 06:43:16 +10:00
Henry Wurzburg 0d01ac389c Plane: add Q_OPTION for RTL always on RC failsafe for ship landing 2022-04-19 19:58:46 +10:00
Peter Barker fd4a00a654 ArduPlane: stop libraries including AP_Logger.h in .h files
AP_Logger.h is a nexus of includes; while this is being improved over
time, there's no reason for the library headers to include AP_Logger.h
as the logger itself is access by singleton and the structures are in
LogStructure.h

This necessitated moving The PID_Info structure out of AP_Logger's
namespace.  This cleans up a pretty nasty bit - that structure is
definitely not simply used for logging, but also used to pass pid
information around to controllers!

There are a lot of patches in here because AP_Logger.h, acting as a
nexus, was providing transitive header file inclusion in many (some
unlikely!) places.
2022-04-08 19:18:38 +10:00
Andrew Tridgell cc6fc2b130 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-18 13:36:16 +11:00
Andrew Tridgell 5e14b9efe6 Plane: use pos control for most of LAND_FINAL
this gives more accurate landing with some velocity drift
2022-03-10 07:34:20 +11:00
Andrew Tridgell cc9b9813cb Plane: review fixes
thanks Pete!
2022-03-10 07:34:20 +11:00
Andrew Tridgell f9ecf15973 Plane: setup target accel in POSITION1 state 2022-03-10 07:34:20 +11:00
Andrew Tridgell 3fe9a55269 Plane: added APIs for lua ship landing 2022-03-10 07:34:20 +11:00
Andrew Tridgell 6d63e1f7d3 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-09 07:50:10 +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
Gone4Dirt a79359dc67 Plane: use new weathervane library 2022-02-08 10:38:16 +11:00
Iampete1 3a5c7ea8fc Plane: quadplane: add transtion fail action param 2022-01-11 11:02:33 +11:00
Iampete1 abe9e4425b Plane: quadplane: remvoe unused loiter initial pitch varable 2021-12-31 08:46:31 +11:00
Hwurzburg 18e427d27d Plane: add Q_OPTION to force fw trans on fail instead of QLAND 2021-12-24 13:55:15 +11:00
Andrew Tridgell 77c43d9ba1 Plane: limiting POS1 landing target speed
prevent very high target speeds when the target velocity profile is
above the initial speed in POSITION1. Always allow up to 2*Q_WP_SPEED,
but don't go above the initial speed
2021-11-24 07:15:21 +11:00
Iampete1 9210488550 Plane: quadplane: limit pitch for all transitions into position control modes 2021-11-17 19:10:56 +11:00
Iampete1 af8688b300 Quadplane: add transiton class 2021-11-02 10:14:36 +11:00
Andrew Tridgell b74dca02ca Plane: avoid qpos approach when very close to destination
this prevents a fwd transition when doing something like LOITER_TIME
close to a VTOL_LAND wp. We use 1.5 times the stopping distance at
cruise airspeed for the threshold
2021-10-29 20:22:19 +11:00
Andrew Tridgell 19b5044223 Plane: fixed VTOL state error when using Q_ENABLE=2
this ensures the poscontrol state is reset if it has not been
initialised before a VTOL loiter operation

thanks to Pete Hall for finding this
2021-10-29 20:22:19 +11:00
Iampete1 73e9c9bb43 Plane: quadplane: forward throttle reutrn float 2021-10-20 18:29:58 +11:00
Peter Barker bcad5a7ba6 ArduPlane: handle renaming of AP_InertialNav_NavEKF to AP_InertialNav 2021-10-20 18:09:36 +11:00
Iampete1 30c9cccf78 Plane: Quadplane remove THR_MIN_PWM and THR_MAX_PWM 2021-10-11 22:19:17 -04:00
Iampete1 1148bb1234 Plane: Quadplane: add loiter to alt then QLAND mode 2021-09-28 09:31:13 +10:00
Andrew Tridgell fd5faa866f Plane: always log QPOS when changing control state 2021-09-27 21:21:53 +10:00
Peter Hall e83b598040 Plane: Quadplane: check attitude relax before running controllers, don't run controls if not going to output 2021-09-25 12:53:11 +10:00
Iampete1 cc89a8cc48 Plane: remove airmode Q_OPTION 2021-09-21 09:36:24 +10:00
Iampete1 c4a1ae42e5 Plane: Quadpalne: move tiltrotor functionality to own class 2021-09-17 08:24:17 +10:00
Peter Barker 3d34e061fe ArduPlane: add and use HAL_QUADPLANE_ENABLED 2021-09-14 11:23:18 +10:00
Iampete1 c73207b4b0 Plane: quadplane: remove init mode and control run methods 2021-09-08 18:06:58 +10:00
Iampete1 f1477a6c29 Plane: quadplane: add assisted flight only airmode 2021-09-01 08:33:24 +10:00
Hwurzburg 551d55a85c ArduPlane: add thr position trigger to ThrLandCtrl Q_OPTION 2021-08-25 12:32:59 +10:00
Iampete1 d372907a98 Plane: Quadplane: add Q_OPTION to only allow arming in Qmodes and auto. 2021-08-24 10:39:12 +10:00
Peter Hall 2527117cf9 Quadplane: combine assistance_needed and assistance_safe functions 2021-08-08 19:41:22 +10:00
Iampete1 7ff592d29e Plane: Quadplane: move mode functions to mode classes in-place 2021-08-03 12:28:31 +10:00
Iampete1 2bc2b9533b Plane: QuadPlane: move tailsitter to class 2021-07-27 09:08:34 +10:00
Peter Barker 06c2faaec5 ArduPlane: rename for AHRS restructuring 2021-07-21 21:01:39 +10:00
Andrew Tridgell 50e6d67a66 Plane: update for new double precision position APIs 2021-06-24 21:34:30 +10:00
Hwurzburg 4f48233b43 ArduPlane: add QRTL always as Q_RTL_MODE option 2021-06-14 09:08:20 +10:00
Andrew Tridgell f749c2c3ad Plane: fixed issue with overspeed in QPOS_POSITIION1
this fixes the backflip issue on the convergence that Henry found
2021-06-13 07:50:02 +10:00
Andrew Tridgell 74ac9964f1 Plane: improved POSITION1 speed profile
allow acceleration up to the Q_WP_SPEED, and assume a decel profile
matching Q_TRANS_DECEL for approach speed
2021-06-10 13:50:29 +10:00
Andrew Tridgell 3611b1dbf7 Plane: added check for QPOS initialisation
thanks to Kris for noticing this!
2021-06-10 13:50:29 +10:00
Andrew Tridgell db34577755 Plane: use a separate bit for landing reposition in quadplanes
when repositioning stop descent
2021-06-10 13:50:29 +10:00
Andrew Tridgell 06cd077c36 Plane: fixed stick mixing with land reposition in quadplanes
prevent stick mixing overriding landing control
2021-06-10 13:50:29 +10:00
Andrew Tridgell 0ecc02c53a Plane: fixed constructor of accel_ef filter 2021-06-08 11:14:52 +10:00
Andrew Tridgell aa904d6bbc Plane: fixed guided mode handling with new approach code
ensure we treat guided approach as not a vtol mode
2021-06-05 13:05:30 +10:00
Andrew Tridgell 0232fa7456 Plane: cope with fwd thrust loss in Q approach
if throttle is saturated and descending and low airspeed then declare
thrust loss
2021-06-05 13:05:30 +10:00
Andrew Tridgell a7b809d5d4 Plane: added approach and airbrake options
this defaults VTOL landings to have an approach and airbraking stage,
allowing for more efficient landings. Can be disabled by setting
Q_OPTIONS bit 16
2021-06-05 13:05:30 +10:00
Andrew Tridgell b4992cc226 Plane: added accessors for poscontrol state
allows for time since state entered
2021-06-05 13:05:30 +10:00
Andrew Tridgell f1f7f01300 Plane: slave fixed wing desired rate to multicopter desired rate
this ensures that the two rate controllers don't fight each other when
in a VTOL mode
2021-06-05 13:05:30 +10:00
Andrew Tridgell d1f6d913d5 Plane: adjust reposition landing code
use accel with 1s timeconstant
2021-05-24 20:13:37 +10:00