Commit Graph

62 Commits

Author SHA1 Message Date
Paul Riseborough aa14de9d39 AP_NavEKF2: 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.
2015-11-02 14:12:17 +11:00
Paul Riseborough f539b597a3 AP_NavEKF2: Improve initialisation of magnetic field learning
Use the more robust, but less accurate compass heading fusion up to 5m altitude
Wait for the magnetometer data fusion time offset to be correct before using data to reset states
Don't reset magnetic field states if the vehicle is rotating rapidly as timing offsets will produce large errors
When doing the yaw angle reset, apply the reset increment to all quaternions stored in the output buffer to avoid transients produced by yaw rotations and the 0.25 second fusion time horizon offset.
Only do the one yaw and mag reset at 5m, not two at 1.5 and 5.0m
Always re-do the yaw and mag reset when leaving the ground.
2015-10-30 15:34:20 +09: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 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
Andrew Tridgell d1dfd5fd01 AP_NavEKF2: use common header for optimisation level and irq disable 2015-10-20 15:21:40 +11:00
Paul Riseborough f6ad79688e AP_NavEKF2: Update start sequence console messages 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
Paul Riseborough 6899767d28 AP_NavEKF2: Disable magnetic field learning if we have no absolute position reference 2015-10-20 15:21:38 +11:00
Paul Riseborough e7de2d3ea3 AP_NavEKF: Update magnetic field learning options
Provide an option to always do learning
Make field learning decision logic clearer
Change defaults so that plane learns when airborne
Change defaults so that Rover does not learn (large external magnetic interference)
2015-10-20 15:21:38 +11:00
Paul Riseborough 71c399674a AP_NavEKF2: Delay use of magnetic field states until off-ground
Magnetic interference whilst on the ground can adversely affect filter states. This patch ensures that the simpler and more robust magnetic heading observation method is used until the vehicle has cleared the ground.
2015-10-20 15:21:37 +11:00
Paul Riseborough 0dc570b5a5 AP_NavEKF2: Improve optical flow takeoff detection logic
Ensure takeoff detect status goes to false when on ground
2015-10-20 15:21:36 +11:00
Paul Riseborough b142cc7fd2 AP_NavEKF2: Rename files and re-distribute content 2015-10-10 14:48:50 +09:00