Commit Graph

53 Commits

Author SHA1 Message Date
Leonard Hall 2f2143ca6f AP_Control: Support changing update period 2022-12-13 17:10:06 +11:00
Peter Barker 7f202b8a0e APM_Control: change namespace of MultiCopter and FixedWing params
this stops the libraries knowing anything about AP_Vehicle
2022-11-09 19:04:37 +11:00
Andrew Tridgell 01d006ebd1 APM_Control: added access to time constant 2022-10-18 07:38:39 +11:00
jackhong12 4a4f361a17 all: use CLASS_NO_COPY() macro 2022-10-04 11:23:04 +11:00
Peter Barker dd589934cc APM_Control: 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 5a996f308b APM_Control: fixed code style of plane rate controllers 2021-11-30 16:19:26 +11:00
Andrew Tridgell 8a73bdcbe6 APM_Control: suppress roll/pitch D term in ground_mode
prevent oscillations which are quite common
2021-10-30 18:45:53 +11:00
Iampete1 da4fd7a914 AP_PitchController: return floats 2021-10-20 18:29:58 +11:00
Peter Barker 066ad0f8da APM_Control: remove unused variables 2021-08-23 08:39:41 +09:00
Peter Barker d2102ce9b7 APM_Control: stop taking references to ahrs in APM_Control 2021-07-21 18:27:23 +10:00
Andrew Tridgell 1633afb6cd APM_Control: adjust fixed wing filter defaults
adjust defaults based on discussions with Paul, and initialise the
FLTT value based on the controller time constant
2021-07-05 20:07:47 +10:00
Andrew Tridgell bb1dc7192b APM_Control: lower default target filter frequencies
this will remove a lot of the level flight noise causing oscillation
at higher gains
2021-04-15 06:57:16 +10:00
Andrew Tridgell dd98f00947 APM_Control: prevent cross-axis tuning
this should fix tuning at higher AUTOTUNE_LEVEL values
2021-04-15 06:57:16 +10:00
Andrew Tridgell 7e64875a02 APM_Control: tweak tuning settings 2021-04-15 06:57:16 +10:00
Andrew Tridgell f88622def8 APM_Control: implement new autotune system
use actuator/rate ratio with median filter for FF and Dmod/overshoot
for P,I,D
2021-04-15 06:57:16 +10:00
Andrew Tridgell 12fad55891 APM_Control: fixed pid_info for pitch controller 2021-04-15 06:57:16 +10:00
Andrew Tridgell ead011c7c2 APM_Control: move to only ACPID 2021-04-15 06:57:16 +10:00
Andrew Tridgell 6ca9033dde APM_Control: run AC_PID in parallel with old PID for roll/pitch 2021-04-15 06:57:16 +10:00
Paul Riseborough 548bab5d24 APM_Control: Add gyro feedback limit cycle protection 2020-07-13 13:47:50 +10:00
Andrew Tridgell 05bd0cb9f4 APM_Control: added decay_I() function
used by VTOL planes to decay integrator on fixed wing components when
at very low airspeed
2019-07-07 18:16:47 +10:00
Peter Barker b47733142f GLOBAL: rename DataFlash_Class to AP_Logger 2019-01-18 18:08:20 +11:00
Peter Barker d1f5bcb1ab APM_Control: stop taking reference to dataflash, use singleton 2019-01-18 14:14:22 +11:00
Andrew Tridgell 1dac512567 APM_Control: removed create() method for objects
See discussion here:

  https://github.com/ArduPilot/ardupilot/issues/7331

we were getting some uninitialised variables. While it only showed up in
AP_SbusOut, it means we can't be sure it won't happen on other objects,
so safest to remove the approach

Thanks to assistance from Lucas, Peter and Francisco
2017-12-14 08:12:28 +11:00
Lucas De Marchi 15527d762f APM_Control: add static create method 2017-09-26 03:01:21 +01:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Tom Pittenger 82777873af Revert "APM_Control: Convert references to AP_Airspeed."
This reverts commit cc5a2417a6.
2016-08-07 17:54:24 -07:00
Tom Pittenger 8dad05d12e Revert "Airspeed: store reference in libraries and populate it"
This reverts commit c090ba2257.
2016-08-07 17:54:24 -07:00
Tom Pittenger c090ba2257 Airspeed: store reference in libraries and populate it
- also had to move the initial definition in plane.h so it happened before the others.
2016-08-04 11:06:44 -07:00
AndersonRayner cc5a2417a6 APM_Control: Convert references to AP_Airspeed. 2016-08-04 10:09:04 -07:00
Andrew Tridgell a9f1b608ed APM_Control: expose parameters as AP_Float 2016-05-07 18:34:06 +10:00
Andrew Tridgell 8586b0ae5a APM_Control: added tuning accessors 2016-04-16 20:37:33 +10: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
Andrew Tridgell 216a78a9f0 APM_Control: added get_pid_info() interface 2015-05-27 14:28:44 +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 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
Andrew Tridgell d27f5e89d7 APM_Control: remove public AP_PitchController::get_coordination_rate_of|cat() 2013-10-05 07:42:48 +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 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 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 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
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