Commit Graph

566 Commits

Author SHA1 Message Date
Andrew Tridgell eac91430a2 AP_AHRS: update _dcm_attitude() on reset()
this prevents the roll/pitch being overwritten by the AHRS_NavEKF
update code on next update
2015-10-21 08:58:30 +11:00
Jonathan Challinger c35605fa04 AP_AHRS_DCM: align tilt during initialization 2015-10-21 08:34:02 +11:00
Paul Riseborough 0722ebe8a0 AP_AHRS: Add EKF variance checks 2015-10-20 15:21:38 +11:00
Paul Riseborough ae830b44c4 AP_AHRS: Make EKF2 PosDownDerivative interface follow coding conventions
Updates arising from peer review.
2015-10-20 15:21:37 +11:00
Paul Riseborough e8037f94ad AP_AHRS: Make EKF2 PosDownDerivative interface follow coding conventions
Updates arising from peer review
2015-10-20 15:21:37 +11:00
Paul Riseborough 58d57994f4 AP_AHRS: Rectify coding errors found during peer review
Fixes code that didn't take into account fall-through behaviour of C++ switch statements
Makes get_rigin furnction more generic allowing the consumer to decide what to do with an invalid origin
2015-10-20 15:21:36 +11:00
Paul Riseborough e65ae51564 AP_AHRS: Enable AP_InertialNav to access all EKF functions via AP_AHRS
This patch adds additional methods to the the AHRS library so that the AP_InertialNav library dow nto have to access the EKF directly. This enables Copter to fly using the EKF nominated by AHRS_EKF_TYPE.
It will also pave the way to elimination of the AP_InertialNav library.
2015-10-20 15:21:36 +11:00
Gustavo Jose de Sousa 84f811fe76 AP_AHRS: 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:00 +09:00
Andrew Tridgell 232fc8a64d AP_AHRS: added send_ekf_status_report() 2015-09-29 10:58:54 +10:00
Randy Mackay 9f59b6f7b5 AP_AHRS: getLastYawResetAngle returns reset time 2015-09-24 16:57:41 +09:00
Andrew Tridgell 06c0ad987e AP_AHRS: fixed divide by zero in SITL
fixes issue#2875
2015-09-24 16:49:22 +10:00
Paul Riseborough f77bdd90fc AP_AHRS: Update EKF2 data logging 2015-09-24 12:58:44 +10:00
Andrew Tridgell dde8330077 AP_AHRS: rename using_EKF to active_EKF_type()
thanks to Randy for the suggestion
2015-09-23 17:53:44 +10:00
Andrew Tridgell f9348887c5 AP_AHRS: added getLastYawResetAngle() and resetHeightDatum() 2015-09-23 17:46:51 +10:00
Andrew Tridgell 0677c2c80c AP_AHRS: run astyle for formatting 2015-09-23 17:31:00 +10:00
Andrew Tridgell 13f72e5ba9 AP_AHRS: expose EKF2 for logging 2015-09-23 12:09:36 +10:00
Andrew Tridgell 7ba45444a2 AP_AHRS: added selection of EKF type using AHRS_EKF_TYPE 2015-09-23 11:57:18 +10:00
Andrew Tridgell ed25c85d21 AP_AHRS: added NavEKF2 to constructor 2015-09-23 11:56:42 +10:00
Randy Mackay b5e1ad89b3 AHRS: remove INS start style from example sketch 2015-09-21 17:06:23 +09:00
Grant Morphett b2751d876c AP_AHRS: Fixed spelling error in parameter desc. 2015-09-16 09:33:30 +09:00
Staroselskii Georgii 4b948f5bb1 AP_AHRS: make DCM use milligauss 2015-09-09 10:38:16 +10:00
Andrew Tridgell c18c6d894e AP_AHRS: added prearm_failure_reason() 2015-09-08 15:50:22 +10:00
Randy Mackay a7569e3a61 AHRS_NavEKF: integrate INS use_accel 2015-08-19 16:44:22 +09:00
Randy Mackay 7f46cc9059 AHRS_DCM: integrate INS use_accel 2015-08-19 16:44:19 +09:00
Lucas De Marchi b43bddc0af AP_AHRS: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-18 17:12:51 +10:00
Gustavo Jose de Sousa 54d5277842 AP_AHRS: 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:42 +10:00
Andrew Tridgell 7e2e78c1af AP_AHRS: protect against zero deltat in DCM
fixes issue #2657
2015-08-05 15:21:00 +10:00
Randy Mackay 9067abc037 AHRS_NavEKF: fix blended accel to use primary accel 2015-08-01 17:19:45 +09:00
Andrew Tridgell 9c776736c1 AP_AHRS: use delta_velocity and delta_angle in DCM
this prevents an aliasing effect by using the correct delta velocity
time value for each accelerometer sample used
2015-07-30 11:04:31 +10:00
mirkix d169fea9ec AP_AHRS: Add Linux support for example 2015-06-18 08:59:16 +10:00
Andrew Tridgell edab50ab5a AP_AHRS: convert example from .pde to .cpp 2015-06-01 16:58:10 +10:00
Andrew Tridgell 04ba5fa0bd AP_AHRS: pass EKF into constructor
this makes it possible for var_info in vehicle code to be in text
segment
2015-06-01 16:16:24 +10:00
Andrew Tridgell 00ca493860 AP_AHRS: prevent a floating exception in update_trig 2015-05-27 22:10:39 +10:00
Andrew Tridgell b61f7fa2f6 AP_AHRS: enable EKF by default on plane
now we have arming checks enabled by default I think this is the best
choice
2015-05-23 17:17:44 +10:00
Andrew Tridgell 7a76f72bf5 AP_AHRS: added uptime_ms() interface 2015-05-20 15:22:14 +10:00
Andrew Tridgell 5514a9f690 AP_NavEKF: base EKF decisions on vehicle class
using the vehicle class rather than the build macros allows this to
work correctly in replay
2015-05-19 15:21:22 +10:00
Andrew Tridgell 92daa15ccc AP_AHRS: on plane and rover make AHRS unhealthy when EKF not initialised
planes and rovers need full absolute position from the EKF if the EKF
is going to be used. We don't want users to arm without full
capabilities
2015-05-19 15:21:21 +10:00
Andrew Tridgell 29f0561ce4 AP_AHRS: reject EKF for plane when we have GPS and aren't fusing
plane users would prefer to use GPS in this case
2015-05-17 21:24:57 +10:00
Paul Riseborough c2ac80cc63 AP_AHRS: Prevent copter from switching to DCM unless EKF has severe errors 2015-05-13 16:11:13 +09:00
Andrew Tridgell 3529e02675 AP_AHRS: if we have 3 gyros then only use first two
the 3rd gyro on a PH2 has a lot more noise as it is not vibration
isolated
2015-05-09 21:00:49 +10:00
Randy Mackay 3390d9932e AP_AHRS: fix example sketch 2015-05-09 12:23:05 +09:00
Peter Barker 463270e0ee AP_AHRS: avoid FPE when we don't have a compass reading 2015-05-05 15:02:35 +10:00
Andrew Tridgell 4d4a607b80 AP_AHRS: revert AP_Math class change 2015-05-05 13:27:05 +10:00
Tom Pittenger 20f47417d5 AP_AHRS: compiler warnings: apply is_zero(float) or is_equal(float) and float to doubles 2015-05-05 13:26:55 +10:00
Andrew Tridgell e597575747 AP_AHRS: fix for HAL_SITL rename 2015-05-05 09:45:54 +10:00
Andrew Tridgell 6bfca648b9 AP_AHRS: raise DCM P gains when disarmed for first 20 seconds 2015-04-28 14:07:39 +10:00
Tom Pittenger e28c555889 AHRS_DCM: fix compile warnings re float constants
Also fix example sketch
2015-04-24 12:26:08 +09:00
Paul Riseborough 7f1749dc1c AP_AHRS: Allow EKF to pull data from range finder object 2015-04-24 10:56:58 +09:00
Paul Riseborough 405862bd8f AP_AHRS: Reduce time delay for EKF initialisation 2015-04-23 20:35:52 +09:00
Paul Riseborough 5184bca87f AP_AHRS: Prevent DCM reporting good tilt error when inverted 2015-04-23 20:35:39 +09:00
Paul Riseborough ea8217bd3a AP_AHRS: Reduce time constant on filtering of DCM error reporting
Reduces time constant from 2 to 1 second to make data more useful for pre-flight alignment checks by the EKF
2015-04-23 20:35:35 +09:00
Randy Mackay 6e30093924 AP_AHRS: correct sanity checks on update_trig 2015-04-23 09:45:43 +09:00
Jonathan Challinger 6a6ccb4f32 AP_AHRS: add sanity checks 2015-04-22 21:50:51 +09:00
Randy Mackay c6f71ea2e0 AHRS: make get_error_rp and get_error_yaw const 2015-04-21 22:42:17 +09:00
Andrew Tridgell a0969905ce AP_AHRS: make get_error_rp() and get_error_yaw() const
this makes them usable by multiple consumers, and allows use by EKF
2015-04-21 21:42:17 +10:00
Andrew Tridgell d7249cc1e6 AP_AHRS: only use EKF for plane and rover if all data available
we need position and velocity to be working for plane and rover
2015-04-14 09:57:45 +10:00
Paul Riseborough ff9917d338 AP_AHRS: Fix bug preventing EKF from initialising 2015-04-10 11:07:42 +09:00
Jonathan Challinger dc5bdd5ad8 AP_AHRS: use filtered INS output to compute _accel_ef_blended 2015-04-09 20:19:56 +09:00
Paul Riseborough d44cf14178 AP_AHRS : Publish EKF learned compass offsets 2015-04-03 15:24:47 -07:00
Andrew Tridgell 8ba043e593 AP_AHRS: fixed EKF startup bug
This fixes the EKF for when GPS lock takes more than 10 seconds

