Commit Graph

337 Commits

Author SHA1 Message Date
priseborough
5532750a99 AP_AHRS: Add public method to inhibit GPS useage when using EKF
This provides the calling vehicle software the abiity to request the EKF to not use GPS.
An integer is returned that indicates the type of operation available:
0 = request rejected (request will only be accepted if the EKF is in static mode, eg pre-armed)
1 = request accepted, attitude, vertical velocity and position estimates available
2 = request accepted, attitude, height rate, height, horizontal velocity and relative position estimates available
2014-12-06 18:16:49 +11:00
priseborough
44e1695d5a AP_AHRS : Enable EKF start without GPS 2014-12-06 18:16:46 +11:00
priseborough
a4984a1e76 AP_AHRS : Add range finder health status to EKF optical flow data 2014-12-06 18:16:44 +11:00
priseborough
12b012a00e AP_AHRS : temporary mods to test use of flow sensor internal gyro data 2014-12-06 18:16:44 +11:00
priseborough
7b76fc29fb AP_AHRS : EKF optical flow fusion support preliminary changes 2014-12-06 18:16:44 +11:00
Randy Mackay
4452aa8448 AP_AHRS_DCM: compile error fix for low speed CPUs
Also correct initialisatoin order to remove compiler warning
2014-12-05 19:43:05 +09:00
Jonathan Challinger
9261dfdefb AP_AHRS_NavEKF: overload get_accel_ef and get_accel_ef_blended functions 2014-12-05 19:40:08 +09:00
Jonathan Challinger
4975cefd84 AP_AHRS_DCM: update _accel_ef_blended 2014-12-05 19:40:06 +09:00
Jonathan Challinger
033ee3c900 AP_AHRS: Add get_accel_ef_blended function 2014-12-05 19:40:04 +09:00
Randy Mackay
9e731550fd AHRS: default EKF on for copter 2014-12-01 17:29:39 +09:00
Andrew Tridgell
38c1b622f3 AP_AHRS: fixed example build on APM2 2014-11-28 17:59:18 +11:00
Andrew Tridgell
89cdae62b4 AP_AHRS: fixed example build 2014-11-28 10:40:52 +11:00
priseborough
2c07299c04 AP_AHRS : Add reset of EKF gyro bias states 2014-10-29 15:32:18 +09:00
Randy Mackay
dffcfb42bc AHRS: add reset_gyro_drift method 2014-10-28 20:25:33 +09:00
Andrew Tridgell
26de54c29a AP_AHRS: cope with 90 degree pitch in update_trig()
this prevents a numerical error in Replay
2014-10-25 11:21:04 +11:00
Andrew Tridgell
f79ce92673 AP_AHRS: fixed example build 2014-10-24 12:10:40 +11:00
Randy Mackay
39c8535223 AHRS_DCM: sanity check AHRS_RP_P and AHRS_YAW_P 2014-10-21 21:41:41 +09:00
Andrew Tridgell
270bac4472 AP_AHRS: make get_position() const
This allows use from within AP_Mission
2014-10-20 08:36:20 +11:00
Andrew Tridgell
4ad643b233 AP_AHRS: use a common function for updating the CD values
this ensures the wrapping of yaw is consistent between the 3 use cases
2014-10-15 13:18:08 +11:00
Andrew Tridgell
eec5cd5add AP_AHRS: restore DCM attitude before update()
The DCM drift correction code uses the current attitude to calculate
error values to update its gyro drift correction. If we were using EKF
then without this patch the DCM code running as an alternative AHRS
source would be using the EKF attitude for calculating the error
value, leading to very bad gyro drift estimation
2014-10-15 11:15:33 +11:00
Andrew Tridgell
63c06ea2af AP_AHRS: fixed calls to DCM in parent class
use_compass() and reset() are common to AP_AHRS_DCM and
AP_AHRS_NavEKF. As AP_AHRS_NavEKF is a child of AP_AHRS_DCM, when we
call use_compass() from within AP_AHRS_DCM we actually end up calling
AP_AHRS_NavEKF::use_compass().

This has the effect of disabling the compass in DCM when EKF is active
and EKF has decided not to use the compass. That means that the DCM
yaw (and in fact the whole attitude) can get badly off while EKF is
enabled, making DCM an ineffective fallback if EKF fails.

