Commit Graph

102 Commits

Author SHA1 Message Date
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
Lucas De Marchi 2c38e31c93 Remove use of PSTR
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.
2015-10-30 14:35:04 +09:00
Randy Mackay 4d458833dc AP_NavEKF2: remove unnecessary PV_AidingMode check
Thanks to OXINARF for catching this
2015-10-30 12:52:49 +09:00
Paul Riseborough b459d937ad AP_NavEKF2: Clean up GPS fusion timeout logic and comments 2015-10-30 12:24:19 +09:00
Randy Mackay 94adaba305 AP_NavEKF2: constify getLastPosNorthEastReset
Also constify getLastVelNorthEastReset
2015-10-30 12:24:16 +09:00
Randy Mackay 52ed075405 AP_NavEKF2: constify getLastYawResetAngle 2015-10-30 12:24:12 +09:00
Paul Riseborough 0b1a6a2157 AP_NavEKF2: Clean up GPS timeout logic 2015-10-30 12:24:06 +09:00
Paul Riseborough 74da4d8e57 AP_NavEKF2: Remove GPS glitch offset logic
Correction for steps in position and velocity caused by resets following GPS glitches and other events are now handled by the control loops.
2015-10-30 12:24:04 +09:00
Paul Riseborough 4fdec67546 AP_NavEKF2: Publish the position and velocity state reset deltas
Used by the control loops to compensate for step changes in position and velocity when the EKF needs to do a reset of these states.
2015-10-30 12:24:02 +09:00
Andrew Tridgell c228ea4371 AP_NavEKF2: prevent a valgrind error on startup 2015-10-26 11:34:32 +11:00
Paul Riseborough 87ea9acc7f AP_NavEKF2: Fix mavlink parameter label 2015-10-26 08:05:15 +11:00
Paul Riseborough 1cf626692c AP_NavEKF: Reduce impact of altimeter flow disturbance error on Copter alt hold
This increase in assumed altimeter noise and reduction in accel noise has been flight tested by L.Hall with noticeable reduction in the immediate response to Baro errors during moving flight.
This increases the time constant of response to baro errors such that the pilot can more easily compensate.
2015-10-26 08:05:15 +11:00
Paul Riseborough e692e30988 AP_NavEKF2: Reduce allowance for magnetometer timing errors
The previous gain from rate to magnetometer error was excessive. The revised value is equivalent to a magnetic field length of 0.5 with a timing uncertainty of 0.01 sec
2015-10-26 08:05:15 +11:00
Paul Riseborough 4c5ba60578 AP_NavEKF2: Remove dead code 2015-10-26 08:05:15 +11:00
Paul Riseborough 55ac8f0230 AP_NavEKF2: Update parameter values.
Testing on different platforms has shown that the new EKF has smaller innovations enabling innovation consistency checks that reject GPS and baro errors to be tightened.
The position and velocity thresholds for plane have been left the same because planes are less sensitive to GPS glitches as they fly higher and with more separation to surrounding objects. They are also more prone to bad inertial data due to the installation practices.
The altitude noise has been increased on plane to allow for the larger baro disturbances that result from the higher speeds and lack of a proper static pressure source. The innovation consistency gate has been adjusted to provide the same baro error limit of ~20m before baro is rejected.
2015-10-24 07:26:50 +11:00
Paul Riseborough 1e7ac873b9 AP_NavEKF2: Improve handling of GPS loss and recovery for planes
Extended GPS loss can result in the earth field states becoming  rotated and making it difficult for the EKF to recover its heading when GPS is regained.
During prolonged GPS outages, the position covariance can become large enough to cause the reset function to continually activate. This is fixed by ensuring that position covariances are always reset when the position is reset.
The innovation variance was being used incorrectly instead of the state variance to trigger the glitch reset.
2015-10-24 07:17:11 +11:00
Paul Riseborough cd5ec3a3e0 AP_NavEKF2: Reduce angle errors when flying without GPS
Turn off aiding during >1g manoeuvres when not using GPS
Use larger velocity and position uncertainties when flying without GPS
2015-10-23 19:04:30 +11:00
Paul Riseborough 1eaf318b9b AP_NavEKF2: Faster learning of gyro scale factors 2015-10-23 19:04:30 +11:00
Paul Riseborough a2f5962f77 AP_NavEKF2: Reduce effect of baro disturbances 2015-10-23 19:04:30 +11:00
Paul Riseborough 5eb7cf1fbf AP_NavEKF: Reduce roll/pitch disturbance when magnetic field is reset
Because we have changed the yaw angle and have taken a point sample on the magnetic field, covariances associated with the magnetic field states will be invalid and subsequent innovations could cause an unwanted disturbance in roll and pitch.
The reset of the Euler angles to a new yaw orientation was being done using roll and pitch from the output observer states, not the EKF state vector which meant that when roll and pitch were changing, the reset to a new yaw angle would also cause a roll and pitch disturbance.
2015-10-23 19:04:30 +11:00
Paul Riseborough b08817554e AP_NavEKF2: Ensure consistent position and velocity fusion rates when not using GPS
This sets the fusion of the synthetic position and velocity to occur at the same time as the barometer

