Commit Graph

283 Commits

Author SHA1 Message Date
Andrew Tridgell 198ada2b42 APM_Control: avoid some float conversion warnings 2014-07-08 20:26:20 +10:00
Andrew Tridgell eb1fb63e57 APM_Control: added logging of parameter changes in AUTOTUNE
this will make it easier to analyse logs
2014-04-30 22:22:13 +10:00
Andrew Tridgell 871d0c0e44 APM_Control: moved the log structure to ArduPlane core
this allows it to work with old style .log files
2014-04-30 21:22:28 +10:00
Andrew Tridgell 7f9a9107c7 APM_Control: logging_started needs to be static
prevents writing log headers twice
2014-04-21 07:13:06 +10:00
Andrew Tridgell b4c5f31b17 APM_Control: reduce the number of parameter saves in autotune
don't save a parameter unless it has changed by 0.1%
2014-04-17 17:20:40 +10:00
Paul Riseborough ccc7d36493 APM_Control: Modify D and I gain scaling 2014-04-17 17:11:48 +10:00
Andrew Tridgell ae7293ef68 APM_Control: added support for AUTOTUNE_LEVEL
10 levels of tune, for what type of tune the user wants
2014-04-13 22:11:57 +10:00
Andrew Tridgell df192a9efd AP_AutoTune: lower min tau to 0.2 2014-04-13 19:25:54 +10:00
Andrew Tridgell 3343af602e APM_Control: fixed saving of new rate gains 2014-04-13 15:35:52 +10:00
Andrew Tridgell b9a8ef3b51 APM_Control: fixed a bug in autotune servo saturation check
its in degrees not centi-degrees
2014-04-13 15:28:36 +10:00
Andrew Tridgell 64170d0f04 APM_Control: added dataflash logging to autotune 2014-04-12 18:21:50 +10:00
Andrew Tridgell 50fc75917e APM_Control: first version of APM_Control autotuning
this adds autotune to the roll/pitch controllers using a very simple
mechanism. The plan is that this provides a framework which Paul and
Jon will build upon.
2014-04-12 14:11:33 +10:00
Don Gagne 1db3c6e688 AP_Arming: param doc fixes
These were confusing the parser, or just incorrect
2014-01-10 10:40:53 +09:00
Don Gagne e68cf2d1c5 Plane: Fix parameter documentation
Fixes some problems with incorrect docs which would in turn generate
bad amp.pdef.xml files for ground stations.

merge with below
2014-01-09 14:02:21 +09:00
Paul Riseborough 779e32d79f AP_Control : Add true airspeed compensation to pitch controller
turn rate to pitch rate calculation should use true airspeed
2013-12-17 14:17:43 +11:00
Andrew Tridgell 9b5cae2134 APM_Control: reduce roll compensation in pitch controller by cos(pitch)
This reduces the use of the pitch compensation when in a steep climb
or dive

Pair-Programmed-With: Paul Riseborough <p_riseborough@live.com.au>
2013-11-04 21:21:42 +11:00
Andrew Tridgell 2930184680 AP_YawController: update for AHRS API change 2013-11-04 21:21:42 +11:00
Paul Riseborough 97cdd36dd8 APM_Control : Moved scaler on roll and pitch integrator to be before integrator
This means that the value of aileron and elevator trim offset won't change with airspeed
2013-10-25 22:37:49 +11:00
Andrew Tridgell 64c8cb4739 APM_Control: improved auto docs for AP_SteerController 2013-10-07 09:31:02 +11:00
Andrew Tridgell 39bfd809c2 APM_Control: disable integrator below minimum speed
this reduces the impact on initial takeoff
2013-10-05 18:11:35 +10:00
Andrew Tridgell 58187ea449 APM_Control: change minspeed on steering controller to 1.0 2013-10-05 12:56:28 +10:00
Andrew Tridgell 5abf060c41 APM_Control: enable integrator in ACRO rate controller
this work better for unlocked mode
2013-10-05 07:42:48 +10:00
Andrew Tridgell d27f5e89d7 APM_Control: remove public AP_PitchController::get_coordination_rate_of|cat() 2013-10-05 07:42:48 +10:00
Andrew Tridgell bd848a6a7f APM_Control: added rate and angle steering controllers 2013-10-05 07:42:48 +10:00
Andrew Tridgell 0784c01f19 APM_Control: added STEER2SRV_MINSPD
this is the assumed min speed when in STEERING or AUTO mode
2013-09-30 09:05:37 +10:00
Andrew Tridgell af2d7232c5 APM_Control: make the default time constant 0.75
thanks to Tom for the testing!
2013-09-24 07:37:12 +10:00
Andrew Tridgell 3e24ff1b07 AP_SteerController: change the scaling of the D term
this should cope better with low speed
2013-09-16 09:42:45 +10:00
Andrew Tridgell 98b4ed1522 AP_SteerController: lower the default STEER2SRV_D 2013-09-16 08:26:29 +10:00
Andrew Tridgell fbe4be94cf APM_Control: changed to AP_Vehicle.h 2013-09-13 11:46:22 +10:00
Andrew Tridgell 2171f2a80b AP_SteerController: move scaler onto integrator input
this should make integrator scale with speed

