Commit Graph

76 Commits

Author SHA1 Message Date
Pierre Kancir 25507d4d7b AP_L1_Control: use get_distance_NE instead of location_diff 2019-04-08 08:00:52 -07:00
Pierre Kancir 2efe32e4b1 AP_L1_Control: move get_bearing_cd to Location and rename to get_bearing_to 2019-04-06 09:10:28 +11:00
Peter Barker 4d62c996b7 AP_L1_Control: add missing override keywords 2019-02-22 15:01:09 +00:00
Peter Barker 9324fef92a AP_L1_Control: remove keywords.txt 2019-02-17 00:29:38 -08:00
Michael du Breuil 536a894850 AP_L1_Control: Sanatize loiter radius to prevent bad input from
propegating
2018-12-18 10:11:22 +11:00
Andrew Tridgell 7c57fb0c31 AP_L1_Control: lower default L1 period 2018-08-17 20:42:27 +10:00
Randy Mackay 4f0b26bd48 AP_L1_Control: update_waypoint gets dist_min argument
L1_dist can become extremely short for slow moving vehicles leading to unnecessarily jerk turns after passing waypoints.  This reduces the minimum length along the track that the vehicle will point.
2018-04-05 12:14:59 +09:00
Andrew Tridgell 31092da426 AP_L1_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 002d3f08f6 AP_L1_Control: update_waypoint zeros xtrack i term on init 2017-11-01 16:46:40 +09:00
Tom Pittenger 39dc608bea AP_L1: update constraint Nu comment to match sourcecode
fixes https://github.com/ArduPilot/ardupilot/issues/7054
2017-10-09 17:01:37 -07:00
Lucas De Marchi 67e02e3c55 AP_L1_Control: add static create method 2017-09-26 03:01:21 +01:00
Michael du Breuil 2894b7cbea L1_Control: Ensure that LIM_BANK passes a sea level sanity check
This fixes #6637 where the LIM_BANK can be set such that the vehicle demands a radius at sea level that is much higher then the loiter radius was configured to be. This effectively feels like a fly away and is due to bad parameters usually. If this happens just fall back to the simple EAS2TAS scaling of the radius.
2017-07-30 12:42:21 -07:00
Dr.-Ing. Amilcar Do Carmo Lucas 5a9baaa8b3 AP_L1_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
Michael du Breuil 93a18e7dc8 L1: Add loiter radius scaling based upon bank limits at sea level 2017-04-06 08:26:04 +10:00
Peter Barker 755e76ced9 AP_L1_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
Grant Morphett b56799f444 AP_L1_Control: Adding support for rover's operating in reverse
Mostly invovles sorting out the reverse yaw when travelling backwards.
2016-07-17 08:15:33 +10:00
Tom Pittenger be752164f4 Revert "AP_L1_Control: coverity scan - variables not initialized in constructor"
This reverts commit d558f32142.
2016-07-11 21:59:12 -07:00
Tom Pittenger 5f16d873b8 AP_L1_Control: coverity scan - ignoring get_position() result
- if no GPS location is available, do not continue computing navigation values. Hold old nav/target bearings and allow GPS failsafe to switch modes
2016-07-05 13:32:34 -07:00
Tom Pittenger d558f32142 AP_L1_Control: coverity scan - variables not initialized in constructor 2016-07-05 13:28:52 -07:00
Lucas De Marchi 6f87195eb7 AP_L1_Control: remove tabs and trailing whitespaces 2016-05-10 11:41:26 -03:00
dgrat 6d3b491c02 AP_Math: Replace is_equal with a type safe template function
It makes sense to consider also other floating point types.
2016-05-10 11:41:26 -03:00
Randy Mackay a50f5bfaf8 AP_L1_Control: replace fabsf with labs
resolves a compiler warning
2016-04-23 23:06:25 -07:00
Randy Mackay b2153fb97f AP_L1_Control: remove unused _xtrackVelPos 2016-04-23 23:06:24 -07:00
Tom Pittenger 25c3367341 AP_L1 - add a stale flag
threading bug fix. When a mission wp updates, but the L1 controller had not yet, the data is stale. Example, On Plane when NAV_LAND starts for a moment your xtrack and bearing is most likely bear zero regardless if you have a big turn or not until 10 Hz later when the update() gets called and updates those values with correct values for the new waypoint.
2016-04-21 21:30:57 -07:00
Tom Pittenger 2ce964c8ac AP_L1_Controller: add accessor for xtrack_error_integrator 2016-04-21 21:30:54 -07:00
Andrew Tridgell eb89b5bbb6 AP_L1_Control: prevent possibly fly-away when passed waypoint in L1
if the top level controller doesn't consider a waypoint complete when
we are passed next_WP then it would keep flying away from the line
segment. This doesn't happen with the current master code, but we want
to ensure it is handled
2016-03-18 13:47:44 +11:00
Lucas De Marchi 7ad0036a11 AP_L1_Control: replace header guard with pragma once 2016-03-16 18:40:41 +11:00
dgrat 5148e41c1a AP_Math: Cleaned macro definitions
Moved Definitions into a separate header. Replaced PI with M_PI and
removed the M_PI_*_F macros.
2016-02-27 02:51:33 -03:00
Andrew Tridgell 640332113c AP_L1_Control: calculate dt for crosstracking 2016-01-19 11:05:56 +11:00
Don Gagne e891ae8a89 AP_L1_Control: fix invalid Range meta data 2015-12-27 16:10:44 +11: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
Lucas De Marchi 266bb3b759 AP_L1_Control: remove checks for HAL_BOARD_APM2 and HAL_BOARD_APM1 2015-11-04 12:14:12 +11: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
Jonathan Challinger f0f5239d8f AP_L1_Control: use set_default for runtime param defaults 2015-10-26 11:15:54 +11:00
Tom Pittenger 695efb8df3 AP_L1_Control: added integrator to help xtrack error converge to zero
new param: NAVL1_XTRACK_I
    // @Description: Crosstrack error integrator gain. This gain is applied to the crosstrack error to ensure it converges to zero. Set to zero to disable. Smaller values converge slower, higher values will cause crosstrack error oscillation.
