Commit Graph

358 Commits

Author SHA1 Message Date
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
rmackay9 bd0e018ca0 ArduCopter: restore auto-trim method but now use AHRS.add_trim 2013-01-02 09:20:08 +11:00
rmackay9 1f7614929f AP_AHRS: save trim to eeprom when set_trim is called 2013-01-02 09:12:17 +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 e282554035 AHRS: removed some debug code 2012-12-20 14:53:23 +11:00
Andrew Tridgell ceb3f577d8 libraries: use new math functions 2012-12-20 14:53:22 +11:00
Pat Hickey eb530b86e8 move Arduino.mk to /mk/Arduino.mk 2012-12-20 14:52:35 +11:00
Andrew Tridgell fc66f5594f AHRS: allow AHRS test to build with SITL 2012-12-20 14:52:34 +11:00
Andrew Tridgell 7d27e420ae AP_HAL: remove unnecessary Arduino.h includes 2012-12-20 14:52:30 +11:00
Andrew Tridgell 5c148153ac AP_AHRS: updates for new AP_Param API 2012-12-20 14:51:38 +11:00
Pat Hickey 475da4eca4 CONFIG_HAL_BOARD - test sketches fixed up, build all passes 2012-12-20 14:51:37 +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
Andrew Tridgell 09e7b0b592 AHRS: removed unused variable 2012-12-20 14:51:34 +11:00
Pat Hickey 70f34656bc AP_AHRS: uart1 -> uartB fixup 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
Pat Hickey 3f1d9d7f69 AP_Param: #include <AP_Param.h> fixups for libraries & sketches
* I mostly went through with grep and added an #include <AP_Param.h> below
  every #include <AP_Common.h>. Not all of these example sketches might
  strictly need AP_Param.