Pair-Programmed-With: Paul Riseborough <p_riseborough@live.com.au>
2013-09-12 07:48:57 +10:00
Andrew Tridgell 0918393fed APM_Control: fixed some documentation typos 2013-09-09 18:04:40 +10:00
Andrew Tridgell 7413c15959 APM_Control: added a ground vehicle steering controller
this will be used both for the rover code, and for ground steering of
a plane on takeoff
2013-09-09 18:04:40 +10:00
Andrew Tridgell 97b7130bb9 libraries: update license header to GPLv3
we switched to GPLv3 a long time ago, but neglected to update the
per-file license headers
2013-08-30 13:01:39 +10:00
Andrew Tridgell c6e37aaec3 APM_Control: use a ahrs reference, not pointer
saves pointer check
2013-08-14 14:56:18 +10:00
Andrew Tridgell a7cbebbeba APM_Control: rename 'stabilize' to 'disable_integrator'
this better reflects what it does
2013-08-02 21:54:48 +10:00
Andrew Tridgell 57752df68e APM_Control: set a small D value by default
0.02 may help with some planes that have slow response

Pair-Programmed-With: Paul Riseborough <p_riseborough@live.com.au>
2013-07-26 16:07:00 +10:00
Andrew Tridgell c5028c04da APM_Control: scale controllers for altitude
this allows the attitude controllers to better handle a wider range of
altitudes

Pair-Programmed-With: Paul Riseborough <p_riseborough@live.com.au>
2013-07-22 12:50:01 +10:00
Andrew Tridgell 3e21d0594c APM_Control: pass in aircraft parameters and expose coordinate rate offset
this will make it possible to do rate based pitch control without
having a coordinated turn, for in ACRO mode

Pair-Programmed-With: Paul Riseborough <p_riseborough@live.com.au>
2013-07-18 14:53:26 +10:00
Andrew Tridgell 5901b8b22a APM_Control: allow for a wider range of P values for roll/pitch
values above 1.0 are sometimes needed
2013-07-18 09:05:17 +10:00
Andrew Tridgell 2ee43a694c APM_Control: fixed YAW2SRV_IMAX handling
thanks to Steven G for noticing this!
2013-07-16 09:44:23 +10:00
Andrew Tridgell cc778a68ae APM_Control: changed attitude controllers to take angular error not angle
this makes it easier for ACRO mode
2013-07-13 21:45:58 +10:00
Andrew Tridgell f2316747f5 APM_Control: re-work to allow for rate based control 2013-07-11 09:10:41 +10:00
Paul Riseborough 2204b30e66 Plane: Added APM_Control integrator limits to table used to covert old PID values 2013-06-22 21:59:47 +10:00
Paul Riseborough 147856e73c APM_Control: Added integrator limiting adjustable by an advanced user parameter
this is compatible with the old IMAX settings
2013-06-22 21:55:27 +10:00
Paul Riseborough d8dab7b5c7 APM_Control: Pitch Control - Reduced the speed below which the integrator is locked
This is to allow for slow speed flare manoeuvres in FBW modes
2013-06-22 21:49:40 +10:00
Paul Riseborough 3ad35363be Plane : APM_Control : Removed scaler incorrectly applied to the integrator path 2013-06-04 18:09:06 +10:00
Andrew Tridgell 05889391e5 APM_Control: cope with zero integrator or tconst
if the user zeros the integrator tuning factor, we need to zero the
integrator
2013-06-01 22:29:38 +10:00
Andrew Tridgell 512d3d811d APM_Control: neaten up code formatting 2013-06-01 22:29:38 +10:00
Andrew Tridgell 14c8c1bdfc APM_Control: tweak code layout and param descriptions 2013-05-31 17:24:55 +10:00
Andrew Tridgell f4efa92d3b APM_Control: fixed parameter names 2013-05-31 15:31:25 +10:00
Andrew Tridgell 3e8af05d15 APM_Control: match parameter names with old PID controllers
this will make upgrading easier
2013-05-31 14:06:56 +10:00
Andrew Tridgell 53d3ce7d2c APM_Control: fixed some documentation (old parameter names) 2013-05-31 07:58:29 +10:00
Paul Riseborough 716c124f73 APM_control: Modified gain definitions for roll and pitch controllers so PID gains behave like previous servo PIDS
Gain definitions in roll and pitch controllers were updated previously
so that the old PID tuning values could be transferred across.
Updated tuning guide for revised gain definition.
2013-05-31 07:58:20 +10:00
Andrew Tridgell 6c5718a63b APM_Control: fixed indent-tabs-mode 2013-05-30 09:53:02 +10:00
priseborough aee23361dd APM_Control: Corrected typographical error in APM_Control/TuningGuide.txt 2013-05-07 11:00:57 +10:00
Andrew Tridgell 46c6aa8a9a APM_Control: tweak the parameter names 2013-05-05 21:51:09 +10:00
Andrew Tridgell 400777b059 APM_Control: support inverted flight in AP_PitchController
auto-reverse pitch control when inverted. This is useful not just for
inverted flight mode, but also for recovering from poor manual flight

