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
Bad Compass
#11
Yes, you must level the sensors which aligns in two rotations and then manually set the compass offset to align in the third (somewhat optional but needed to get more accurate headings)

Eventually, it could maybe auto align based on boat motion, but unless it's really smart, it will end up aligning wrong which is really bad.
Reply
#12
(2020-09-30, 08:44 AM)CapnKernel Wrote: I could be wrong here, but the problem might be the orientation of your IMU.  The MPU board containing the IMU should be horizontal not vertical, and the yellow capacitor should face towards the front of the boat.  I think the magnetic heading is only correct with this orientation.

(Would love to know if I'm wrong.  My autopilot would be better mechanically if I could mount it vertically like you've done!)

I wanted to follow up my post here, as I did some reading.

The MPU9255 has a three-axis magnetometer, so it doesn't matter how the board is oriented.  Calibration will of course, need to be done whatever way it's mounted.
Reply
#13
I know it's crazy but it seems the z-axis accelerometer has a rather large temperature coefficient...

So ideally the sensors would be flat to avoid tilt errors with temperature, but this is not how I mount mine... and they work ok. I will try to investigate further as I learn more and more.
Reply
#14
Quite odd.

I still haven't found the cause of the wildly swinging heading I'm seeing in every MPU9255 I try, even in totally different environments. I have tried an Arduino sketch that just shows the X/Y/Z accel/gyro/magnetometer values, and they're stable when the module is still. Unfortunately I've also had no time to look into it further (school). Am thinking of trying rtimulib/rtimulib2 on an Arduino to try to get just the heading and see if that's stable.
Reply
#15
maybe the alignment is wrong which can cause heading to change with very small changes in orientation. I would look at the sensor values pypilot reads using "pypilot_client -c imu.compass imu.accel imu.gyro"
Reply
#16
At the risk of going off-topic, but related nevertheless: after having leveled, how can pypilot distinguish between pitching an rolling?
Reply
#17
That answer to that question is simple in theory.


You have 3 sets off axis:
First you have the XYZ axis in rest (IMU in rest, ideally aligned in the perfect directions and all measurements should be considered as "zero").

Second you have the levelled/callibrated axis, basically rest + standard offset for XYZ, to compensate between "zero" and the compass heading.
An offset should be constant and you could just summarize different offsets (one for levelling and one for callibration).
Therefore it makes little difference in theory wether you callibrate the levelled sensor or startt with (zero + level offset.=new_zero).


To simplify start with leveling+callibration and call that state you find at the end of the second step "zero + offset" XYZ-axis.


Third you have the "current" measured XYZ axis (or rather the current XYZ directions calculated from 3 DOF rotation, 3 DOF translation and 3 DOF magnetic direction).

From current -/- (zero + offset) you can calculate the roll and pitch. During my school days we called that basic mathematics. The concept is easy, writing it out is a lot of work (and a smart implementation saves a lot of work, meaning more wrtiting and less calculation for the CPU).


If the "zero + offset" XYZ axis creeps you can throw away your measurement.
And you should check if the IMU is bad or whatever else causes the deviation.
Otherwise you'd have to callibrate during the measurements.

I think sean pointed out the one of the 3 direction sensors is more susceptible to temperature, that's where things get rough. If nothing helps you could callibrate the IMU with temperature as a extra parameter. But that is something you'd rather avoid, since your calculation gets more complex. But the combination of an MPU925x and a BMP280 is a very logical one.

With temperature correction you hope to find:
current -/- ("zero + offset" + "temperature offset")
Again, easy in theory since the temperature offset is not constant.
Reply
#18
(2021-01-22, 03:57 PM)ironman Wrote: At the risk of going off-topic, but related nevertheless: after having leveled, how can pypilot distinguish between pitching an rolling?

It cannot unless you also manually dial in the correct compass offset angle. This is also needed to get the correct compass heading rather than some relative heading. If sensors are parallel or at right angles to the direction of the boat the this offset is 0, 90, 180 or -90.

In the future I intend for pypilot to be able to distinguish because of known boat motions (eg heeling) but this is not easy because of potential false assumptions.
Reply
#19
Even if you align the sensors the offset will be necessary. Since breakout boards don't come with aligning marks and they are generally too small a good (0/90/180/270 degrees) alignment is not possible.

But after a rough alignment the offset might be small from the designed situation which might lead to smaller errors.
When you auto-align the sensor there will be the problem of deviation from drift and current (same as with dead reckoning).

If you want to implement "auto-alignment " make sure to also include a "manual alignment" mode, since however good you are with programming I don't think you will be able make a system where I can be satisfied with.

PS I know you all know this, but without writing it down I find it hard to make a my case.
Reply
#20
(2021-01-23, 10:37 AM)seandepagnier Wrote:
(2021-01-22, 03:57 PM)ironman Wrote: At the risk of going off-topic, but related nevertheless: after having leveled, how can pypilot distinguish between pitching an rolling?

It cannot unless you also manually dial in the correct compass offset angle.   This is also needed to get the correct compass heading rather than some relative heading.    If sensors are parallel or at right angles to the direction of the boat the this offset is 0, 90, 180 or -90.

In the future I intend for pypilot to be able to distinguish because of known boat motions (eg heeling) but this is not easy because of potential false assumptions.

With the way I oriented the IMU, pypilot always guesses pitch and rolling right, and normally I don't need much offset for the compass either. Below I documented how the IMU sits in my boat - mind it is upside down in the picture. Once 'leveled', with compass-offset=0, this way pitch and roll are indicated correctly; with compass-offset 90, pitch and roll swap, and with 180, they both flip. Never knew!

   

BTW I was getting interested in the pitch value ever since toying with the idea of snapshotting a masthead camera image when the pitch goes through zero. I'll let you know when that idea ever sees the light...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)