Commit Graph

79 Commits

Author SHA1 Message Date
Mark Agate 1769453520 AP_L1_Control: check vehicle yaw (heading) and ground track agree 2023-09-05 10:07:14 +10:00
abaghiyan ae1eb93aec AP_L1_Control: Made changes to avoid zero division in proposed formula
According suggestion from Andrew Tridgell: https://github.com/ArduPilot/ardupilot/pull/24331#discussion_r1267798397
2023-08-01 10:01:47 +10:00
abaghiyan c2f4661b90 AP_L1_Control: Fixed formula in AP_L1_Control::nav_roll_cd
See details here: https://github.com/ArduPilot/ardupilot/issues/24319
2023-08-01 10:01:47 +10:00
Peter Barker 787dc5ccf1 AP_L1_Control: avoid using struct Location
clang reports this could be a problem when compiling under some EABIs.  Remove it from most places as it is just noise, replace with class where we want to avoid including Location.h
2023-02-04 22:51:54 +11:00
Tatsuya Yamaguchi 78699e39d5 AP_L1_Control: use AP_GROUPINFO instead of AP_GROUPINFO_FRAME 2022-05-10 09:35:11 +10:00
xianglunkai beb194b4a1 AP_L1_Control: update_waypoint wrap added to nav_bearing
Co-authored-by: Iampete1 <iampete@hotmail.co.uk>
2022-02-16 18:29:48 +11:00
Peter Barker cd88ec65fa AP_L1_Control: rename AP_AHRS::get_position to get_location 2022-01-25 10:47:22 +11:00
murata 23253d0d26 AP_L1_Control: Simplify the decision process by initializing the stack variables 2021-12-11 12:27:40 -08:00
Iampete1 29455adab4 AP_L1_Control: remove SpdHgt and use TECS direct 2021-11-13 08:05:39 +11:00
Patrick José Pereira d006012cee AP_L1_Control: Add missing const in member functions
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2021-02-03 18:45:14 +11:00
murata 2eee8e389d AP_L1_Control: Set the gravitational acceleration value to the defined value 2021-01-05 09:11:14 +09:00
Peter Barker fd9068de8a AP_L1_Control: correct zeroing of cross-track integrator
This routine is generally only called at 10Hz, so the integrator was
regularly reset.
2020-11-05 17:32:38 +11:00
Peter Barker 8ee411e998 AP_L1_Control: wrap_180_cd no longer solely returns floats 2019-09-18 12:57:02 +10:00
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
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
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
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 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
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
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
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
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