SignalK / signalk-imu

An IMU (e-compass) that outputs signalk.
Apache License 2.0
4 stars 1 forks source link

Tips for debugging IMU Calibration? #3

Open ph1l opened 6 years ago

ph1l commented 6 years ago

I built and hooked up a signalk IMU as described in this repo. While my boat is berthed I would expect it's magnetic heading to come out at about 240 deg accounting for the declination for my area. If yaw is measured in radians counterclockwise from magnetic north, I expect a yaw (and headingMagnetic) value of ~ 2.09r ( (360-240) * (math.pi/180.0) .)

The headingMagnetic and yaw are consistently around ~2.91r

navigation.attitude: P:0.05910696 R:-0.04054242 Y:2.9157207

Additionally, I expect to see the pitch and roll varying from negative to positive values as the boat bounces around slightly in it's slip.

headingmagnetic

rob42 commented 6 years ago

Did you calibrate it by waving about in a figure 8 pattern? You need to do this very close to where you mount it. You need to make sure there are no magnetic sources within 1 m - I was surprised to find my samsung tablet had powerful magnets in one edge! Anything magnetic or electircal will have a magnetic field.

Try moving it a meter or more. Also: Do you get a range of values if you manually move the IMU around 360deg? Does it show pitch/roll if you move it manually?

ph1l commented 6 years ago

Okay, I was able to understand what's going on, the device was just upside down and pointed in the wrong direction. I guess I had assumed that "calibration" meant that you could mount it in any orientation. That does not seem to be the case.

Would it be possible to "tare" or "Zero" the device? So that exact mounting would be irrelevent?

After much fiddling, this is the closest I got to Zero:

navigation.attitude: P:0.02525085 R:0.00798179 Y:4.18864632

4.18864632*(180/math.pi) = 239.99175600900367 :+1:

And as a followup, it seems that Yaw on the device reads out in radians clockwise from north, right?

rob42 commented 6 years ago

yes. Yaw = heading,= radians clockwise. Most chartplatters or signalk servers should offer a 0 adjust for the compass.

Orientation actually can be a bit random. It seems to depend on the startup and calibration, all of which is best done after 5-10 minutes warmup. Ive noticed a few anomalies, but cant pin down enough for a bug yet. I normally get 0deg across the board, but Ive seen it occasionally be along the board! Not sure what causes that, it could be unique to my location ( nav station, extends under a settee in the bridgedeck). Ive seen other wierdness from my GPS - it loses signal if a 'large' person sits above it, but its fine with most people!

In my case I either reboot it, wave it about a bit, or just turn it 90deg, since its only held down with blutack. If you get the same effects more data would be nice.

ph1l commented 6 years ago

I'll try to log it for a while and see if I notice anything:

sigmalk-imu-graphs

ph1l commented 6 years ago

sigmalk-imu-graphs