Razor-AHRS / razor-9dof-ahrs

AHRS Firmware for the SparkFun 9DOF Razor IMU and SparkFun 9DOF Sensor Stick
Other
450 stars 264 forks source link

Yaw rate lag / inaccuracy #7

Open pwbecker opened 10 years ago

pwbecker commented 10 years ago

I am using a Razor on a model aircraft, and find that in a tight turn, using the Euler angles, the yaw is not updated rapidly enough. I plotted Course over ground from the GPS vs Yaw from the Razor, as attached.

Note that COG and Yaw should NOT be identical due to slippage and wind speed, but the graph of COG shows two full circles, while yaw does not rotate fully even once. (the x axis is milliseconds).

Can this be improved, or is the magnetometer inherently slow?

image

pwbecker commented 10 years ago

A noticable feature of the graph is that the roll angle seems to low for such a tight bank. To try and replicate this issue, I held the razor at arms length, at a constant roll (tilt) angle of about 30 degrees, and swung it vigourously is a semi-circle, back and forth.

When doing this, the roll angle varied from about 90 degrees to 0 degrees, depending on where in the cycle it was. This explains why, although I limit the bank angle to 20 degrees, the aircraft ends up banking much more sharply than that, perhaps at about 45 degrees. It seems like the centripedal/fugal force is throwing out the accelerometer, making it under-read.

Is there any way to tweak the maths code to improve this?

PS: I will try recalibrating the Razor in-situ and post here if that changes anything.

pwbecker commented 10 years ago

Recalibrating did not help. (in situ extended calibration).

Further testing showed that powering up the brushless motor caused a drift in yaw of up to 90 degrees. The motor is 44cm from the Razor - as far as I can get it. However its next to the battery - its hard to get things too far apart on a small plane!

Is there any way to shield it, or is a magnetometer just not going to work near a high power brushless motor?

pwbecker commented 10 years ago

I have learnt that it is necessary to compensate yaw dynamically based on throttle. I don't think I think this can be done ouside the AHRS code by adding a dynamic offset, because the distortion will be in a specific axis.

So it seems that for this code to be used on an aircraft, the throttle setting must be fed to the code on the Razor, and that must be used to adjust the magnetometer reading before the calculations are done.

Any comment Peter?

tel001 commented 10 years ago

The standard response to engine torque?

On Mon, Dec 23, 2013 at 10:37 PM, pwbecker notifications@github.com wrote:

I have learnt that it is necessary to compensate yaw dynamically based on throttle. I don't think I think this can be done within the AHRS code, because the distortion will be in a specific axis.

So it seems that for this code to be used on an aircraft, the throttle setting must be fed to the code on the Razor, and that must be used to adjust the magnetometer reading before the calculations are done.

Any comment Peter?

— Reply to this email directly or view it on GitHubhttps://github.com/ptrbrtz/razor-9dof-ahrs/issues/7#issuecomment-31160728 .