2012-12-20 14:51:19 +11:00
rmackay9 24317e721b AC_PID, AP_AHRS: added descriptions to some parameters 2012-12-10 22:28:39 +09:00
Andrew Tridgell 51080d3e9e AHRS: update example for new ins interface 2012-11-30 07:15:19 +11:00
Andrew Tridgell 1dad9e4e94 AHRS: improved some more doc strings 2012-11-27 15:56:53 +11:00
Andrew Tridgell eb1d5c2c68 AHRS: improved docs for AHRS_GPS_USE
some people are setting this to zero to prevent jitter, which results
in their plane flying off into the distance and never coming back
2012-11-27 15:41:52 +11:00
Andrew Tridgell 5a214acca3 AHRS: changed the docs for AHRS_YAW_P and AHRS_RP_P
a user had set AHRS_YAW_P to zero. Make it clear that zero is not a
good value. MichaelO will change MP to give a warning for a value
below 0.1
2012-11-19 22:50:05 +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 56f88821e9 AP_AHRS: fix example sketch
AP_Airspeed: fix example sketch
AP_Baro: fix example sketch
AP_Declination: fix example sketch
AP_Math: fix example sketch
2012-11-08 00:08:18 +09: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
rmackay9 9e3824a09b AP_AHRS: fix compile error in example sketch 2012-11-01 21:56:34 +09: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
rmackay9 e33d314f1d AP_AHRS_MPU6000: resolve compiler warning re shadowing 2012-10-06 13:22:43 +09:00
rmackay9 670fcbb634 AP_AHRS_MPU6000: fixed yaw correction and added _secondary_ahrs parameter
_secondary_ahrs parameter allows mpu6000 ahrs to runin parallel with DCM.
2012-09-30 00:21:18 +09:00
rmackay9 8c6fd340d7 AP_AHRS: added scheduler parameter to init
Required by the AP_AHRS_MPU6000 class which needs to disable timed processes that could interfere with it's communication with the mpu6000
2012-09-29 13:51:21 +09:00
rmackay9 41fbb19cf5 AP_InertialSensor_MPU6000: replaced _cs_pin parameter with #define and saved 1 byte of memory
Updated ArduCopter, ArduPlane and example sketches in AP_InertialSensor, AP_IMU and AP_AHRS libraries because they no longer need to pass in cs_pin to the constructor
2012-09-28 19:21:59 +09: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 458a42654b DCM: disable use of baro for vertical accel by default
this has caused problems with too many users
2012-09-20 17:34:32 +10:00
Michael Oborne 94f956a0ca fix AP attitude hil - with randys help 2012-09-15 16:47:18 +08:00
rmackay9 1c9fe3b1b6 AP_AHRS: fix to allow example sketch to compile 2012-09-13 16:45:52 +09: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
Andrew Tridgell 8b53f1272a AHRS: new functions to support APM_Control library 2012-08-22 12:42:37 +10:00
uncrustify e17fcbd9cb uncrustify libraries/AP_AHRS/AP_AHRS_HIL.h 2012-08-21 19:19:51 -07:00
uncrustify af588679b9 uncrustify libraries/AP_AHRS/AP_AHRS.h 2012-08-21 19:19:51 -07:00
uncrustify 8c0e4f3987 uncrustify libraries/AP_AHRS/AP_AHRS_MPU6000.h 2012-08-21 19:19:51 -07:00
uncrustify bc80148c75 uncrustify libraries/AP_AHRS/AP_AHRS_DCM.h 2012-08-21 19:19:51 -07:00
uncrustify 31a4442904 uncrustify libraries/AP_AHRS/AP_AHRS_DCM.cpp 2012-08-21 19:19:51 -07:00
uncrustify d6d7606c84 uncrustify libraries/AP_AHRS/AP_AHRS_HIL.cpp 2012-08-21 18:59:34 -07:00
uncrustify 9e4e08699d uncrustify libraries/AP_AHRS/AP_AHRS_MPU6000.cpp 2012-08-21 18:59:34 -07:00
uncrustify 6327305116 uncrustify libraries/AP_AHRS/examples/AHRS_Test/AHRS_Test.pde 2012-08-21 18:59:13 -07:00
Andrew Tridgell 6d28b3519f AHRS: removed AP_AHRS_Quaternion
this AHRS backend is causing compiler errors with the Arduino build
environment on windows. The quaternion AHRS backend is currently not
being developed/supported anyway. We can resurrect it if someone wants
to start developing it again.
2012-08-22 10:41:31 +10:00
Andrew Tridgell 2985de279f AHRS: fixed duplicate gps_use variable in DCM 2012-08-21 20:17:03 +10: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 73dcbc24c3 Quaternion: we no longer support acceleration in the GPS driver
remove the linear acceleration compensation code
2012-08-15 20:07:53 +10:00
Andrew Tridgell 9b4b7997b6 AHRS: added ahrs.yaw_initialised()
this allows the high level code to know if the AHRS driver has a
reliable yaw estimate
2012-08-15 12:39:34 +10:00
Andrew Tridgell 48e275e22d AHRS: avoid a compiler bug in quaternion code
Having _wind in the AP_AHRS class causes a register allocation error
when building the Quaternion code with some versions of avr-gcc. Quite
bizarre.
2012-08-13 11:08:10 +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 f95b06a880 AHRS: make airspeed sensor available to AHRS
this will be used for long term dead-reckoning
2012-08-11 08:57:32 +10:00
Andrew Tridgell b01907cf23 ACM: fixed HIL build 2012-08-11 08:34:16 +10:00
Jason Short 52b2aacf28 AHRS DCM: FOrmatting 2012-08-09 16:59:43 -07:00
Andrew Tridgell 898a5af692 AP_Param: update AHRS for new constructor syntax 2012-08-08 12:11:57 +10:00
rmackay9 0eaf427062 AP_AHRS_MPU6000: cleaning up compiler warning due to unused yaw_deltat variable 2012-07-28 16:23:25 +09:00
rmackay9 1b521a9f73 AP_AHRS: updated test sketch to allow use of MPU6000's DMP 2012-07-28 14:27:26 +09:00
rmackay9 dbe7c8ed1a AP_AHRS_MPU6000: first draft implementation of class that uses MPU6000's DMP to calculate attitude 2012-07-28 14:17:38 +09:00
rmackay9 b844bb7919 AP_AHRS: removed var_info from AP_AHRS class (moved to AP_AHRS_DCM) 2012-07-28 14:16:56 +09: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
Jonathan Challinger 9cd98e79dd AHRS: normalise GA_b before computing error vector only if too large
When GA_b is small the direction of the vector is unreliable, so
normalising can exacerbate the error in the direction
2012-07-23 17:16:50 +10:00
Andrew Tridgell 5f5ab9c07c AHRS: if we don't have gps correction enabled, zero the yaw correction 2012-07-20 17:21:04 +10:00
Andrew Tridgell c937738732 AHRS: allow the gps/accelerometers to control yaw when rolled
this solves a problem with yaw estimation when at high roll angles,
when the compass code becomes ineffective
2012-07-20 11:50:04 +10:00
Michael Oborne a469682b7b fix param config names 2012-07-14 15:34:15 +08:00
Andrew Tridgell 165604a55c AHRS: fixed HIL build 2012-07-10 18:02:05 +10:00
Andrew Tridgell 0f9fb2c64b AHRS: added AHRS_GPS_GAIN parameter
this allows control of how much GPS velocity information is used in
doing centripetal correction in DCM
2012-07-10 16:22:48 +10:00
Andrew Tridgell 302696951a AHRS: make the yaw independent drift correction optional and disable
the new correction algorithm copes poorly with gyro drift, leading to
signification attitude errors in the face of drift
2012-07-06 15:11:30 +10:00
Andrew Tridgell 8c5ef3e60f AHRS: only enable barometer for AHRS if it is smooth enough
if we used less than 5 samples to compute the pressure then don't use
it for climb rate
2012-07-05 16:29:21 +10:00
Andrew Tridgell 2cd6da2539 AHRS: only use GPS for yaw when compass is not being used
this avoids having two competing controllers
2012-07-05 13:00:46 +10:00
Andrew Tridgell adfa97b6f8 AHRS: enable barometer for vertical velocity
this re-enables the barometer for vertical velocity information
for drift correction, now that we have a better filter
on the climb rate
2012-07-05 13:00:46 +10:00
rmackay9 faeda3713e AP_AHRS: removed DCM_test example sketch
No longer required because it doesn't compile and is redundant anyway because the AP_AHRS_DCM class is tested in the AHRS_Test example sketch.
2012-07-04 18:22:51 +09:00
Andrew Tridgell 3849ca8b5c AHRS: make DCM drift correction not rely on accurate yaw
this uses a new formulation of the GPS based drift correction from
Bill Premerlani that rotates the error vector to avoid relying on
accurate yaw. This means we should get accurate roll/pitch correction
even with lots of magnetometer interference

