Commit Graph

196 Commits

Author SHA1 Message Date
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
Lucas De Marchi 2591261af6 Global: rename min and max macros to uppercase
The problem with using min() and max() is that they conflict with some
C++ headers. Name the macros in uppercase instead. We may go case by
case later converting them to be typesafe.

Changes generated with:

	git ls-files '*.cpp' '*.h' -z | xargs -0 sed -i 's/\([^_[:alnum:]]\)max(/\1MAX(/g'
	git ls-files '*.cpp' '*.h' -z | xargs -0 sed -i 's/\([^_[:alnum:]]\)min(/\1MIN(/g'
2015-12-01 16:28:09 -02:00
Caio Marcelo de Oliveira Filho fe718a6ce8 APM_Control: use millis/micros/panic functions 2015-11-20 12:28:20 +09:00
Lucas De Marchi 5244559010 Minimize AP_Progmem.h includes
Most of AP_Progmem is already gone so we can stop including it in most
of the places. The only places that need it are the ones using
pgm_read_*() APIs.

In some cases the header needed to be added in the .cpp since it was
removed from the .h to reduce scope. In those cases the headers were
also reordered.
2015-10-30 14:35:32 +09:00
Lucas De Marchi 1b07dabeb7 Replace prog_char and prog_char_t with char
prog_char and prog_char_t are now the same as char on supported
platforms. So, just change all places that use them and prefer char
instead.

AVR-specific places were not changed.
2015-10-30 14:35:30 +09:00
Lucas De Marchi 831d8acca5 Remove use of PROGMEM
Now variables don't have to be declared with PROGMEM anymore, so remove
them. This was automated with:

    git grep -l -z PROGMEM | xargs -0 sed -i 's/ PROGMEM / /g'
    git grep -l -z PROGMEM | xargs -0 sed -i 's/PROGMEM//g'

The 2 commands were done so we don't leave behind spurious spaces.

AVR-specific places were not changed.
2015-10-30 14:35:16 +09:00
Lucas De Marchi 1336d621be Replace use of strcpy_P() with strcpy() 2015-10-30 14:35:12 +09:00
Lucas De Marchi 2c38e31c93 Remove use of PSTR
The PSTR is already define as a NOP for all supported platforms. It's
only needed for AVR so here we remove all the uses throughout the
codebase.

This was automated with a simple python script so it also converts
places which spans to multiple lines, removing the matching parentheses.

AVR-specific places were not changed.
2015-10-30 14:35:04 +09:00
Grant Morphett 417188d7eb APM_Control: Fixed spelling error in parameter desc. 2015-09-16 09:33:27 +09: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
Lucas De Marchi 4a595bd797 APM_Control: use ARRAY_SIZE 2015-07-21 14:24:52 +09:00
Michael du Breuil e45f3537cf APM_Control: Remove duplicate include statements 2015-06-25 10:23:47 +10:00
Michael du Breuil aa04c81e3c APM_Control: Fix a typo in the docstring for YAW2SRV_SLIP 2015-06-25 10:22:36 +10:00
Michael du Breuil 6cd81ae1fb APM_Control: Add PID logging to yaw controller 2015-06-22 15:41:44 +10:00
Andrew Tridgell 131b345ccc APM_Control: cleanup some coverity warnings 2015-06-20 13:30:32 +10:00
Andrew Tridgell 5e80f0cf72 APM_Control: allow for multiple stop calls in autotune 2015-06-15 09:20:54 +10:00
Andrew Tridgell 02aa6983a7 APM_Control: fixed FF handling in steering controller 2015-06-09 13:28:26 +10:00
Andrew Tridgell 5105d510b8 APM_Control: added pid_info and FF to steering controller
used for realtime ground steering tuning
2015-06-09 12:48:55 +10:00
Andrew Tridgell 86a3bca88c APM_Control: added FF parameters to roll and pitch controllers
these are much easier to tune with the new PID_TUNING messages
2015-05-27 14:28:47 +10:00
Andrew Tridgell 216a78a9f0 APM_Control: added get_pid_info() interface 2015-05-27 14:28:44 +10:00
Peter Barker 9ae85ed9ab APM_Control/AP_AutoTune: use 64-bit timestamps for dataflash logs 2015-05-27 11:54:17 +10:00
Andrew Tridgell d8cd986696 APM_Control: fix for HAL_SITL rename 2015-05-05 09:45:54 +10:00
Tom Pittenger 7132b39dcf AP_AutoTune: fix compile warnings re float constants 2015-04-24 12:24:19 +09:00
Andrew Tridgell ec70042d25 APM_Control: raise default IMAX to 3000
on the first flight users often need more I gain to overcome poor
choices for the P gain
2015-02-19 16:15:33 +11:00
Andrew Tridgell 3b6c732b3b APM_Control: changed default I gain for roll/pitch controllers to non-zero
too many people are still not tuning. At least this will give them a
chance to get their aircraft back in a cross-wind
2014-11-13 22:13:25 +11:00
Andrew Tridgell 8f3dad0d1c APM_Control: increase available range for roll and pitch 2014-08-16 18:07:22 +10:00
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