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
Paul Riseborough
08267cea87
AP_AHRS: Scheduling for yaw gain to reduce atitude errors in turning flight
2014-02-15 05:48:22 +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
Randy Mackay
6946d68318
AHRS_DCM: call update_trig
2014-02-08 18:16:42 +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
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
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
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
587fb58720
AP_AHRS: fixed license text
...
APM is under GPL, not LGPL
2013-08-30 13:01:32 +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
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
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
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
14628990e6
AP_AHRS: make wind estimation configurable
...
rover doesn't want it
2013-05-24 11:21:42 +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
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
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
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
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
3ac3aeb1b1
AHRS: fixed build on ARM
2013-01-02 14:45:09 +11:00
rmackay9
1c08f176ea
AP_AHRS: add get_accel_ef method to return earth frame accelerometer values for use in ArduCopter's inertial nav and accel based throttle
2013-01-02 09:11:25 +11:00
Andrew Tridgell
ceb3f577d8
libraries: use new math functions
2012-12-20 14:53:22 +11:00
Andrew Tridgell
8b6ad6d559
SITL: removed SITL_debug()
...
not needed any more
2012-12-20 14:51:36 +11:00
Andrew Tridgell
5840ded767
AHRS: removed constrain() defines
2012-12-20 14:51:34 +11:00
Pat Hickey
9bf69d4e0d
AP_AHRS: port to AP_HAL
2012-12-20 14:51:29 +11:00
Andrew Tridgell
8561f08b2f
AP_AHRS: prevent a large delta_t from affecting DCM solution
...
this should fix large changes in attitude directly after arming
ArduCopter
2012-11-13 15:33:10 +11:00
rmackay9
83ae8e47be
AP_AHRS: replace IMU with INS and add roll and pitch trim
2012-11-07 19:20:32 +09:00
Andrew Tridgell
fe47990dab
AP_AHRS: removed the 6 sats min
...
this would put us into dead-reckoning mode
2012-11-06 14:26:49 +11:00
Andrew Tridgell
6a24bdec05
AP_AHRS: require at least 6 satellites to use the GPS for velocity
...
logs of a recent flight show the velocity estimate can be very poor if
the GPS can see 5 satellites or less
2012-11-05 20:07:37 +11:00
Andrew Tridgell
ea40432235
AP_AHRS: use GPS vertical velocity when available
2012-11-05 14:58:40 +11:00
Andrew Tridgell
00bf548f87
AHRS: limit wind speed estimate changes
...
sudden yaw changes can cause bad wind estimates
2012-10-11 11:51:24 +11:00
Andrew Tridgell
ccf8ba3ce9
DCM: limit the contribution of the baro to vertical acceleration
...
limit to a max of 0.5g
2012-09-20 17:34:32 +10:00
Andrew Tridgell
fba1692d69
AHRS: added AHRS_BARO_USE parameter
...
allow disabling of the use of the barometer for vertical acceleration
compensation
2012-09-12 14:42:04 +10:00
Andrew Tridgell
de28cc8b28
AHRS: added AHRS_WIND_MAX option
...
this allows APM to cope better with airspeed sensor failure, but
ensuring airspeed stays within AHRS_WIND_MAX of ground speed
2012-09-08 11:37:07 +10:00
Andrew Tridgell
2be785899b
AHRS: added airspeed_estimate() function
...
this allows the APM code to use an airspeed estimate for navigation
2012-08-25 17:49:26 +10:00
uncrustify
31a4442904
uncrustify libraries/AP_AHRS/AP_AHRS_DCM.cpp
2012-08-21 19:19:51 -07:00
Andrew Tridgell
134cd51d17
AHRS: moved var_info[] into top level AP_AHRS class
2012-08-21 15:58:09 +10:00
Andrew Tridgell
ac72db8f00
AHRS: added set_fast_gains() method
...
this will be used by arducopter on the ground
2012-08-21 15:38:06 +10:00
Andrew Tridgell
14cdbd36cb
AHRS: check for bad values in the error before they can affect DCM
...
this should fix the DCM renorm errors in autotest, probably caused by
bad climb rates
2012-08-18 13:54:11 +10:00
Andrew Tridgell
d9cc967508
AHRS: force an extra read of the compass on startup
...
the first read from the compass can be bad. This ensures we have a
good value when getting the initial AHRS yaw.
Thanks to Randy and Jason for the bug report!
2012-08-17 17:57:39 +10:00
Andrew Tridgell
19a5d11669
AHRS: use airspeed for wind in forward flight
...
when not turning we can use the airspeed sensor directly to calculate
the wind speed.
2012-08-12 10:54:25 +10:00
Andrew Tridgell
f5b7ae213c
AHRS: added AHRS_GPS_USE parameter
...
this allows for the GPS to be disables for position updates, which
allows for testing dead-reckoning
2012-08-11 22:06:03 +10:00
Andrew Tridgell
779dacfd24
AHRS: added wind estimation code
...
this allows us to estimate the wind while we have GPS lock, then use
that estimate in the long term dead reckoning
2012-08-11 22:06:03 +10:00
Andrew Tridgell
af4071894e
AHRS: added long-term dead-reckoning
...
this uses airspeed (if available) or last GPS ground speed to update
our position estimate in AHRS
2012-08-11 12:00:31 +10:00
Andrew Tridgell
898a5af692
AP_Param: update AHRS for new constructor syntax
2012-08-08 12:11:57 +10:00
rmackay9
468170b589
AP_AHRS_DCM: moved var_info to belong to AP_AHRS_DCM instead of AP_AHRS
2012-07-28 14:16:15 +09:00