Commit Graph

358 Commits

Author SHA1 Message Date
Andrew Tridgell 97f88f67f6 APM_Control: allow for AUTOTUNE_LEVEL=0
this means keep the existing TCONST and RMAX parameters, if non-zero
2021-04-15 06:57:16 +10:00
Andrew Tridgell 316541017a APM_Control: fixed handling of clipped actuator in autotune 2021-04-15 06:57:16 +10:00
Andrew Tridgell 9997b191a8 APM_Control: log smoothed rates 2021-04-15 06:57:16 +10:00
Andrew Tridgell 20ef242280 APM_Control: fixed restore of tconst on autotune abort 2021-04-15 06:57:16 +10:00
Andrew Tridgell 53ee13a083 APM_Control: use instance logging and allow AUTOTUNE_LEVEL adjustments 2021-04-15 06:57:16 +10:00
Andrew Tridgell 70c194c358 APM_Control: fixed LoggerDocumentation test 2021-04-15 06:57:16 +10:00
Andrew Tridgell 0b76a8018f APM_Control: move rmax and tau more slowly 2021-04-15 06:57:16 +10:00
Andrew Tridgell 3cb32a18f0 APM_Control: fixed for cygwin build 2021-04-15 06:57:16 +10:00
Andrew Tridgell 364fa0680d APM_Control: use shorter tau for autotune higher levels 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
Randy Mackay f0ffaa5624 AR_AttitudeControl: reset speed filter and I term when stopped 2021-03-04 09:07:32 +09:00
Andrew Tridgell 9a244eef29 APM_Control: added SMAX param docs 2020-10-25 10:32:48 +11:00
Andrew Tridgell d2a4505184 APM_Control: fixed bug in slew filter 2020-10-25 10:32:48 +11:00
Peter Barker d20c6ceb3b APM_Control: replace '@User: User' with '@User: Standard' 2020-09-22 14:56:04 +10:00
Randy Mackay 2db57dffac AR_AttitudeControl: update param desc increment and range 2020-09-16 16:49:40 +09:00
Paul Riseborough 548bab5d24 APM_Control: Add gyro feedback limit cycle protection 2020-07-13 13:47:50 +10:00
Mark Whitehorn 442fa60651 APM_Control: validate parameter ARSPD_FBW_MIN 2020-04-02 19:43:06 -07:00
Peter Barker c9f2b9ff87 AR_AttitudeControl: correct spelling error in param docs 2020-03-16 17:44:35 +11:00
Peter Hall 84fe5f4e78 APM_Control: move to airspeed_estimate with pointer 2020-01-14 22:34:37 -07:00
Peter Hall c71cbe2729 APM_Control: AR_AttitudeControl: add description for new PID params 2019-09-23 09:45:46 +09:00
Peter Barker 7fbaea7971 APM_Control: wrap_180_cd no longer solely returns floats 2019-09-18 12:57:02 +10:00
Randy Mackay 1b533295a8 AR_AttitudeControl: minor comment fixes 2019-08-06 20:00:05 +09:00
Peter Hall 65d8047165 AR_AttitudeControl: fix sailboat heel PID 2019-08-06 20:00:05 +09:00
Leonard Hall 6f14673f08 APM_Control: support for upgrade to PID object 2019-07-25 17:38:15 +09:00
Leonard Hall 157f786adf Global: rename desired to target in PID info 2019-07-25 17:38:15 +09:00
Peter Barker cb692c6946 APM_Control: move logger include to .cpp 2019-07-09 10:57:20 +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
Michael du Breuil 197804412a APM_Control: Fix AP_GPS include 2019-06-18 10:02:05 +10:00
Randy Mackay a96c146758 AR_AttitudeControl: set-throttle-out-stop considered same as running speed controller
update the speed-last-ms time when set-throttle-out-stop runs or else the desired throttle will not be acceleration limited when the desired speed is next increased above zero
2019-06-08 09:35:36 +09:00
Randy Mackay 4e68d16526 AR_AttitudeControl: use speed_control_active in get_desired_speed_accel_limited
also minor formatting fixes
this is a non-functional change
2019-05-10 06:55:35 +09:00
Randy Mackay 6d4d1bc20a AR_AttitudeControl: add get_turn_rate_from_heading 2019-05-10 06:55:35 +09:00
Randy Mackay 8907b727f6 AR_AttitudeControl: add get_turn_rate_from_lat_accel 2019-05-10 06:55:35 +09:00
Peter Hall 505e1d8c1d APM_Control: AP_RollContorller: move rate limit 2019-05-06 19:16:26 +10:00
Randy Mackay 415042e557 AR_AttitudeControl: minor declaration ordering change 2019-05-04 14:49:32 +09:00
Randy Mackay f6f5967a82 AR_AttitudeControl: minor param desc fix 2019-05-04 14:49:26 +09:00
Tom Pittenger 0a95785ff0 APM_Control: rename dataflash to logger 2019-03-28 16:40:57 +11:00
IamPete1 49ec059420 APM_Control: add function to relax rover i terms 2019-02-27 08:51:24 +09:00
Tom Pittenger 752804c2a5 APM_Control: unify singleton naming to _singleton and get_singleton() 2019-02-10 19:09:58 -07:00
Andrew Tridgell d7f90963ea APM_Control: fill in Act field of PID logs for plane 2019-01-28 09:38:32 +09:00
Nathan E 548a573803 Update AP_YawController.cpp 2019-01-23 09:24:18 -07:00
Nathan E f9aac6919c Update AP_RollController.cpp 2019-01-23 09:24:18 -07:00
Nathan E fbb2252fd9 Update AP_PitchController.cpp 2019-01-23 09:24:18 -07:00
Peter Barker 6fc76a32af GLOBAL: use AP::logger() and strip redundant Log_ from methods 2019-01-18 18:08:20 +11: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
Peter Barker b276034c60 APM_Control: correct use of incorrect abs functions 2018-10-19 08:46:43 +11:00
IamPete1 e443b864c6 AR_AttitudeControl: add sail heel PID 2018-09-28 10:40:12 +09:00
Andrew Tridgell 3ab7fe348a APM_Control: halve the default pitch D term for planes
this is based on feedback from the 3.9.1 release
2018-09-14 07:32:13 +10:00
Randy Mackay d7d6c6ab04 AR_AttitudeControl: clarify units of get_steering_out_heading argument
also update comments
2018-09-11 14:39:50 +09:00
Randy Mackay 96097586c3 AR_AttitudeControl: reset I if speed controller not called recently 2018-09-04 15:00:41 +09:00
Randy Mackay 106b8abab7 AR_AttitudeControl: get_throttle_out_from_pitch accepts vehicle speed 2018-08-27 16:44:33 +09:00
Randy Mackay d5ef3c2e0f AR_AttitudeControl: get_throttle_out_from_pitch uses motor limits
This allows removing I-term build up from throttle hitting 100%
2018-08-27 16:44:33 +09:00
Randy Mackay 65b020eac3 AR_AttitudeControl: re-order pitch control to match other similar methods 2018-08-27 16:44:33 +09:00
Andrew Tridgell 9e2933df89 APM_Control: raised default PID gains for roll/pitch 2018-08-17 20:42:25 +10:00
Randy Mackay 1c18d06aa3 AR_AttitudeControl: move unnecessary else 2018-08-06 11:30:22 +09:00
Randy Mackay 9b60e0844b AR_AttitudeControl: add get_desired_pitch accessor 2018-08-06 11:30:22 +09:00
Ebin ccb32cf357 APM_Control: BRAKE param default is true 2018-07-20 14:41:32 +10:00
Ebin 1dc1b28234 APM_Control: changed default PID for Balance Bot 2018-07-20 14:41:32 +10:00
Randy Mackay 9eebb6225a AR_AttitudeControl: brake fix to set limit in only one direction 2018-07-19 09:04:50 +08:00
Ebin 30b3d63e8a APM_Control: New default PID values for balance bots 2018-07-06 19:41:09 +10:00
Ebin ce182fd307 APM_Control: fixed test condition in AR_AttutudeControl.cpp 2018-07-06 19:41:09 +10:00
Ebin 97a260a980 APM_Control: get_throttle_out_from_pitch() accepts dt as argument 2018-06-28 21:55:20 +09:00
Ebin 657ff06380 APM_Control: added balancing function for BalanceBot 2018-06-28 21:55:20 +09:00
Randy Mackay 5e7b37f0b2 AR_AttitudeControl: remove constraint on steering output 2018-06-12 17:44:10 +09:00
Ammarf b614ca9b75 AR_AttitudeControl: disable limits when _ACCEL_MAX is zero 2018-06-11 08:54:59 +09:00
Randy Mackay 67475a9eaa AR_AttitudeControl: reset turn-rate I term if not run for 0.2sec 2018-06-01 15:06:13 +09:00
disgruntled-patzer 2c41db9e4d AP_RollController.cpp: Updated description of ArduPlane Roll Controller for accuracy
AP_RollController's get_servo_out function does not return an elevator deflection as was previously described in the function comments.
Instead, it should return an aileron deflection. Thus, the function description should be updated to reflect this more accurately
2018-05-30 09:46:08 +09:00
Randy Mackay e691b680ca AR_AttitudeControl: add speed-control-active method
allows caller check if speed controller if active
also consolidated other methods to use this check to reduce a little bit of duplicate code
2018-05-29 16:37:31 +09:00
Randy Mackay 3b71d0360a AR_AttitudeControl: const get_decel_max and get_stopping_distance 2018-05-29 16:37:31 +09:00
Michael du Breuil 84b1a6a58b APM_Control: Supress some compilier warnings about strncpy 2018-05-29 00:10:40 +01:00
Randy Mackay a7fbfe7767 AR_AttitudeControl: caller provides dt instead of calculated internally
This allows the vehicle's main loop rate to be used instead of an internally calculated dt which suffers from jitter
2018-05-24 11:06:20 +09:00
Randy Mackay c032095c80 AR_AttitudeControl: reduce default accel max to 2m/s/s 2018-05-24 11:06:20 +09:00
Randy Mackay 856d592b1d AR_AttitudeControl: accel limit stops 2018-05-24 11:06:20 +09:00
Ammarf 832778e471 AR_AttitudeControl: add separate decel limit 2018-05-23 17:17:29 +09:00
Randy Mackay f6c06496e2 AR_AttitudeControl: fix accel limiting 2018-05-21 10:28:56 +09:00
Ammarf a9ee949c32 AR_AttitudeControl: limit desired steering rate 2018-05-21 09:48:43 +09:00
Randy Mackay 56672c1c28 AR_AttitudeControl: fix get_steering_out_rate use of max turn rate and acceleration 2018-05-10 20:37:28 +09:00
Randy Mackay 9feaf9cfdd AR_AttitudeControl: const some internal variables
non-functional change
2018-05-10 20:37:28 +09:00
Randy Mackay fa76a7c904 AR_AttitudeControl: get-steering-out-lat-accel uses negative speeds 2018-05-10 08:02:13 +09:00
Randy Mackay 5563691bd1 AR_AttitudeControl: assume positive steering output rotates vehicle clockwise
also remove steering scaling by speed which has been moved to AR_MotorsUGV
2018-05-10 08:02:13 +09:00
Randy Mackay ce44326ba8 AR_AttitudeControl: fix get_steering_out_heading while reversing 2018-05-06 16:58:00 +09:00
Randy Mackay 0f9b679e98 AR_AttitudeControl: increase angle err P and reduce steering accel max defaults 2018-04-26 14:16:22 +09:00
Randy Mackay 3f1f68b130 AR_AttitudeControl: support vectored thrust
steering output is not scaled for speed
steering integrator does not build up at low speed
2018-04-24 19:57:19 +09:00
Randy Mackay 9c2da896b9 AR_AttitudeControl: get_throttle_out_stop only stops once desired speed reaches zero
this reduces the final jerk to a when transitioning from forward to reverse and in cases where ATC_ACCEL_MAX is small
2018-04-24 12:24:53 +09:00
Randy Mackay 365e1030db AR_AttitudeControl: separate speed limiting to new method
This allows the desired speed limiting (by acceleration) to be done before the speed-to-throttle PID controller is run.
This is required so the avoidance calls (which work on the desired speed) can be run after limiting but before the PID controllers
2018-04-24 12:24:53 +09:00
Randy Mackay 23ed735304 AR_AttitudeControl: reduce default steering I gain to 0.2
Also reduce default filter from 50hz to 10hz
2018-04-19 16:29:12 +09:00
Daniel Widmann 27234f78c6 AR_AttitudeControl: Allow using steer rate control for skid steer rovers without GPS 2018-04-13 09:12:03 +09:00
Randy Mackay a8857726d1 AR_AttitudeControl: replace get_steering_out_angle_error with heading
internally uses AHRS's heading to determine angle error so overally a non-functional change
2018-04-05 12:14:59 +09:00
Randy Mackay e6f8021519 AR_AttitudeControl: add angular accel and rate limits
This limits the change in desired turn rate to reduce impossible requests which should help avoid overshoot
Also add rotation rate limit to turn-rate controller
2018-04-05 12:14:59 +09:00
Randy Mackay 57f2eb6853 AR_AttitudeControl: minor comment fix 2018-03-31 14:47:30 +09:00
Peter Barker e2de9d62cd APM_Control: use ins singleton 2018-03-16 00:37:35 -07:00
Randy Mackay 89725a7aa5 AR_AttitudeControl: minor comment fix
non-functional change
2018-03-15 09:58:27 +09:00
Randy Mackay d139f0e28e AR_AttitudeControl: add get_stopping_distance 2018-03-14 12:40:04 +09:00
Randy Mackay 54d8a4852f AR_AttitudeControl: reduce steer rate P default to 0.2 2018-03-09 13:17:38 +09:00
Randy Mackay 2aeda48512 AR_AttitudeControl: minor arg name fix
non-functional change
2018-02-09 17:36:21 +09:00
Randy Mackay 5e90cdbf59 AR_AttitudeControl: parameter desc range increase
new steering controller can use higher FF and zero P
2018-01-12 08:15:34 +09:00
Randy Mackay 1bb18bc941 AR_AttitudeControl: get_throttle_out_speed uses timeout definition 2018-01-05 13:33:21 +09:00
Randy Mackay 4ac5ef3a13 AR_AttitudeControl: allow filter to be zero
Also increase default filter to 50hz
2018-01-05 13:33:21 +09:00
Randy Mackay 16d3e5c00d AR_AttitudeControl: add feed foward for speed and steering rate control 2018-01-05 13:33:21 +09:00
Randy Mackay 40bb2b0ad9 AR_AttitudeControl: set throttle speed pid dt 2018-01-05 13:33:21 +09:00
Randy Mackay 9930550cfc AR_AttitudeControl: lengthen timeout to 200ms
This is required because occasionally the turn rate controller can be disabled for just over 100ms as new navigation commands are loaded
2018-01-05 13:33:21 +09:00
Randy Mackay a2b1807ca0 AR_AttitudeControl: fix turn-rate controller timeout 2018-01-05 13:33:21 +09:00
Peter Barker e0c586876b APM_Control: use GPS singleton 2017-12-27 00:58:02 +00: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
Randy Mackay cabced82f1 AR_AttitudeControl: fix parameter descriptions 2017-12-11 17:01:18 +09:00
Michael Oborne 78f732c380 AR_AttitudeControl: fix parameter docs 2017-12-11 08:35:33 +09:00
Randy Mackay 744f4baf22 AR_AttitudeControl: add parameter description increment 2017-12-09 16:23:25 +09:00
Randy Mackay f00f4ce79b AR_AttitudeControl: fix get_desired_speed timeout 2017-12-09 16:23:22 +09:00
Randy Mackay 36c5f057ae AR_AttitudeControl: add get_desired_turn_rate lat_accel and speed
for reporting use only
2017-12-09 12:18:49 +09:00
Grant Morphett f7db538220 APM_Control: Fixed the subparam indexs to start at 1
AFAIK there is still a bug in ArduPilot where subparams should not start at index 0.  This is due to the way the index math and bit shifing works as it incorrectly offsets all 0 index params to 0. We allow 2 levels of sub params - 3 levels in total.  So params, sub params and sub sub params.  The 0 parameter in all those is unfortunately always references param[0].  So param[0] and subparam[0] and subsubparam[0] will reference the same parameter value.  Its why we always say start the index from 1 as the math and bitshifting then works correctly.