fixes issue #2010
2015-03-28 10:52:22 -07:00
Randy Mackay 98efcd5f03 AHRS: always use EKF for copter 2015-03-19 15:15:51 +09:00
Randy Mackay 7f25938834 AHRS: fix example sketch 2015-03-16 20:29:19 +09:00
Jonathan Challinger f92c711d14 AP_AHRS: define AP_AHRS_TYPE to be the type of AHRS in use 2015-03-16 09:14:03 +11:00
Andrew Tridgell 585a105128 AP_AHRS: use compass->last_update_usec() 2015-03-14 12:31:50 +11:00
Andrew Tridgell b488d6de00 AP_AHRS: fix for new compass API 2015-03-13 18:46:17 +11:00
Andrew Tridgell 031c81beee AP_AHRS: removed call to 1D accel cal 2015-03-12 12:50:29 +11:00
Andrew Tridgell 6781a8d329 AP_AHRS: fixed get_position for EKF to use correct relative altitude
we need to use the EKF relative height plus the current AHRS home
2015-02-21 10:12:53 +11:00
Jonathan Challinger 180c85817d AP_AHRS: remove armed state, use hal.util soft_armed state 2015-02-11 20:25:11 +11:00
mirkix 49d81a9c99 AP_AHRS: fix apm1 oilpan support 2015-02-11 18:22:39 +11:00
Randy Mackay b66a1135d9 AHRS: fix example sketch compile error 2015-02-03 15:57:11 +09:00
Andrew Tridgell ee9c778834 AP_AHRS: added a get_NavEKF_const() function
needed for AP_Mount_MAVLink

