Commit Graph

50 Commits

Author SHA1 Message Date
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
Andrew Tridgell 341dca4dfe AP_L1_Control: added set_default_period()
used by the rover code
2013-09-09 19:55:53 +10:00
Andrew Tridgell 144516c941 AP_L1_Control: set min groundspeed to 0.1
this works better for slow rovers
2013-08-14 14:57:23 +10:00
Andrew Tridgell 31fce44063 AP_L1_Control: use a reference to AHRS
makes code a bit simpler
2013-08-13 13:49:26 +10:00
Andrew Tridgell 08ec43ef89 AP_L1_Control: use get_position() 2013-08-13 12:07:35 +10:00
Andrew Tridgell b74ed795f2 AP_L1_Control: removed _maxf() and _geo2planar() functions
not needed any more
2013-08-13 12:07:35 +10:00
Andrew Tridgell 653fa5a191 AP_L1_Control: adjust position for GPS lag
this should help for rovers
2013-08-13 12:07:35 +10:00
Andrew Tridgell fd4bceaafe AP_L1_Control: avoid using float global coordinates
this increases the navigation precision of rovers using L1 control
down to the centimeter level
2013-08-13 12:07:35 +10:00
Andrew Tridgell df8e8c64e8 AP_L1_Control: use projected position for turns 2013-08-13 12:07:34 +10:00
Andrew Tridgell 9c88872ad0 AP_L1_Control: use a better ground speed estimate at low speeds
this should prevent a rover going in the wrong direction at the start
of a mission
2013-08-13 12:07:34 +10:00
Andrew Tridgell 953051b49e AP_L1_Control: added lateral acceleration interface
this will be used by the Rover code for steering
2013-08-12 13:38:38 +10:00
Andrew Tridgell cf4a74cfb8 AP_L1_Control: fix for new AP_Math API
Pair-Programmed-With: Brandon Jones <brnjones@gmail.com>
2013-08-05 10:24:02 +10:00
Paul Riseborough 0c64c800b3 AP_L1_Control : Fixed bug in track capture angle limit 2013-08-02 21:47:45 +10:00
Andrew Tridgell 097718e833 AP_L1_Control: scale loiter and wp radius with altitude
this should keep the aircraft stable in loiter at very high altitudes

Pair-Programmed-With: Paul Riseborough <p_riseborough@live.com.au>
2013-07-22 12:50:01 +10:00
Andrew Tridgell 86db955ac9 AP_L1_Control: fixed indent-tabs-mode 2013-05-30 09:54:53 +10:00
Paul Riseborough 9f309a2aa6 AP_L1_Control: Remove potential nan errors
If WP A and B were the same or ground speed was exactly zero, then the
previous code would produce a nan output.  Protection against these
two cases has been added.

If WP A and B are equal, we track directly to the target waypoint
2013-05-13 11:27:51 +10:00
Andrew Tridgell 9654546b5a AP_L1_Control: Cleaned up calculation of damping to reduce computations
also removed _cross2D, using math library instead
2013-05-05 21:51:08 +10:00
Andrew Tridgell ba83950fc4 libraries: replace constrain() with constrain_float()
this makes the type much more obvious. Thanks to Tobias for the
suggestion.
2013-05-02 10:25:40 +10:00
Andrew Tridgell c067fa2660 L1_Control: make NAVL1_DAMPING docs clearer 2013-04-29 14:24:34 +10:00
priseborough 84ed37938d Plane : AP_L1_Control : Replaced division by constants with multiplies and adjusted default L1 period to 25 seconds 2013-04-28 14:47:59 +10:00
priseborough 9ff0888a17 AP_L1_Control : Fixed potential divide by zero in Nu1 angle calculation 2013-04-15 21:11:30 +10:00
Andrew Tridgell 97bfd16bd1 L1_Control: constrain the roll to handle floating point errors 2013-04-15 14:29:39 +10:00
Andrew Tridgell 571c48b9d5 L1_Control: cleanup some unused code and variables 2013-04-15 10:52:32 +10:00
priseborough a423d102e0 Plane : AP_L1_Control : Fix wrong way turn behaviour on loiter entry 2013-04-15 10:52:32 +10:00
Andrew Tridgell 181f7368a3 AP_L1_Control: change turn_distance() to be min of wp_radius and L1 distance
this gives less surprising behaviour for users
2013-04-15 10:52:32 +10:00
Andrew Tridgell dca597cda1 L1_Control: added a comment on speed of the L1 control code 2013-04-12 12:58:20 +10:00
Brandon Jones a3c2851120 AP_L1_Control: Addition of library for geometry calculations required for L1 Control.
1) Explicit control of tracking loop period and damping which removes previous
   variation in period with speed and fixed damping ratio
2) Explicit control of track capture angle (now set to 45 degrees by default)
3) Removal of restriction on loiter radius being greater than L1 distance

The circle(loiter) control is a L1 and PD hybrid utilising L1 for waypoint capture and PD control for circle tracking.

Pair-Programmed-With: Paul Riseborough <p_riseborough@live.com.au>
Pair-Programmed-With: Andrew Tridgell <tridge@samba.org>
2013-04-12 12:48:09 +10:00