The fix is to call the specific class versions of use_compass() and
reset()
2014-10-15 10:12:50 +11:00
Andrew Tridgell
809b6cc855 AP_AHRS: added get_yaw_rate_earth()
used to estimate course correction on takeoff
2014-10-07 07:17:46 +11:00
Randy Mackay
85eee31510 AHRS: rename ekfNotStarted method to initialised
Also created default implementation in AP_AHRS class so AP_AHRS_DCM does
not need to implement it.
2014-10-02 14:40:54 +09:00
priseborough
7cea7c6a18 AP_AHRS : add method to report if EKF is waiting to start 2014-10-02 14:38:29 +09:00
priseborough
7370e07c8d AP_AHRS : Prevent EKF starting if GPS sats less than AHRS_GPS_MINSATS 2014-10-01 12:55:29 +10:00
Andrew Tridgell
e9a9e33280 AP_AHRS: use EKF use_compass() if EKF enabled
this allows magfailed status to show on console via SYS_STATUS health
bits
2014-08-24 21:00:56 +10:00
Randy Mackay
a6de3283b6 AHRS_DCM: init members to resolve compiler warnings 2014-08-14 11:27:31 +09:00
Andrew Tridgell
0f5b65e40e AP_AHRS: fixed example build 2014-08-13 21:46:04 +10:00
Przemek Lekston
ae4814a773 AP_AHRS_DCM.cpp: changed the direction of position projection to ensure correct behavious in crosswind 2014-08-07 12:34:30 +10:00
Andrew Tridgell
82d0666501 AP_AHRS: fixed example build 2014-07-25 17:54:04 +10:00
Andrew Tridgell
6a275372dd AP_AHRS: ensure get_position() fills in flags 2014-07-25 11:40:16 +10:00
Randy Mackay
d23b685023 AP_AHRS: add empty virtual destructor 2014-07-16 14:56:54 +09:00
Randy Mackay
1f2e38ed28 AHRS: initalise members to reduce compiler warnings 2014-07-16 14:38:26 +09:00
Andrew Tridgell
28fedba4d8 AP_AHRS: fixed gyro_bias sign, and pre-calculate gyro_estimate for EKF
this allows us to return a constant vector for the corrected gyro
estimate. Based on discussions with Jon Challinger
2014-07-13 21:56:39 +10:00
Jonathan Challinger
966d66ef40 AP_AHRS_NavEKF: use gyro drift states from EKF in get_gyro 2014-07-13 21:34:44 +10:00
Jonathan Challinger
61987f6655 AP_AHRS: Fixed DCM get_gyro function
Previously incorporated the attitude correction terms into the return. Now only returns the drift-corrected gyro.
2014-07-13 21:19:29 +10:00
Andrew Tridgell
d70bee9249 AP_AHRS: fix for HAL_GPIO_* 2014-06-02 10:42:36 +10:00
Andrew Tridgell
b3c1e515dc AP_AHRS: when no accel info available in buffer use current value
this prevents an initialisation error, and is reasonable in flight too

Pair-Programmed-With: Paul Riseborough <p_riseborough@live.com.au>
2014-05-15 22:19:54 +10:00
Andrew Tridgell
315290029a AP_AHRS: fixed check of accel sensor health
we need to check health of each accelerometer separately
2014-05-15 22:18:56 +10:00
Andrew Tridgell
1a05c27bbb AP_AHRS: added healthy() function
this will be used to report when the AHRS subsystem becomes unhealthy
2014-05-15 21:14:21 +10:00
Andrew Tridgell
c8c6e05a4a AP_AHRS: added vehicle class to AHRS
used by EKF to control use of get_fly_forward()
2014-04-21 18:13:12 +10:00
Andrew Tridgell
4d24a86088 AP_AHRS: prevent a infinity value 2014-04-21 15:37:07 +10:00
Andrew Tridgell
b7350118a6 AP_AHRS: enable EKF wind estimate with no airspeed sensor
EKF can now estimate with IMU and GPS only