Pair-Programmed-With: Paul Riseborough <p_riseborough@live.com.au>
2013-05-05 21:51:09 +10:00
Andrew Tridgell 604bfd0700 APM_Control: adjust recommended ranges 2013-05-05 21:51:09 +10:00
Andrew Tridgell 7af3c667a5 APM_Control: added roll controller parameter docs 2013-05-05 21:51:09 +10:00
Andrew Tridgell 52c3f8841f APM_Control: added yaw parameter docs 2013-05-05 21:51:09 +10:00
Andrew Tridgell b618d1d81f APM_Control: added inline docs to pitch controller 2013-05-05 21:51:09 +10:00
Andrew Tridgell 6c6c0079ee APM_Control: improved formatting of tuning guide
be a bit more web friendly
2013-05-05 21:51:09 +10:00
Andrew Tridgell 742df0ac05 APM_Control: rename to avoid spaces in filenames 2013-05-05 21:51:09 +10:00
Andrew Tridgell 23d9c31b0a APM_Control: fixed build and merge errors 2013-05-05 21:51:08 +10:00
Paul Riseborough 10ecffce01 APM_Control: ROLL and PITCH controllers
These changes reduce height variation in turns and improve
robustness. the specific changes are:

1) Linked roll and pitch integrator protection to the final output
value so that if final output is on upper limit, the integrator is
prevented from increasing and vice-versa. This improves wind-up
protection.

2) Modified rate feedback in roll and pitch controllers to use body
rates rather than Euler or earth rates.

3) Changed the roll to pitch compensation to use measured roll angle
and estimated airspeed to calculate the component of turn rate
(assuming a level coordinated turn) around the pitch axis. This a
mathematically correct calculation and will work over a range of bank
angles and aircraft with minimal (if any) tuning required.

4) The integrator in the roll and pitch loop is clamped when the
estimated speed is below the minimum FBW speed

5) The noise filter in the pitch and roll loop has been changed to use
a FOH discretisation. This gives improved noise rejection and less
phase loss when compared to the previous filter that used a ZOH or
equivalent discretisation.

This has been flown on the rascal in the SITL and on a X-8 with
limited flight testing. Initial results have been encouraging with
reduced height variation in turns.  Compare to standard PIDS, the
revised pitch and roll controllers allow the use of rate feedback
(effectively the same as the old D term) without beating the servos to
death.  The bank angle compensation in the pitch loop works
effectively over a much larger range of bank angles and requires
minimal tuning compared to the old calculation.

YAW CONTROLLER

Currently testing the a 3-loop acceleration autopilot topology for the
yaw loop with feed forward yaw rate for turn compensation. This 3-loop
topology is commonly used in tactical skid to to turn missiles and is
easy to tune. The following block diagram shows the general signal
flow

Note that the acceleration measurement has to pass through an
integrator before it gets to the actuator. This is a important feature
as it eliminates problems of high frequency noise and potential
coupling with structural modes associated with direct feedback of
measured acceleration to actuator.

The high pass filter has been inserted to compensate for airspeed and
bank angle measurement errors which will cause steady state errors in
the calculation of the turn yaw rate.

