Commit Graph

22 Commits

Author SHA1 Message Date
Randy Mackay 722095e56d APM_Control: remove unused _last_error member
Resolves a compiler warning
2016-04-23 23:06:20 -07:00
Ricardo de Almeida Gonzaga 5bd034a5a8 Global: start using cmath instead of math.h 2016-04-05 21:06:19 -07:00
Lucas De Marchi 382b6f87fe APM_Control: replace header guard with pragma once 2016-03-16 18:40:41 +11:00
Gustavo Jose de Sousa db9f037e4b APM_Control: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-11 16:28:41 +10:00
Michael du Breuil 6cd81ae1fb APM_Control: Add PID logging to yaw controller 2015-06-22 15:41:44 +10:00
Andrew Tridgell fbe4be94cf APM_Control: changed to AP_Vehicle.h 2013-09-13 11:46:22 +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 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 2ee43a694c APM_Control: fixed YAW2SRV_IMAX handling
thanks to Steven G for noticing this!
2013-07-16 09:44:23 +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
Andrew Tridgell 6c5718a63b APM_Control: fixed indent-tabs-mode 2013-05-30 09:53:02 +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 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
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