It also makes it possible to fly a multicopter with no compass. It can
even navigate and correct yaw (slowly!)
2012-07-04 17:00:40 +10:00
Andrew Tridgell 1314e4f872 AHRS: make P gain on PI roll/pitch controller tunable
this is to make it easier for Craig and Alan to tune
2012-07-04 12:42:46 +10:00
Andrew Tridgell 136c03c3c0 AHRS: include the P terms in get_gyro()
this makes it more useful for navigation controllers
2012-06-29 21:54:09 +10:00
Andrew Tridgell 16c55c64d4 AHRS: don't add the P terms in _omega
this can lead feedback via the _P_gain()
2012-06-29 15:10:51 +10:00
Andrew Tridgell 37fc6c46b9 AHRS: disable barometer for vertical acceleration
this seems to have been the cause of the 'flips' seen by Marco and
others. Testing by Craig and Alan shows that the flips are gone when
the barometric acceleration is removed.

It looks like a 5 point average filter is not enough to keep the
vertical acceleteration noise low. With high noise in the z axes, the
x and y axes are scaled back when the ge vector is normalised.
2012-06-28 11:12:49 +10:00
Andrew Tridgell 58c4d458dc AHRS: re-instate new DCM drift correction code
This reverts commit 078489638d47fbaffde7c51249e36b5a8fc4ef9d.
2012-06-28 11:09:22 +10:00
Andrew Tridgell fd241692d0 AHRS: revert to the old drift correction algorithm
we need to work out why Craigs quad flipped today before we enable
this new drift correction
2012-06-27 18:16:41 +10:00
Andrew Tridgell 8e044a560b AHRS: include P term in omega
thanks to Jon for suggesting this
2012-06-27 16:01:50 +10:00
Andrew Tridgell 37e2f2ee2c AHRS: implement spin rate limits
this follows the method that Bill developed in his fastRotations
paper. We've demonstrated that this is indeed needed in APM, as we
were able to produce the 'dizzy' effects in both the ArduPlane and
ArduCopter simulator
2012-06-27 16:01:50 +10:00
Andrew Tridgell e4a245179c AHRS: cope with copters with no compass
if a copter doesn't have a compass, we can't use the GPS for gyro
drift correction
2012-06-27 16:01:50 +10:00
Andrew Tridgell 3a41ad8e7c AHRS: normalize the ge vector in drift correction, and use barometer
The normalisation ensures the error term scales uniformly with
different accelerations.

