This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Heading values changing wildly
#1
I've just put my autopilot back together for some nice Australian summer cruising.  Everything works except for the heading value, which changes wildly:



The boat is stationary.  The IMU is an MPU9255, visible in the box on the right hand side.  The yellow cap is up, and facing the front of the boat.  

I'm using tinypilot_21122019.img.xz (I don't have the hardware for newer versions).

I first tried the IMU I used last year (so I know it was working in the past) and when that didn't work, I tried another one, with the same problem.  Roll and pitch sometimes seem ok.  Compass calibration in the web app helps with roll and pitch, but not heading.

Here's output from boatimu.py:

Code:
tc@box:~$ sudo -s
root@box:/home/tc# sv d pypilot
root@box:/home/tc# cd pypilot/pypilot
root@box:/mnt/mmcblk0p2/tinypilot/pypilot/pypilot# python boatimu.py
warning, failed to make calibration process idle, trying renice
Settings file RTIMULib.ini loaded
Using settings file RTIMULib.ini
Detected MPU9250/MPU9255 at standard address
Using fusion algorithm Kalman STATE4
IMU Name: MPU-925x
min/max compass calibration not in use
Using ellipsoid compass calibration
Using accel calibration
MPU-925x init complete
pitch 19.20783 roll 55.87722 heading 44.72846
pitch 20.38675 roll 56.00869 heading 43.29792
pitch 23.16927 roll 57.57145 heading 43.98199
pitch 25.80704 roll 59.12415 heading 44.69340
pitch 28.30826 roll 60.67534 heading 45.46455
pitch 30.67305 roll 62.22287 heading 46.30340
pitch 32.90865 roll 63.76696 heading 47.18022
pitch 35.01785 roll 65.30732 heading 48.11294
pitch 36.99928 roll 66.84198 heading 49.08735
pitch 38.85659 roll 68.37396 heading 50.10614
pitch 40.60413 roll 69.90581 heading 51.12785
pitch 42.25199 roll 71.44297 heading 52.17965
pitch 43.79573 roll 72.99009 heading 53.26924
pitch 45.25355 roll 74.55134 heading 54.38664
pitch 46.62009 roll 76.12374 heading 55.54693
pitch 47.89655 roll 77.70364 heading 56.74875
pitch 49.10900 roll 79.28128 heading 57.95719
pitch 50.25417 roll 80.84087 heading 59.16010
pitch 51.32769 roll 82.39953 heading 60.38060
pitch 52.33152 roll 83.96070 heading 61.66106
pitch 53.27499 roll 85.50407 heading 62.91931
pitch 54.14985 roll 87.04756 heading 64.21760
pitch 54.96964 roll 88.57797 heading 65.51576
pitch 55.72708 roll 90.10637 heading 66.81987
pitch 56.43653 roll 91.62340 heading 68.11653
pitch 57.10433 roll 93.12741 heading 69.39250
pitch 57.72820 roll 94.60425 heading 70.63737
pitch 58.30105 roll 96.06691 heading 71.89215
pitch 58.82903 roll 97.51218 heading 73.15385
pitch 59.32311 roll 98.93635 heading 74.40347
pitch 59.76358 roll 100.34404 heading 75.67554
pitch 60.17286 roll 101.70492 heading 76.88012
pitch 60.54817 roll 103.02951 heading 78.05552
pitch 60.89965 roll 104.31808 heading 79.19253
pitch 61.22124 roll 105.57908 heading 80.30385
pitch 61.50934 roll 106.81533 heading 81.40604
pitch 61.77721 roll 108.03612 heading 82.48188
pitch 62.01840 roll 109.21789 heading 83.52616
pitch 62.24686 roll 110.37012 heading 84.52189
pitch 62.44419 roll 111.50261 heading 85.55067

Any thoughts on what might be wrong with the IMU?  If the IMU was previously working, is it likely to stay working?
Reply
#2
Has it been calibrated?
Reply
#3
(2021-01-02, 05:27 AM)rastam4n Wrote: Has it been calibrated?

I've done this calibration:

   

Is this the one you mean?  Or maybe there is a different calibration I can do?

Among other things, I deleted my pypilot.conf file, in case there were dodgy calibration transform values.  The problem also happens on my boat, and in the shed at home.
 
I'm wondering if I can hook my MPU9255s to an Arduino and try to read the raw values, see if the heading changes there.  Suggestions?
Reply
#4
pitch and roll should both be zero sitting level once you level the sensors

You can plot the raw sensor values using "pypilot_scope_wx" or just dump them to a terminal with something like

"pypilot_client -c imu.compass"

Anyway, you may need to calibrate the accelerometers. about 20-30% of mpu9255 I received need this calibration to be able to work properly. About 10% of mpu9255 I received are defective for various reasons. This is from a total of about 200 sensors.

As for the compass heading changing wildly.. this indicates either the magnetic sensors are defective, or there is a stray magnetic field nearby. Perhaps there is ac power or something? Otherwise you may need a different mpu9255
Reply
#5
(2021-01-02, 10:50 PM)seandepagnier Wrote: pitch and roll should both be zero sitting level once you level the sensors

I just want to check, by "level the sensors" do you mean to hold the module level, or does it mean to run a levelling process?  If the latter, is it the one I posted in the screenshot?

(2021-01-02, 10:50 PM)seandepagnier Wrote: You can plot the raw sensor values using "pypilot_scope_wx" or just dump them to a terminal with something like

"pypilot_client -c imu.compass"

Thanks I'll try this.

Are these values corrected somehow, or are they directly from the chip?

(2021-01-02, 10:50 PM)seandepagnier Wrote: Anyway,   you may need to calibrate the accelerometers.  about 20-30% of mpu9255 I received need this calibration to be able to work properly.

Just to confirm, by "need to calibrate" do you mean do what I showed in the screenshot above?

(A bit strange, the MPU9255 I first tried worked fine at the start of 2020).

(2021-01-02, 10:50 PM)seandepagnier Wrote: As for the compass heading changing wildly..  this indicates either the magnetic sensors are defective, or there is a stray magnetic field nearby.   Perhaps there is ac power or something?

I'll do some more tests.  The problem has occurred in my shed at home, and on the boat.  I have a sensor app in my phone, the heading doesn't have the same problem when the phone is in the same position as the autopilot, so I don't think it's environmental.  The heading is a bit off in the shed, but it's steel.  If it's a signal, perhaps it's coming from the autopilot itself.  But the problem is happening when the motors are off.  I'll try just the RPi and MPU9255, nothing else.

(2021-01-02, 10:50 PM)seandepagnier Wrote: Otherwise you may need a different mpu9255

Thanks, I'll try some different ones.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)