Open vicmortelmans opened 2 years ago
I only used the I2C interface if I remember correctly.
Yes, roll and pitch are easier because they reference gravity which is always down. Heading is harder and the Earth's magnetic field is really weak and other magnetic fields can throw off your compass. So you have to calibrate it for hard and soft iron distortions. You can collect a lot of data in known orientations and do a least squares thing to calculate the corrections. So you can try something like this.
Hi,
thanks... all this calibrating is looking fairly complicated, even though I have an engineering degree in applied sciences :( And I don't seem to find any ready-made python modules for doing this.
What it should measure is the angle of a panel that is vertically hinged to another panel, fixed on the wall, so it's basically like a door. Fixing the sensor to the door, I thought the heading would be a good way to measure this. But the sensor being fixed limits the possibility for calibration, I reckon.
My plan B is to use a permanent magnet in a fixed position nearby the sensor, so the sensor can measure the relative angle towards that magnet... Not sure though if that will work out.
Best regards, Vic
May 12, 2022 04:10:31 Kevin @.***>:
I only used the I2C interface if I remember correctly.
Yes, roll and pitch are easier because they reference gravity which is always down. Heading is harder and the Earth's magnetic field is really weak and other magnetic fields can throw off your compass. So you have to calibrate it for hard and soft iron distortions. You can collect a lot of data in known orientations and do a least squares thing to calculate the corrections. So you can try something like this[https://github.com/walchko/bearsnacks/blob/main/navigation-and-mapping/inertial-navigation/calibration-magnetometer/calibrate-magnetometer.ipynb].
— Reply to this email directly, view it on GitHub[https://github.com/MomsFriendlyRobotCompany/nxp_imu/issues/6#issuecomment-1124457860], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AABHZDF2D57FAGCFZLU33E3VJRSBFANCNFSM5VWGKUAA]. You are receiving this because you authored the thread.
Hi,
The roll and pitch readouts seem OK, but the heading doesn't. So I thought perhaps a calibration is needed, because heading relies mostly on the magnetic sensor. The papers in
docs
are a bit over my head, but I noticed a scriptcal.py
inexamples
that may be of help?(Note that my application is a rigid setup, so I can't have users do the '8-movement').
Sadly, the script fails:
It seems to go wrong on issuing a soft reset. Looking at the traceback, this is done over I2C. The board has a dedicated RST pin, as well as some interrupt pins, which I did not connect to my Raspberry Pi; I only connected the two I2C pins (and power). Is that OK, or does the script rely on the other pins to be connected as well?
Best regards, Vic