The barometer is used for vertical acceleration estimation
2012-06-27 16:01:50 +10:00
Jonathan Challinger d230690b7b AHRS: brought DCM more inline with Bill's implementation
omega_I applied continuously. _ki larger. Stop integrating when _omega.length()>20

The key change was the scaling of ge to ensure the error is not
quadratic
2012-06-27 16:01:49 +10:00
Andrew Tridgell d4c8041c51 AHRS: first successful version of Bills new drift correction system
This makes 3 major changes:

 1) fixes the scaling of the yaw drift correction term to fix the time
 constant

 2) don't integrate the mag vector over multiple readings

 3) accumulate omega_I changes over 15 seconds before applying, to try
 to prevent omega_I picking up short term responses
2012-06-27 16:01:49 +10:00
Andrew Tridgell 4d08f75292 AHRS: update for new _fly_forward flag 2012-06-27 16:01:49 +10:00
Andrew Tridgell 0f5c22bd8e AHRS: implement Bills new drift correction algorithm
this is an initial implementation of this paper:

  http://gentlenav.googlecode.com/files/RollPitchDriftCompensation.pdf
2012-06-27 16:01:49 +10:00
Andrew Tridgell 52d77407d4 AHRS: added GPS support to AHRS test 2012-06-27 16:01:49 +10:00
Andrew Tridgell f274df454a DCM: fixed a bug when using GPS for yaw correction
When using GPS for yaw correction we need to apply the x and y omegaI
corrections from the _omega_I_sum in the period before we get to the
minimum ground speed for GPS yaw correction. Otherwise we get a large
sudden omega_I change on takeoff.
2012-05-21 12:15:06 +10:00
rmackay9 6e1798b104 AP_AHRS: updated default AHRS_YAW_P to 0.2 (was 0.4)
This reduces the compass's default authority over the yaw direction by half
2012-04-30 17:29:45 +09:00
Adam M Rivera 3309dec205 AP_AHRS_DCM.cpp: Added comments that follow the new parse structure 2012-04-25 12:00:42 -05:00
Andrew Tridgell 2a3af369b6 DCM: buffer omega_I changes over 10 seconds
this buffers up _omega_I changes in _omega_I_sum over a period of 10
seconds, applying the slope limit only when _omega_I_sum is
transferred to _omega_I.

The result is a huge improvement in the ability of _omega_I to track
gyro drift over the long term.
2012-04-23 12:13:25 +10:00
Andrew Tridgell f27d85cb8d DCM: drop the 'drop z' method
the 'drop z' method reduced the impact of noise on omegaI, but it also
made us more sensitive to errors in accelerometer calibration and
scaling, as demonstated by the logs from Gabor here:

  http://diydrones.com/xn/detail/705844:Comment:834373

Simulation testing shows that the other noise suppression methods
applied in the DCM code, in particular the slope limiting on omegaI
the removal of the weighting and the upcoming use of a _omega_I_sum
buffer have reduced the impact of noise enough that we can now safely
include z in the acceleration calculation.
2012-04-23 12:13:24 +10:00
Adam M Rivera b500d9430f AP_AHRS_HIL.h: Fixed HIL build by adding missing public property. 2012-04-16 10:26:14 -05:00
Andrew Tridgell 8e90aeea4e AHRS: added AHRS_YAW_P parameter
this allows users to change the yaw gain in DCM
2012-04-16 20:55:13 +10:00
rmackay9 c96dfb2108 AP_AHRS - changed parameter order to remove compiler warning 2012-04-09 17:37:11 +09:00
Andrew Tridgell b549b88e5e AHRS: fixed error_yaw reporting with 2 MAVLink connections
when a user first connects with USB, and later switches to the
telemetry port without restarting we were getting zero for error_yaw
in the logs, as AHRS.get_error_yaw() was being called twice.

This ensures we give the last value after the counter is reset
2012-03-29 12:39:53 +11:00
Andrew Tridgell f4d1295a4b AHRS: fixed build of AHRS example 2012-03-22 23:00:45 +11:00