Pair-Programmed-With: Paul Riseborough <p_riseborough@live.com.au>
2015-02-03 09:49:16 +11:00
Andrew Tridgell 68f64fa11c AP_AHRS: make the healthy() method const 2015-02-01 14:13:52 +11:00
Randy Mackay d8664d15d6 AHRS: fix example sketch 2015-01-28 17:15:35 +09:00
Andrew Tridgell ed0a56cc3c AP_AHRS: cope with the changed semantics of airspeed.use() 2015-01-20 11:27:58 +11:00
Andrew Tridgell d2c827aa4b AP_AHRS: updates for new AP_Baro API 2015-01-09 11:50:56 +11:00
Andrew Tridgell b499cd1b59 AP_AHRS: fixed examples build
using a relative include works as the object is just passed through,
not used, in this header
2015-01-05 07:04:27 +11:00
Andrew Tridgell 70c2aeca42 AP_AHRS: make optflow available via AHRS
same pattern as compass and airspeed sensor
2015-01-03 14:16:34 +11:00
priseborough 5b8265ad6f AP_AHRS: Expand EKF speed limit public method to handle control limits 2014-12-06 18:16:50 +11:00
priseborough 83775554ea AP_AHRS: Publish EKF ground speed limit 2014-12-06 18:16:50 +11:00
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
Andrew Tridgell 6ed493b10f AP_AHRS: added attitude_reset() method for HIL_SENSORS 2013-11-23 18:50:56 +11:00
Andrew Tridgell 4f871c87f1 AP_AHRS: detect and try to cope with bad accels 2013-11-07 13:54:16 +11:00
Andrew Tridgell 56bcda7252 AP_AHRS: lower default roll and yaw drift correction speed
the gyros sustain accuracy over much longer time periods than
previously expected
2013-11-05 14:52:39 +11:00
Andrew Tridgell 02d6f012ce AP_AHRS: added accel sum delay buffer to account for GPS lag 2013-11-04 21:21:42 +11:00
Andrew Tridgell d31e557983 AP_AHRS: save memory and reduce pointer references
use a refence for ins, and don't save gyro and accel between updates
2013-11-04 21:21:37 +11:00
Andrew Tridgell cb52b6f367 AP_AHRS: removed limit on normalisation of accel reference vectors
this could lead to a bias in the accel drift correction
2013-11-04 21:20:41 +11:00
Andrew Tridgell 31eaaada62 AP_AHRS: removed vertical G limit on GPS velocity correction
this limit could lead to a bias in the accel drift correction, and is
frequenctly exceeded
2013-11-04 21:20:41 +11:00
Andrew Tridgell a7931b1581 AP_AHRS: fixed wrapping bug in GPS based heading error
this bug could cause the GPS based yaw to use an expensive reset far
too often
2013-11-04 21:20:41 +11:00
Andrew Tridgell 17b27a47de AP_AHRS: prevent GPS yaw resets on compass errors
when we switch from compass heading to GPS heading we don't want to
trigger a sudden GPS yaw reset
2013-11-04 21:20:41 +11:00
Andrew Tridgell d305dd5946 AP_AHRS: debounce the GPS/compass consistency test
we will only consider the compass inconsistent with GPS if it is off
for more than 2 seconds
2013-10-23 09:40:42 +11:00
Andrew Tridgell 8ee848a788 AP_AHRS: update for Stub -> HIL 2013-09-28 22:04:15 +10:00
Randy Mackay 8306d74da0 AHRS: remove DMP as an ahrs 2013-09-27 10:42:46 +09:00
Andrew Tridgell e1aa6e3ff1 libraries: fixed examples for no flash_leds() callback 2013-09-19 18:38:28 +10:00
Andrew Tridgell 15a4582ed7 AP_AHRS: changed to AP_Vehicle.h 2013-09-13 11:46:10 +10:00
Andrew Tridgell c044385fff AP_AHRS: added groundspeed() method
this gives ground speed in m/s from GPS
2013-09-09 18:04:41 +10:00
Andrew Tridgell c56017d8f1 AP_AHRS: added in new orientations 2013-08-30 14:19:17 +10:00
Andrew Tridgell 97b7130bb9 libraries: update license header to GPLv3
we switched to GPLv3 a long time ago, but neglected to update the
per-file license headers
2013-08-30 13:01:39 +10:00
Andrew Tridgell 6182571c21 AP_AHRS: fixed example build 2013-08-30 13:01:36 +10:00
Andrew Tridgell 587fb58720 AP_AHRS: fixed license text
APM is under GPL, not LGPL
2013-08-30 13:01:32 +10:00
Andrew Tridgell 57d2dd814d AP_AHRS: added get_position_lag() call
provide position lag to libraries
2013-08-13 12:07:35 +10:00
Andrew Tridgell 0d36832b82 AP_AHRS: use const reference not pointers for locations
this makes life easier for the new AP_Mission library

