Commit Graph

146 Commits

Author SHA1 Message Date
masierra 8fc494cfcd AP_AHRS_DCM: changed estimate to use prev values for dir & vel 2016-06-06 15:26:51 -07:00
Ricardo de Almeida Gonzaga 2bf9aa94ad AP_AHRS: Fix typos 2016-05-13 19:20:06 -03:00
dgrat 6d3b491c02 AP_Math: Replace is_equal with a type safe template function
It makes sense to consider also other floating point types.
2016-05-10 11:41:26 -03:00
dgrat 41661f815f AP_Math: Replace the pythagorous* functions with a variadic template
The new function can deal with a variable number of function parameters.
Additionally, I renamed the functions to norm(), because this is the
standard name used in several other projects.
2016-05-10 11:41:26 -03:00
Caio Marcelo de Oliveira Filho 55e61538b3 AP_AHRS_DCM: use millis/micros/panic functions 2015-11-20 12:28:45 +09:00
Lucas De Marchi da86e29c27 AP_AHRS: remove check for AVR CPUs
Remove the checks for HAL_CPU_CLASS > HAL_CPU_CLASS_16 and
HAL_CPU_CLASS >= HAL_CPU_CLASS_75. Corresponding dead code will be
removed on separate commits.
2015-11-04 12:14:14 +11:00
Andrew Tridgell 79d85f7e10 AP_AHRS: wait for up to 10 samples to get a valid accel vector
the initial accel vectors can be invalid
2015-10-21 09:09:11 +11:00
Jonathan Challinger c35605fa04 AP_AHRS_DCM: align tilt during initialization 2015-10-21 08:34:02 +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 06c0ad987e AP_AHRS: fixed divide by zero in SITL
fixes issue#2875
2015-09-24 16:49:22 +10:00
Andrew Tridgell 0677c2c80c AP_AHRS: run astyle for formatting 2015-09-23 17:31:00 +10:00
Staroselskii Georgii 4b948f5bb1 AP_AHRS: make DCM use milligauss 2015-09-09 10:38:16 +10:00
Randy Mackay 7f46cc9059 AHRS_DCM: integrate INS use_accel 2015-08-19 16:44:19 +09: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
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
Andrew Tridgell 7a76f72bf5 AP_AHRS: added uptime_ms() interface 2015-05-20 15:22:14 +10: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
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 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 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
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 585a105128 AP_AHRS: use compass->last_update_usec() 2015-03-14 12:31:50 +11:00
Andrew Tridgell 68f64fa11c AP_AHRS: make the healthy() method const 2015-02-01 14:13:52 +11:00
Andrew Tridgell ed0a56cc3c AP_AHRS: cope with the changed semantics of airspeed.use() 2015-01-20 11:27:58 +11:00
Jonathan Challinger 4975cefd84 AP_AHRS_DCM: update _accel_ef_blended 2014-12-05 19:40:06 +09:00
Randy Mackay dffcfb42bc AHRS: add reset_gyro_drift method 2014-10-28 20:25:33 +09: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 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
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
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 6a275372dd AP_AHRS: ensure get_position() fills in flags 2014-07-25 11:40:16 +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 4d24a86088 AP_AHRS: prevent a infinity value 2014-04-21 15:37:07 +10:00
Andrew Tridgell f07e4dee52 AP_AHRS: convert to new GPS API 2014-04-01 06:38:24 +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
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
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
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