Yeah this is worded badly - hard to explain.
2017-11-29 09:43:10 +09:00
Randy Mackay b9a1621d38 AR_AttitudeControl: minor comment fix
non-functional change
2017-11-27 10:35:26 +09:00
khancyr 2a25011b14 AR_AttitudeControl: const local variables 2017-11-09 09:53:12 +09:00
khancyr 76a6649a2d AP_Autotune: remove unimplemented function 2017-11-08 17:21:56 +09:00
khancyr e9e1dac188 AR_AttitudeControl: remove unused skid_steering arg from get_throttle_out 2017-11-08 15:45:35 +09:00
khancyr aa09541847 AR_AttitudeControl: const ahrs reference 2017-11-08 15:34:41 +09:00
khancyr d226ffeeb2 AP_AttitudeControl: remove tabs
non-functional change
2017-11-08 15:06:25 +09:00
Daniel Widmann 49887235df AR_AttitudeControl: get_steering_out methods accept reverse argument 2017-11-08 14:36:23 +09:00
Randy Mackay ce73d724c8 AR_AttitudeControl: rate-control for skid-steering uses I term even at low speeds 2017-10-26 19:45:04 +09:00
Randy Mackay ee3daaa7c9 AR_AttitudeControl: reset input filter for steering and throttle controllers
Also only set dt to non-zero value
2017-10-26 19:44:54 +09:00
Randy Mackay 2986d3eb7d AR_AttitudeControl: fix braking
this fix ensures the output throttle is never in the opposite direction from the desired-speed
there is a possibility that this could lead to rougher throttle response when the vehicle is transitioning from forward to backwards motion because the throttle response will immediately go to zero when the desired speed cross over zero
2017-10-26 19:44:38 +09:00
Randy Mackay 49cbbf4d76 AR_AttitudeControl: minor comment fix 2017-10-26 19:44:32 +09:00
Randy Mackay 8daa8cba1f AR_AttitudeControl: record desired turn rate and speed for logging 2017-10-26 19:44:26 +09:00
Randy Mackay 7e5f98b535 APM_Control: fix throttle and steering integrator calc 2017-10-07 14:55:16 +09:00
Lucas De Marchi 15527d762f APM_Control: add static create method 2017-09-26 03:01:21 +01:00
Michael du Breuil c34104b369 APM_Control: Simpify yaw controller trig 2017-09-25 16:49:54 -07:00
Randy Mackay 9f876dc7a0 AR_AttitudeControl: throttle and steering control library
Throttle controller has these advantages over existing controller:
based on velocity in vehicle's forward-back axis rather than ground-speed
straight-forward PID controller using speed error as input
speed control acceleration limts
stop control slows vehicle smoothly
configurable filtering