Pair-Programmed-With: Brandon Jones <brnjones@gmail.com>
2013-08-05 10:24:12 +10:00
Andrew Tridgell ec73fadc45 AP_AHRS: added true airspeed support in AHRS
use true airspeed for wind calculations, and allow other drivers to
ask for the current ratio
2013-07-22 12:50:01 +10:00
Randy Mackay 0325ad5d0d AP_AHRS: use rotateXY for speed
Saves 0.1ms at 100hz
2013-07-20 18:00:36 +09:00
Andrew Tridgell 1bd6849d00 AP_AHRS: fixed example build 2013-07-15 14:10:17 +10:00
Andrew Tridgell b721bcc129 AP_AHRS: removed get_roll_rate_earth() and get_pitch_rate_earth()
these are not used any more
2013-07-13 21:45:58 +10:00
Andrew Tridgell 086e8f80dc AP_AHRS: fixed spin rate gain conversion from degrees to radians
fixes issue #433

Thanks Jurgen!
2013-07-13 12:36:25 +10:00
Randy Mackay 7860d06b91 AHRS: typo fix for ORIENTATION param description 2013-07-10 14:56:48 +09:00
Andrew Tridgell 279f6d00f0 AP_AHRS: changes for GPS field changes 2013-07-10 14:04:22 +10:00
tobias 1bf135b36f AP_AHRS: make some more functions const 2013-07-08 12:07:50 +10:00
Randy Mackay ded31582de AP_AHRS: add Roll90Yaw90 to parameter description
Thanks to Rainer Walther for spotting this
2013-07-07 13:06:40 -10:00
Andrew Tridgell 80e0f8044c AP_AHRS: added airspeed_sensor_enabled() function 2013-07-04 16:56:57 +10:00
Andrew Tridgell 7d42a0562d AP_AHRS: cope better with large GPS yaw changes
this should cope better with bungee launches when using only GPS for
yaw.
2013-06-25 12:44:26 +10:00
Andrew Tridgell aaaa5247e3 AP_AHRS: make it possible to setup board orientation at runtime 2013-06-03 16:52:28 +10:00
Andrew Tridgell e75253d019 AP_AHRS: fixed indent-tabs-mode 2013-05-30 09:54:53 +10:00
Andrew Tridgell 14628990e6 AP_AHRS: make wind estimation configurable
rover doesn't want it
2013-05-24 11:21:42 +10:00
Randy Mackay b27ddf0f63 AP_AHRS: add parameter descriptions 2013-05-21 15:39:03 +09:00
Andrew Tridgell c08c084191 AP_AHRS: added get_projected_position()
this is used to project the position forward by the GPS lag
2013-05-17 08:32:21 +10:00
Andrew Tridgell a17b85c661 AP_AHRS: use vectors for ground vector complimentary filter 2013-05-13 11:27:55 +10:00
Andrew Tridgell 6f1cee6406 AP_AHRS: fixed position estimate with 2D fix or low satellite count
we should still use the GPS for position fixes when we have a low
number of satellites, but we should stop using it for velocity
estimates and attitude correction.
2013-05-07 10:52:14 +10:00
Randy Mackay ceda7d26b0 AHRS: add correct_centrifugal and flags structure 2013-05-06 15:32:06 +09:00
Andrew Tridgell 38fc0e61c6 AP_AHRS: optimise yaw drift correction
use new vector2 cross product, and factor out the z component of a dcm
mul_transpose() to reduce the number of floating point operations for
a yaw drift correction cycle
2013-05-05 13:51:45 +10:00
Randy Mackay ee2daf25b6 AHRS: perf improvement by caching declination vector 2013-05-05 12:58:43 +10:00
Andrew Tridgell 943a1d8c8d AP_AHRS: added AHRS_GPS_MINSATS option
if the number of visible satellites is below AHRS_GPS_MINSATS then
don't use the GPS for acceleration correction for attitude
2013-05-05 12:48:01 +10:00
Andrew Tridgell 811c2ccc11 libraries: fixes for AP_Baro_HIL 2013-05-02 15:09:05 +10:00
Andrew Tridgell 54b826a583 AP_AHRS: update for new compass API 2013-05-02 12:48:14 +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 f5d6fb6216 AP_AHRS: added _kp gain reduction for catapult launch
this should reduce the tendency of aircraft to nose down hard on
initial launch at high g
2013-04-28 14:47:59 +10:00
Andrew Tridgell fd2cd0d1c2 DCM: fixed formatting 2013-04-23 08:57:44 +10:00
jschall 610069e729 DCM: fixed airspeed bug
we incorrectly went via the wind estimate when we had a working airspeed sensor
2013-04-23 08:57:44 +10:00
Andrew Tridgell 014c9376e7 AP_AHRS: use const references where possible 2013-04-22 13:26:49 +10:00
Andrew Tridgell 7ad293e270 AP_AHRS: made a few methods const 2013-04-20 13:52:36 +10:00
Andrew Tridgell a4d25f5a82 AHRS: removed AHRS_BARO_USE option
this option has caused users too much trouble. The vertical velocity
is too noisy from the baro
2013-04-15 10:52:31 +10:00
Andrew Tridgell 87b0fb05ce AHRS: changed default RP and YAW gain to 0.3
this reduces the impact of hard acceleration on takeoff, and reduces
the impact of GPS lag

