Commit Graph

60 Commits

Author SHA1 Message Date
Andrew Tridgell 44852276da 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 562069cbd7 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 fa1b72adc5 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 3a92509b18 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 2c7ab7c659 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 708280511c 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 e48b0f8558 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 d3cc6e5fab ACM: fixed HIL build 2012-08-11 08:34:16 +10:00
Jason Short 4e001286a6 AHRS DCM: FOrmatting 2012-08-09 16:59:43 -07:00
Andrew Tridgell 7be604cffd AP_Param: update AHRS for new constructor syntax 2012-08-08 12:11:57 +10:00
rmackay9 9a558be53e AP_AHRS_MPU6000: cleaning up compiler warning due to unused yaw_deltat variable 2012-07-28 16:23:25 +09:00
rmackay9 a49454e905 AP_AHRS: updated test sketch to allow use of MPU6000's DMP 2012-07-28 14:27:26 +09:00
rmackay9 0820ebddb9 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 5a9211c278 AP_AHRS: removed var_info from AP_AHRS class (moved to AP_AHRS_DCM) 2012-07-28 14:16:56 +09:00
rmackay9 c2b47d2bf9 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 21f0ed00b3 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 5f5c884a6d AHRS: if we don't have gps correction enabled, zero the yaw correction 2012-07-20 17:21:04 +10:00
Andrew Tridgell 4f41b876b1 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 804898c2a5 fix param config names 2012-07-14 15:34:15 +08:00
Andrew Tridgell 15133b1105 AHRS: fixed HIL build 2012-07-10 18:02:05 +10:00
Andrew Tridgell 9b6acf168e 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 9845a55cb1 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 e33554a1f9 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 9d7ed30023 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 6653c0b874 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 cac0757c2e 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 03516b7dfa 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 e0685f4408 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 b5aa821071 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 37494dda2b 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 21ae2957fb 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 e531061caa AHRS: re-instate new DCM drift correction code
This reverts commit 078489638d47fbaffde7c51249e36b5a8fc4ef9d.
2012-06-28 11:09:22 +10:00
Andrew Tridgell 8600ad8d7f 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 ce016b5ae8 AHRS: include P term in omega
thanks to Jon for suggesting this
2012-06-27 16:01:50 +10:00
Andrew Tridgell 0fa1f29cf3 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 3ffecc18d8 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 5370f9c411 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 1ff9461bfb 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 73faaddc1b 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 0399aa9480 AHRS: update for new _fly_forward flag 2012-06-27 16:01:49 +10:00
Andrew Tridgell 2600afe18a 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 5316a45c20 AHRS: added GPS support to AHRS test 2012-06-27 16:01:49 +10:00
Andrew Tridgell 8f27297896 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 3b2d203f0f 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 b1f19dbb01 AP_AHRS_DCM.cpp: Added comments that follow the new parse structure 2012-04-25 12:00:42 -05:00
Andrew Tridgell 6d837891b0 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 398a608b83 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 2c8cd0b07b AP_AHRS_HIL.h: Fixed HIL build by adding missing public property. 2012-04-16 10:26:14 -05:00
Andrew Tridgell a9de75156b 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 4dac4c4c11 AP_AHRS - changed parameter order to remove compiler warning 2012-04-09 17:37:11 +09:00