Commit Graph

152 Commits

Author SHA1 Message Date
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
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 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
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 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 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 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
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
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
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 4f82134a5e DCM: use the new rotate() method from AP_Math
this allows us to use a tested and optimised rotation method
2012-03-19 17:29:02 +11:00
Andrew Tridgell d4bb068d5b AHRS: adapt the DCM library to the AHRS framework 2012-03-19 17:29:02 +11:00
Andrew Tridgell 9d75ffeba1 AHRS: rename DCM and Quaternion implementions ready for AHRS class
this is the first step to creating a general AHRS class for ArduPilot
2012-03-19 17:29:01 +11:00