This makes filter tuning more consistent between GPS and non-GPS useage
2015-10-21 17:27:00 +11:00
Paul Riseborough 1c347e8859 AP_NavEKF: Prevent high measurement data rates from overflowing buffers
High measurement data rates can fill buffers with data that is always new and never fused because it is over-written before it falls behind the measurement time horizon.
2015-10-21 17:27:00 +11:00
Paul Riseborough d1a090dda8 AP_NavEKF: Fix bug fetching data from measurement buffers
This bug can result in valid data being rejected and fused at the wrong time horizon.
2015-10-21 17:27:00 +11:00
Paul Riseborough aabb9b4e02 AP_NavEKF2: handle uncertain build type 2015-10-21 17:27:00 +11:00
Paul Riseborough e6312d91ce AP_NavEKF2: Correct variable name 2015-10-21 17:27:00 +11:00
Paul Riseborough 4640673cb1 AP_NavEKF2: Fix bug causing incorrect fusion timing 2015-10-21 17:27:00 +11:00
Paul Riseborough cd8b9c7d26 AP_NavEKF: prevent high rate mag data locking out other data fusion 2015-10-20 20:16:04 +11:00
Paul Riseborough ab8c28a7cc AP_NavEKF: Fix bug allowing takeoff in GPS modes without aiding
The legacy EKF switches GPs aiding on on arming, whereas the new EKF switches it on based on GPS data quality.
This means the decision to arm and therefore the predicted solution flags must now reflect the actual status of the navigation solution as it will no longer change when motor arming occurs.
2015-10-20 20:16:00 +11:00
Paul Riseborough e076ed7f66 AP_NavEKF2: Remove compiler warning message 2015-10-20 18:16:16 +11:00
Andrew Tridgell cb0f7cb370 NavEKF2: use new perf counter API 2015-10-20 18:16:15 +11:00
Paul Riseborough 60c2e81d19 AP_NavEKF2: Apply optimisations to declination fusion covariance update
These are the same type of optimisations that were successful with the magnetometer fusion
2015-10-20 15:21:41 +11:00
Paul Riseborough 0054291cf4 AP_NavEKF2: Apply optimisations to side-slip fusion covariance update
These are the same optimisations that were successful with the magnetometer fusion
2015-10-20 15:21:40 +11:00
Paul Riseborough 5e4bc4e954 AP_NavEKF2: Apply optimisations to airspeed fusion covariance update
These are the same optimisations that were successful with the magnetometer fusion
2015-10-20 15:21:40 +11:00
Paul Riseborough a29147d6d2 AP_NavEKF2: Apply optimisations to optical flow covariance update
These are the same optimisations that were successful with the magnetometer fusion
2015-10-20 15:21:40 +11:00
Paul Riseborough b5e43288d4 AP_NavEKF2: Down to 12 from 14 usec for perf test[8] 2015-10-20 15:21:40 +11:00
Paul Riseborough 0f530bb5a0 AP_NavEKF2: Correct comments 2015-10-20 15:21:40 +11:00
Andrew Tridgell d1dfd5fd01 AP_NavEKF2: use common header for optimisation level and irq disable 2015-10-20 15:21:40 +11:00
Andrew Tridgell a017ae7e00 AP_NavEKF2: down to 218us for test[9] 2015-10-20 15:21:40 +11:00
Andrew Tridgell fc23be8025 AP_NavEKF2: enable fine grained perf tuning for mag fusion 2015-10-20 15:21:40 +11:00
Andrew Tridgell b6c1352e4c AP_NavEKF2: added 10 test perf counters
used for fine grained performance tuning
2015-10-20 15:21:40 +11:00
Paul Riseborough 824436dfb6 AP_NavEKF2: Explicitly define constants as floats 2015-10-20 15:21:40 +11:00
Paul Riseborough 2fbd050418 AP_NavEKF2: Use blended accelerometer data
If high vibration levels cause offsets between the two, it switches to the accelerometer with lower vibration levels. The default behaviour is to use the average of both accelerometers.
2015-10-20 15:21:40 +11:00
Paul Riseborough 2b13020c19 AP_NavEKF2: Fix bug in vertical position derivative calculation 2015-10-20 15:21:39 +11:00
Paul Riseborough f6ad79688e AP_NavEKF2: Update start sequence console messages 2015-10-20 15:21:39 +11:00
Paul Riseborough 1a1236f764 AP_NavEKF2: Update magnetometer fusion documentation 2015-10-20 15:21:39 +11:00
Paul Riseborough 8526a8ba7e AP_NavEKF2: Level processor loading between frames
Don't fuse other measurements on the same frame that magnetometer measurements arrive if running at a high frame rate as there will be insufficient time to complete other operations.
2015-10-20 15:21:39 +11:00
Paul Riseborough 225b81baf4 AP_NavEKF2: Prevent users breaking filter by setting excessive time delays
If time deelays greater than the IMU buffer length are used, then it is possible for measurements to be dropped.
2015-10-20 15:21:39 +11:00
Paul Riseborough a1d6c7ae1e AP_NavEKF2: Improve timing accuracy
This parameter is a compromise between numerical accuracy of the covariance prediction and sensor timing jitter
Further testing has shown that doing covariance prediction and sensor fusion every 10msec has no observable effect on fusion health and reduces timing hitter noise on magnetometer observations during high rate maneovures
2015-10-20 15:21:39 +11:00
Paul Riseborough e0ed2dab63 AP_NavEKF2: Adjust IMU FIFO buffer for different IMU data rates
The values chosen ensure that up to consistent 250 msec of sensor delay compensation is available for different platform types
The revised values also ensure that fusion occurs at different time to when the 10Hz magnetometer measurements are read
2015-10-20 15:21:39 +11:00
Paul Riseborough baa8692960 AP_NavEKF2: Allow use of magnetometer learning during optical flow nav
Adds fusion of the declination when there are no earth relative measurements so that the declination angle and therefore the copters yaw angle have an absolute reference.
This enables the length (but not the declination) of the earth field North/East states to change along with the magnetometer offsets.
2015-10-20 15:21:38 +11:00