Steer controller has these advantages over existing controller:
output scaled properly for skid-steering vehicles
layered P and PID controller for angular error and rate control
configurable filtering
2017-08-15 20:47:19 +09:00
Randy Mackay 164096225b AP_SteerController: fix get_steering_out_rate bug when reversing 2017-08-05 11:20:58 +09:00
Dr.-Ing. Amilcar Do Carmo Lucas 0f5d1ae2dd APM_Control: Use SI units conventions in parameter units
Follow the rules from:
http://physics.nist.gov/cuu/Units/units.html
http://physics.nist.gov/cuu/Units/outside.html
and
http://physics.nist.gov/cuu/Units/checklist.html
one further constrain is that only printable (7bit) ASCII characters are allowed
2017-05-17 18:07:25 +10:00
Andrew Tridgell f6cc506791 APM_Control: Added derating of steering wheel 2016-12-27 13:33:52 +11:00
Peter Barker 71e42a4eac APM_Control: add missing parameter metadata 2016-10-27 09:15:03 -07: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
Grant Morphett 8d6b417adb AP_SteerController: Adding support for Rovers driving reverse
This change is mostly for handling the reverse yaw.
2016-07-17 08:15:33 +10:00
Andrew Tridgell 8a03b3ba22 APM_Control: reduce elevator when past LIM_ROLL_CD
this reduces elevator control when rolled over hard in fixed
wing. Using the elevator when on the side just caused earth frame yaw
and is counter productive. It can also prevent some aircraft from
recovering from inverted flight.
2016-06-24 11:28:18 +10:00
Grant Morphett d56e2b6a39 APM_Control: Get steer rate using earth frame.
Rather then just using the standard z gyro by using the earth frame it
takes into account when a rover leans over in hard corners.  My rover
leans 15 degrees no problem which is why this is needed.
2016-06-01 10:05:20 +09:00
Ricardo de Almeida Gonzaga 8d6cc587c5 APM_Control: Fix typos 2016-05-13 19:20:05 -03:00
Andrew Tridgell a9f1b608ed APM_Control: expose parameters as AP_Float 2016-05-07 18:34:06 +10:00
Randy Mackay 722095e56d APM_Control: remove unused _last_error member
Resolves a compiler warning
2016-04-23 23:06:20 -07:00
Andrew Tridgell 8586b0ae5a APM_Control: added tuning accessors 2016-04-16 20:37:33 +10:00
Ricardo de Almeida Gonzaga 5bd034a5a8 Global: start using cmath instead of math.h 2016-04-05 21:06:19 -07:00
Andrew Tridgell ab07781c66 APM_Control: raise default P and I gains, and set a lower limit on I for pitch
Too many users have very low I gains, which causes a lot of problems for TECS
2016-03-25 09:54:53 +11:00
Lucas De Marchi 382b6f87fe APM_Control: replace header guard with pragma once 2016-03-16 18:40:41 +11:00
Will Sackfield 8c98eb2b84 APMControl: Cast type to uint8
* Clang requires that the type be explicitly cast
to uint8
2016-02-29 14:14:37 +11:00
Lucas De Marchi cfb5bbeb9f APM_Control: stop using Progmem.h 2015-12-27 15:58:12 -02:00