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
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
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
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.
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
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
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.
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.
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'
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.
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.
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.
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.
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.