Pair-Programmed-With: Paul Riseborough <p_riseborough@live.com.au>
2014-04-13 19:42:49 +10:00
Andrew Tridgell
27a3b5fb36 AP_AHRS: fixed wind reporting with EKF and no airspeed sensor
the EKF does not estimate wind without an airspeed sensor
2014-04-10 06:49:23 +10:00
Andrew Tridgell
35c111a63a AP_AHRS: fixed example build 2014-04-01 06:38:25 +11:00
Andrew Tridgell
f07e4dee52 AP_AHRS: convert to new GPS API 2014-04-01 06:38:24 +11:00
Andrew Tridgell
afab8a9c5b AP_AHRS: fixed example build 2014-03-19 12:14:02 +09:00
Randy Mackay
efd4058e8b AHRS: interate move of p1 from Location to mission cmd 2014-03-19 12:10:51 +09:00
Paul Riseborough
15a44571c2 AP_NavEKF : enable operation without a compass for planes 2014-03-09 20:01:45 +11:00
Andrew Tridgell
aaaae9a222 AP_AHRS: added get_fly_forward() method
will be used to detect a copter
2014-02-27 17:39:49 +11:00
Andrew Tridgell
9a5ecc9541 AP_AHRS: use primary accel for accel_ef
Logs from Randy show that the copter INav code can't handle the
accelerometer sensor changing.
2014-02-27 16:28:37 +11:00
Andrew Tridgell
b53496d470 AP_AHRS: choose the best accelerometer at each drift correction step
this greatly reduces the impact of aliasing on accelerometers by
choosing the accelerometer that produces the smallest error term in
DCM. The difference can be quite dramatic on the Pixhawk.
2014-02-27 09:41:28 +11:00
Andrew Tridgell
0b45d2bc06 AP_AHRS: removed the AHRS_GPS_DELAY parameter
the best value has turned out to be 1, and tweaking it has not turned
out to be useful, so this simplifies the code in preparation for
adding the anti-aliasing handling with multiple accelerometers
2014-02-27 08:57:44 +11:00
Andrew Tridgell
6fc5c12f1d AP_AHRS: remove unused variable 2014-02-26 10:28:12 +11:00
Jonathan Challinger
f321a5f241 AP_AHRS: Change airspeed_estimate to const in children of AP_AHRS
Allows roll/pitch controllers to use DCM's airspeed estimate. Thanks to Kevin Hester for assistance in finding this.
2014-02-25 18:49:16 +11:00
Paul Riseborough
9f3c19c03a AP_AHRS : change initialisation requirements for EKF and use dynamic method 2014-02-23 19:50:34 +11:00
Andrew Tridgell
b434c11215 AP_AHRS: removed empty file 2014-02-19 22:00:25 +11:00
Andrew Tridgell
3b1f9a4bbf AP_AHRS: added get_armed() and set_armed() calls
will be used by NavEKF to determine static mode
2014-02-19 10:52:24 +11:00
Andrew Tridgell
fad0b2b233 AP_AHRS: added get_correct_centrifugal()
used by NavEKF to force static mode
2014-02-19 10:28:14 +11:00
Andrew Tridgell
ee37bc3d27 AP_AHRS: ensure we have HAL_CPU_CLASS available 2014-02-16 17:57:09 +11:00
Randy Mackay
a021d0ca31 AHRS: fix compiler warning 2014-02-16 13:35:37 +11:00
Andrew Tridgell
be33a9634e AP_AHRS: move using_EKF to .cpp to make it easier in gdb 2014-02-15 09:25:40 +11:00
Andrew Tridgell
eedd88c2ec AP_AHRS: give zero lat/lng and baro alt if no position yet in DCM 2014-02-15 09:25:40 +11:00
Randy Mackay
5bdc564191 AP_AHRS: fix example sketch 2014-02-15 06:09:08 +11:00
Andrew Tridgell
801ceacaf2 AP_AHRS: re-run update_trig() after EKF AHRS update 2014-02-15 05:48:24 +11:00
Andrew Tridgell
25ef0d5a7b AP_AHRS: don't allow get_velocity_NED() and get_relative_position_NED() without EKF
this avoids some linking issues, plus the functions are inaccurate
without EKF
2014-02-15 05:48:24 +11:00
Andrew Tridgell
c62ccce9d8 AP_AHRS: make estimate_wind() public
this avoids it linking into copter
2014-02-15 05:48:24 +11:00
Andrew Tridgell
f09ae0c2d0 AP_AHRS: expose get_NavEKF as non-const
better than having two methods
2014-02-15 05:48:22 +11:00
Paul Riseborough
08267cea87 AP_AHRS: Scheduling for yaw gain to reduce atitude errors in turning flight 2014-02-15 05:48:22 +11:00
Paul Riseborough
b4171853b1 AP_NavEKF: allow initialisation before GPS lock to aid indoor testing 2014-02-15 05:48:21 +11:00
Paul Riseborough
0599817aa9 AP_AHRS : EKF initialisation changed to use bootstrap method 2014-02-15 05:48:21 +11:00
Randy Mackay
f068d0ff7e AP_AHRS_NavEKF: expose non-const EKF for tuning 2014-02-15 05:48:20 +11:00
Randy Mackay
9f130b40a0 AP_AHRS_NavEKF: override set_correct_centrifugal 2014-02-15 05:48:20 +11:00
Randy Mackay
8f6fd86f69 AP_AHRS: make set_correct_centrifugal virtual 2014-02-15 05:48:20 +11:00
Paul Riseborough
a87df0ad56 AP_AHRS : set NavEKF staticMode using call to set_correct_centrigual 2014-02-15 05:48:20 +11:00
Paul Riseborough
ab08a5c7d6 AP_AHRS : altered NavEKF set home to reset position instead of reset filter 2014-02-15 05:48:18 +11:00
Andrew Tridgell
574946f0aa AP_AHRS: start EKF 5 seconds after getting GPS lock 2014-02-15 05:48:17 +11:00
Andrew Tridgell
df271fbd59 AP_AHRS: fill in _dcm_matrix whenever EKF started
this ensures get_dcm_matrix() always returns valid data
2014-02-15 05:48:17 +11:00
Andrew Tridgell
ada7d4fb98 AP_AHRS: use the right DCM matrix when EKF not enabled 2014-02-15 05:48:17 +11:00
Andrew Tridgell
a74fcc5a93 AP_AHRS: added set_ekf_use() 2014-02-15 05:48:17 +11:00
Andrew Tridgell
5d43a1d704 AP_AHRS: added inertial nav interfaces to AHRS 2014-02-15 05:48:16 +11:00
Andrew Tridgell
392995ef84 AP_AHRS: make AHRS handle altitude
AHRS now holds the home position
2014-02-15 05:29:47 +11:00
Andrew Tridgell
1e476e511a AP_AHRS: pass baro into AP_AHRS
first step in making AHRS handle altitude
2014-02-15 05:29:47 +11:00
Andrew Tridgell
6e5077b60b AP_AHRS: removed unused AP_AHRS_HIL 2014-02-15 05:29:46 +11:00
Andrew Tridgell
84c7b0d7fd AP_AHRS: check for NavEKF health 2014-02-15 05:29:46 +11:00
Andrew Tridgell
b39a5062e9 AP_AHRS: use NavEKF for ground vector when available 2014-02-15 05:29:45 +11:00
Andrew Tridgell
b6bc50051f AP_AHRS: allow reporting of secondary AHRS solution 2014-02-15 05:29:45 +11:00
Andrew Tridgell
8c5cde4efd AP_AHRS: allow NavEKF to be enabled at runtime with AHRS_EKF_USE=1 2014-02-15 05:28:10 +11:00
Andrew Tridgell
7ac78ff991 AP_AHRS: create AP_AHRS_NavEKF class
subclass of AP_AHRS_DCM, just a wrapper for now, will add EKF calls
next
2014-02-15 05:28:09 +11:00
Andrew Tridgell
c7533579ac AP_AHRS: added get_airspeed() interface to AHRS 2014-02-15 05:28:07 +11:00
Randy Mackay
98d667c916 AHRS_HIL: call update_trig 2014-02-08 18:16:44 +09:00
Randy Mackay
6946d68318 AHRS_DCM: call update_trig 2014-02-08 18:16:42 +09:00
Randy Mackay
3dc6ea682c AHRS: add update_trig
Calculates helper trig values including cos_roll, cos_pitch
2014-02-08 18:16:39 +09:00
Paul Riseborough
f2c2811ef3 AP_AHRS & AP_Math: fixed bug in use of AHRS_TRIM parameters 2014-01-19 07:19:43 +11:00
Andrew Tridgell
a96840e194 AP_AHRS: changed default GPS lag to 1 sample
this is based on detailed logs from a LEA-6H and NEO-7N
2013-12-30 10:33:48 +11:00
Andrew Tridgell
410d356979 AP_AHRS: make airspeed_estimate const 2013-12-29 18:39:01 +11:00
Michael Day
e5addf86c1 AP_AHRS: Added getters for compass and GPS. 2013-12-11 17:29:14 +11:00
Andrew Tridgell
baa4ecc2ea APA_AHRS: update for compass API change 2013-12-09 17:34:07 +11:00
Andrew Tridgell
b248cc0868 AP_AHRS: fixed a build warning 2013-11-23 21:44:56 +11:00
Andrew Tridgell
710d5119b5 AP_AHRS: added attitude_reset() method for HIL_SENSORS 2013-11-23 19:29:23 +11:00