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
IMU what information uses pypilot

after building my pypilot and now waiting for the spring to use it I have to admit that I have one more question.

How do pypilot gets the information for the heading (or direction to steer)?

Does pypilot use the magnetometers and calculate a heading from it and then calculate the correction?
Does pypilot use the accelerometers to calculate a moving impulse of the boat to steer against it?

Or is it a combination of both heading and accelerometer?

Have a rudderangle sensor more functions then to use it for the center knob and for generating the rudder max/min flag? 


Best regards

I once started some narrative on how pypilot works internally. It never got to see the end, and probably never will, but this snipplet might answer some of your questions. I might miss the nail as well, but I think it goes in the general direction. I come to think for now the IMU is only used to provide an accurate compass heading.

"The first other python subprocess is Main thing to remember is that it puts the compass heading of your boat into imu.heading, so the autopilot process knows the heading of your boat. But you should also understand that there is much more to That teeny-weeny little chip attached to your raspberry i2c bus, called an IMU, Inertial Measurement Unit, measures motion over 6 axes and the earth magnetic field in 3 axes. But compass heading is only 2-dimentional, right? It’s a vector in the 2-dimensional horizontal plane? Yes, but apart from heading a certain way, the boat rocks like mad. Your standard fluid-filled or fluxgate compass is gimbaled, so it stays somewhat horizontal. The IMU, however, is attached to the boat. You could say the gimbaling is done programmatically, based on the input of the motion sensors. But there’s more.
Many know that even a plastic boat has metals in it that affect the measured magnetic field differently for various headings. Hence the deviation table that comes with a properly installed compass. With regular fluxgate compass solutions, you would need to sail one full circle to automatically establish this basic deviation table. This is done during calibration, sometimes called linearization. In the old days, this calibration process had to be started manually. PyPilot however, in particular, does this automatically, so there is no need to search for the manual to put the autopilot in calibration mode. Because of all the motion sensors on board, you don’t need to have a constant rate of turn, or wait for calm water to calibrate. So those motion sensors already come in handy.
Lesser known is that heel and pitch also affect the measured magnetic field. Now the good thing about the 6 axes of motion measuring is that knows what attitude your boat is in. And therefor, it can correct for pitch and heel. How? Suppose your boat is level and the measured compass heading is due north. Suddenly, the boat heels 20 degrees and pitches 20 degrees, so that’s a rotation over 2 axes. It does not yaw, so the actual compass heading does not change. But due to the changed magnetic influence of the boat, the measured heading might be different. Since the imu has not recorded any yaw, it knows now the correction vector for 20/20 heel/pitch. With a handful of those correction vectors it can interpolate the heading for each attitude of your boat, but the more correction vectors, the better. Recording those correction vectors is a constant process, called auto-calibration. Think of it as a 3-D deviation table. The end result is that puts a value in the data layer that is seriously reliable, and it’s getting better as you sail more. Only this is reason enough to convert your tiller pilot into a pypilot!"
It uses the compass sensors and accelerometers, but more importantly the gyros. There is something called a kalman filter which combines all of the sensor measurements and this is essentially what is used to determine the corrections.


Sorry I mean the gyros not accelerometers. If talking about something it´s better to use the right terms  Blush

The corrections due to the gyros should help the ap for steering in higher aft waves. Better than a ap which only uses compass corrections.

Best regards

The sensors magnetic sensors on most of the imu are not very good. The precision is often much better than the accuracy. To read the correct compass angle it must be tilt compensated which needs other sensors, and on a moving platform accelerometers aren't enough for this.

So gyros are the simplest sensor to get the needed correction since it can use well understood algorithms like kalman filters. They also happen to give a much better resolution of angular rate than differentiating the compass without the introduced errors of tilt compensation.

To get the same performance without gyros is possible using machine learning and maybe a video camera looking at the waves and much more processing power. I'm trying to figure out how to do this anyway but I will keep the gyros, and maybe even add a few more (redundant sensors) mounted in different orientations to reduce noise and detect magnetic distortions and also automatically calibrate the accelerometers and gyros for scale factors and non linearities and temperature coefficients and mis alignments on the fly thus reducing the errors from 1-2 degrees down to 0.5 or better...
Was looking at magnetometers and their sensitivity earlier and came across one guy describing his correspondence Invensense. Their tech support said that magnetometer on MPU-9250 is best among their range.

Forum Jump:

Users browsing this thread: 1 Guest(s)