Note that this doesn't affect copters, as they override to 0.1
2013-04-15 10:52:31 +10:00
priseborough b63d0969b7 AP_AHRS: Addition of a first order complementary filter to AP_AHRS::groundspeed_vector
Addition of a complementary filter to estimation of the ground velocity vector for use by the L1-nav
2013-04-12 12:48:09 +10:00
Andrew Tridgell 05ecb8d8fa AP_AHRS: fixed functions that need to be virtual
functions overridden in a child class need to be marked virtual, or
you get the parent class function
2013-04-12 12:48:08 +10:00
Andrew Tridgell ee81b0f729 AP_AHRS: added wind_correct_bearing() and groundspeed_vector()
these are very useful for navigation libraries
2013-04-12 12:48:08 +10:00
Andrew Tridgell 896fd52aa1 AP_AHRS: fixed functions that need to be virtual
functions overridden in a child class need to be marked virtual, or
you get the parent class function
2013-03-29 18:35:10 +11:00
Andrew Tridgell 8459da202c AP_AHRS: prevents compass flyaways for plane and rover
this switches to the GPS for yaw if the compass has dragged us off by
more than 45 degrees from the GPS heading, and the wind speed is less
than 80% of the ground speed.
2013-03-29 13:48:25 +11:00
Randy Mackay 24044dc0c4 AHRS: add support for GPS fix type 2D 2013-03-27 11:41:43 +09:00
Randy Mackay 3321db8dde AHRS: limit trim to 10 degrees 2013-02-19 18:50:57 +09:00
Andrew Tridgell 6119201307 AP_AHRS: ensure compass is non-NULL for set_board_orientation() 2013-01-17 17:23:34 +11:00
James Bielman 5631f865b2 Update floating point calculations to use floats instead of doubles.
- Allows use of hardware floating point on the Cortex-M4.
- Added "f" suffix to floating point literals.
- Call floating point versions of stdlib math functions.
2013-01-16 13:52:01 +11:00
Andrew Tridgell f644a356c9 AP_AHRS: document more rotation combinations 2013-01-13 17:32:48 +11:00
Andrew Tridgell 848fc3e32d AP_AHRS: added AHRS_ORIENTATION parameter 2013-01-13 17:32:48 +11:00
rmackay9 9e5861ccaf AP_AHRS: small fix to parameter comments 2013-01-02 16:08:38 +09:00
rmackay9 77331f6538 AP_AHRS: another attempt at updating the TRIM parameter descriptions 2013-01-02 15:47:59 +09:00
rmackay9 e6c10f4f0b AP_ARHS: add description to AHRS_TRIM parameters 2013-01-02 15:44:42 +09:00
Andrew Tridgell 374af1cd14 build: change from Arduino.mk to apm.mk 2013-01-02 17:29:37 +11:00
Andrew Tridgell 3ac3aeb1b1 AHRS: fixed build on ARM 2013-01-02 14:45:09 +11:00
Andrew Tridgell 583845cc17 ahrs fixup 2013-01-02 14:45:08 +11:00
Andrew Tridgell 1b0670e67c AHRS: fixup for ARM compiler 2013-01-02 14:45:08 +11:00