Commit Graph

627 Commits

Author SHA1 Message Date
Lucas De Marchi 798b743660 AP_NavEKF: use MAX() instead of maxf() 2015-12-01 16:28:18 -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
Luis Vale Gonçalves 40caec8afb AP_NavEKF: libraries_Text_revision
text revision of messages
2015-11-26 08:10:14 +11:00
Caio Marcelo de Oliveira Filho e3c317b96b AP_NavEKF: use millis/micros/panic functions 2015-11-20 12:32:31 +09:00
Andrew Tridgell 5561efde2b AP_NavEKF: we can assume get_sample_rate() returns a non-zero number
this fixes a build error with the previous patch
2015-11-18 11:48:50 +11:00
Paul Riseborough e32e6cfa67 AP_NavEKF: Protect against bad delta time from the INS library
Prevent arithmetic divide by zero exceptions and handle invalid delta time in a consistent way by setting invalid times to the average.
2015-11-18 11:43:40 +11:00
Julien BERAUD 259f5f07e8 AP_NavEKF_core: fix init of perf
_perf_FuseOptFlow  was used and not allocated
2015-11-14 14:44:29 +11:00
Paul Riseborough e8305c5653 AP_NavEKF: Prevent front-end from returning uninitialised data (garbage) 2015-11-09 15:56:45 +11:00
Paul Riseborough 0f8cfa02ab AP_NavEKF: Remove redundant if statement
Thank you to OXINARF for picking up this one
2015-11-08 17:06:57 +11:00
Paul Riseborough 2243f95074 AP_NavEKF: Enable clean entry into GPS aiding whilst in-flight
Ensures that the latest GPS data is used to reset the states.
Separates the logic used to set the origin from the logic used to determine when to reset states and commence GPS aiding
2015-11-08 17:06:49 +11:00
Paul Riseborough 624f169b9b AP_NavEKF: Publish enabled status 2015-11-08 15:37:27 +11:00
Siddharth Bharat Purohit 392fce76b2 AP_NavEKF: define getGpsGlitchStatus function 2015-11-08 12:55:58 +09:00
Andrew Tridgell 56909ce973 AP_NavEKF: split EKF1 into frontend and backend
this allows the primary EKF to be allocated dynamically, allowing for
experiments with EKF2 with multi-IMU support
2015-11-06 10:42:57 +11:00
Lucas De Marchi d00c8e3a34 AP_NavEKF: remove checks for HAL_BOARD_APM2 and HAL_BOARD_APM1 2015-11-04 12:14:12 +11:00
Paul Riseborough 9b37c29efa AP_NavEKF: Improve mag earth state reset accuracy
This removes errors in the in-flight reset of the earth field states by:

1) Using a state vector and magnetometer measurement from the same time coordinate
2) Not using the AHRS trim offsets in the calculation
2015-11-02 17:47:01 +09:00
Paul Riseborough 0dd5a7c4fa AP_NavEKF: Use correct blended delta time for all vel and pos integration
dtIMUactual has been spit into a separate dtDelAng and dtDelVel and dtDelVel1 and dtDelVel2 delta time in recognition of the amount of timing jitter and different update rates for the IMU's
2015-11-02 17:47:00 +09:00
Paul Riseborough 42214ec303 AP_NavEKF: Fix failure to start mag cal due to gyro noise
Vibration in the 400Hz delta angles could cause the angular rate condition check for in-flight magnetic field alignment to fail.
The symptons were failure to start magnetic field learning as expected when EK2_MAG_CAL=3 was set.
The calculation of a delta rotation between consecutive magnetometer samples has been introduced instead of the most recent IMU delta angle as this is less affected by noise and give an upper bound on the angular error.
the check has been moved into the magnetometer fusion control function so that any reset will be performed using fresh magnetometer data
2015-11-02 17:46:59 +09:00
Paul Riseborough 707089178f AP_NavEKF: Update default parameter values:
Explicitly set Plane parameters rather than rely on use of the default
If no type defined, default to Copter parameters (most common platform type
Enable different platform types to use different initial accel bias uncertainty
Reduce initial accel bias uncertainty for copter to prevent initial oscillation in bias and height estimate
2015-11-02 17:46:58 +09:00
Paul Riseborough 3d8f720aaf AP_NavEKF: Improve initial accel bias learning
Fuse synthetic velocity data at zero before arming to improve stability margins for initial bias offset learning.
2015-11-02 17:46:57 +09:00
Paul Riseborough 64ad7d6a50 AP_NavEKF: handle case where one IMU fails to return a delta velocity or angle 2015-11-02 17:46:56 +09:00
Paul Riseborough 69d4bd2481 AP_NavEKF: Protect against baro data errors in constant position mode
Large baro data errors when flying without GPS could cause total failure of the EKF.
This patch provides protection against this happening in-flight but allows for large innovations during preflight alignment.
2015-11-02 17:46:55 +09:00
Paul Riseborough 778b1c3e18 AP_NavEKF: Remove dead code for constant velocity mode 2015-11-02 17:46:54 +09:00
Paul Riseborough fb8e01a73c AP_NavEKF: Do not automatically accept DCM alignment data after 30 seconds
A looser check is applied at 30 seconds rather than no check.
2015-11-02 17:46:53 +09:00
Paul Riseborough be11e12f81 AP_NavEKF: Improve height reset during climbs and descents
Resets the vertical velocity to the GPS when the height is reset is the GPS is healthy
2015-11-02 17:46:53 +09:00
Paul Riseborough 59df23bc0f AP_NavEKF: Reduce EKF health pre-arm check false positives 2015-11-02 17:46:52 +09:00
Paul Riseborough a1e32d71ec AP_NavEKF: Prevent large rotation rates corrupting the in-flight mag reset 2015-10-30 15:34:14 +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
Randy Mackay 3f29365cae AP_NavEKF: constify getLastPosNorthEastReset 2015-10-30 12:24:15 +09:00
Randy Mackay 758c5a7d7f AP_NavEKF: constify getLastYawResetAngle 2015-10-30 12:24:11 +09:00
Paul Riseborough 7c40448bab AP_NavEKF: Remove GPS glitch offset logic
The correction for offsets due to position and velocity resets will now be handled in the control loops.
2015-10-30 12:24:01 +09:00
Paul Riseborough 5489ff9118 AP_NavEKF: publish position and velocity state reset data
Used by the control loops to compensate for steps in velocity and/or position resulting from state resets.
2015-10-30 12:24:00 +09:00
Paul Riseborough 44f42fe72d AP_NavEK: Reduce settling time after start-up disturbance
Now that we are using  a consistent 50Hz minimum update rate for the covariance prediction we do not need a different initial gyro bias uncertainty for plane and copter to maintain filter stability margins.
The default value of 0.1 rad/s was too high and gave excessive settling time of the filter attitude after startup.
The initial attitude uncertainty has been increased to allow for some movement during startup.
2015-10-22 16:23:14 +11:00
Paul Riseborough 6c017ffcb5 AP_NavEKF: Predict covariance more often to prevent instability on startup
If the baro data and magnetometer data are interleaved (arriving every 100 msec and offset by 50 msec), then the filter will go unstable during startup and fail to complete checks.
2015-10-22 09:57:38 +09:00
Andrew Tridgell f66966ccae NavEKF: use new perf counter API 2015-10-20 18:16:15 +11:00
Paul Riseborough 240ea92947 AP_NavEKF: Re-center gyro bias limits on arming
Allows the gyro bias to vary by up to +-10 deg/second before and after arming.
2015-10-20 15:21:39 +11:00
Paul Riseborough 8515dda727 AP_NavEKF: Fix bug in vertical position derivative calculation 2015-10-20 15:21:39 +11:00
Paul Riseborough 6b3e114cd6 AP_NavEKF: Enable EKF1 to be disabled to reduce frame over-runs 2015-10-20 15:21:39 +11:00
Paul Riseborough 840f307d58 AP_NavEKF: Make EKF2 PosDownDerivative interface follow coding conventions
Updates arising from peer review.
2015-10-20 15:21:37 +11:00
Paul Riseborough dab658f6ed AP_NavEKF: Add methods to output and calculate vertical position derivative 2015-10-20 15:21:36 +11:00
Andrew Tridgell f5b5a3b0f8 AP_NavEKF: added EKF_DISABLE_INTERRUPTS
this helps with performance tuning
2015-10-20 14:37:41 +11:00
Andrew Tridgell 10fddf4c7e AP_NavEKF: enable optimisation level 3 for the EKF 2015-10-20 14:36:56 +11:00
Andrew Tridgell 6f36267a66 AP_NavEKF: fixed EKF error message during 10 second warmup 2015-10-16 14:58:46 +11:00
Gustavo Jose de Sousa afccf615d5 AP_NavEKF: use compass get_{field,offsets}() functions
Both functions are equivalent, so we're going to simply use
get_{field,offsets}() instead of get_{field,offsets}_milligauss().
2015-10-15 19:56:03 +09:00
Paul Riseborough 3479a0e209 AP_NavEKF: Prevent blocking of synthetic position fusion
Fixes a potential error where changes to timing and arrival rate of magnetometer and baro data could block the fusion of synthetic position and velocity measurements, allowing unrestrained tilt errors during operation without GPS or optical flow.
Fusion of synthetic position or velocity measurements is now timed to coincide with fusion of barometer observations.
If a new barometer observation has not arrived after 200 msec then the synthetic position or velocity is fused anyway so that fusion of synthetic position or velocity observations cannot occur any slower than 5 Hz
2015-10-13 14:05:36 +09:00
Paul Riseborough a895b16fa6 AP_NavEKF: Prevent GPS glitch activating EKF failsafe 2015-10-12 16:29:21 +09:00
Paul Riseborough f451a81ef9 AP_NavEKF: Add missing GPs check report 2015-10-10 21:22:49 +09:00
Paul Riseborough a3a1dabb94 AP_NavEKF: Update GPS check description and default setting
Previous check default only checked the number of satellites and horizontal position accuracy.
Updated default value also checks HDoP and speed accuracy.
2015-10-10 21:21:25 +09:00
Paul Riseborough ef5049862a AP_NavEKF: Add fix status to GPS check report message 2015-10-10 14:49:05 +09:00
Paul Riseborough 5177746c00 AP_NavEKF: Add reporting of GPS check status 2015-10-10 14:49:01 +09:00
Paul Riseborough d0080b66cd AP_NavEKF: Define a structure for reporting of GPS checks 2015-10-10 14:48:56 +09:00