The yaw controller flies SITL well, but hasn't been flight tested
yet. It can be configured either as a simple yaw damper, or the
acceleration and integral term can be turned on to allow feedback
control of lateral acceleration/sideslip.

TO DO:

Need to reduce number of tuning parameters and provide consistent
naming Need to provide guidance on tuning these loops with definitions
for all the gain terms.  Need to check signs and units into and out of
lateral loops.

DESIGN DECISIONS PENDING:

1) Can we remove the noise filters? Provided the mpu6k noise filter is
running they are of limited benefit given the 25Hz Nyquist frequency

2) If we do remove them and rely on the mpu6k noise filter, what is
the apprporiate default cutoff frequency for plane use. 20Hz is
probably OK for most setups, but some noisy/high vibration setups
would require as low as 10Hz

3) The inverted flight logic looks like a crash waiting to
happen. It's problematic to test and even if implemented correctly
would still crash a plane with poor inverted flight capability. We
should either implement it properly and fully tested or delete it.
2013-05-05 21:51:08 +10:00
priseborough 205397d030 APM_Control: Modified calculation of bank compensation rate offset to prevent climb if speed > max fbw speed
The previous calculation constrained the speed used to calculate the
bank compensation rate offset between the min and max fbw speeds. This
would result in an unwanted climb if flown above the max fbw speed
(this could happen in fbw-a mode)
2013-05-05 21:51:08 +10:00
priseborough e7736ed4e0 APM_Control: APM tuning guide.txt - Updated tuning instructions with numerical values for alternate method 2013-05-05 21:51:08 +10:00
Paul Riseborough 3034a9fab2 APM_Control: Added alternate tuning method for roll and pitch loops
The alternate tuning method for roll and pitch will give a better
results, but comes with more risk as it will result in a larger rate
feedback gain
2013-05-05 21:51:08 +10:00
priseborough 2c29186b03 APM_Control: APM tuning guide.txt - Minor editorial corrections 2013-05-05 21:51:08 +10:00
priseborough d159d39037 APM_Control: APM tuning guide.txt - Added step by step tuning description. 2013-05-05 21:51:08 +10:00
priseborough 99f0fb6bd2 APM_Control : Removed 20Hz low-pass filters on rate gyro inputs.
These are not required due to MPU 6000 filtering.
2013-05-05 21:51:08 +10:00
priseborough 317b75f4cd APM_Control: Added tuning guide readme 2013-05-05 21:51:08 +10:00
Andrew Tridgell ba83950fc4 libraries: replace constrain() with constrain_float()
this makes the type much more obvious. Thanks to Tobias for the
suggestion.
2013-05-02 10:25:40 +10:00
James Bielman 4fa7bb1486 Add AVR compatibility header for missing math.h definitions.
- Define float versions of math functions to the double versions
  on AVR (eg. #define sinf sin).
- These macros appear to be missing in older versions of avr-libs.
- Include AP_Math.h rather than math.h to get these definitions.
2013-01-16 13:52:17 +11:00
James Bielman 5631f865b2 Update floating point calculations to use floats instead of doubles.
- Allows use of hardware floating point on the Cortex-M4.
- Added "f" suffix to floating point literals.
- Call floating point versions of stdlib math functions.
2013-01-16 13:52:01 +11:00
Andrew Tridgell f9ab781d57 APM_Control: include AP_Common.h 2013-01-02 14:45:09 +11:00
Andrew Tridgell 5277dd4b0f APM_Control: fixed build on ARM 2013-01-02 14:45:09 +11:00
Andrew Tridgell 6901c56a2e yaw fixup 2013-01-02 14:45:08 +11:00
Andrew Tridgell d55acbc00a AP_YawController: fixup for ARM compiler 2013-01-02 14:45:08 +11:00
Andrew Tridgell 5a9ba4aeb4 APM_Control: updates for new AP_Param API 2012-12-20 14:51:38 +11:00
Pat Hickey 95a13bdbd2 APM_Control: ported to AP_HAL
Unable to test since there are no unit tests.
2012-12-20 14:51:26 +11:00
rmackay9 68bdf93a4d APM_Control: move reliance from IMU to INS 2012-11-07 19:20:54 +09:00
Jonathan Challinger 59875f8d53 APM_Control: added new APM controllers library
See
http://www.challinger.us/2012/07/16/tuning-arduplane-roll-and-pitch-controllers/
for details
2012-08-22 12:39:07 +10:00