fixes https://github.com/diydrones/ardupilot/issues/2650

when param is changed the integrator is set to zero. This makes for easier tuning by seeing it converge to zero on each change.
2015-10-21 12:49:43 +11:00
Gustavo Jose de Sousa 4278bfcec5 AP_L1_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:44 +10:00
Tom Pittenger 9ecbd0e30f AP_L1_Control: fixed uTurn-wobble
When performing a u-turn in AUTO (waypoints are 180deg turn from each other) sometimes the aircraft can't decide to turn left or right and wobbled back and forth a couple times. There was existing code to solve this but it was not executing all the time like when in LOITER mode. Frankly, I don't understand the criteria that was required to make it execute and i suspect there is still a gremlin in that logic but just executing the check all the time makes prevents the wobble behavior.
2015-04-08 15:21:02 -07:00
Andrew Tridgell b21c00fcf9 AP_L1_Control: changed default L1 tuning to 20
this is more appropriate for most aircraft
2015-02-19 16:19:33 +11:00
Andrew Tridgell 1fc8116069 AP_L1_Control: update NAV_L1_PERIOD docs 2014-11-13 14:26:42 +11:00
Andrew Tridgell 59610ebe88 AP_L1_Control: fixed some warnings 2014-10-22 18:27:16 +11:00
Andrew Tridgell df3c565cd8 AP_L1_Control: prevent another NaN in L1 2014-08-14 14:10:03 +10:00
priseborough bc3c85be20 AP_L1_Control : Fix potential divide by zero error 2014-08-07 19:04:42 +10:00
Andrew Tridgell 5a1aa8dfe7 AP_L1_Control: implement turn_distance() with turn angle
uses a linear approximation for now.
2014-06-05 09:34:23 +10:00
Andrew Tridgell aba11a0634 AP_L1_Control: wrap the target_bearing 2014-05-23 07:30:58 +10:00
Andrew Tridgell b9128a932f AP_L1_Control: no need to project position for lag
now handled by AHRS
2014-02-15 05:29:47 +11:00
Andrew Tridgell cfad814bfb AP_L1_Control: fixed switchover from loiter capture to circling
Pair-Programmed-With: Paul Riseborough <p_riseborough@live.com.au>
2013-11-09 15:52:11 +11:00
Paul Riseborough 49fe7fea07 L1_Control : Added hysteresis for rear WP capture 2013-11-09 15:40:14 +11:00
Andrew Tridgell 1393ed58d0 AP_L1_Control: fixed waypoint approach logic
this could cause the RTL approach to not break off onto the circle
correctly
2013-11-09 12:54:26 +11:00
Andrew Tridgell ea9a2eda3f AP_L1_Control: reduced demanded bank angle by cos(pitch)
this prevents attempts to do too tight turns while at a steep pitch

Pair-Programmed-With: Paul Riseborough <p_riseborough@live.com.au>
2013-11-04 21:21:42 +11:00