balzer82 / Kalman

Some Python Implementations of the Kalman Filter
1.05k stars 367 forks source link

A couple of questions #2

Open storerjeremy opened 8 years ago

storerjeremy commented 8 years ago

Hi,

I am trying to use your CTRV code to calculate an accurate course of a car to compare to a heading obtained from an imu that has sensor fusion on board in order to calculate slip angle for a car drifting application. I just have a few questions as I can't seem to get it to work correctly.

In your raw data file "2014-03-26-000-Data.csv" are the units for yawrate degrees per second, positive for clockwise and negative for anti clockwise? and are the units for ax m/s^2, positive for acceleration and negative for deceleration?

Also can you explain why you offset the course "course = (-course + 90.0)"?

Thanks

balzer82 commented 8 years ago

Hi, first of all: You will not get a side slip angle. The IMU is using accelerations (g pointing down to earth), turn rates and maybe magnetometer to get an orientation in 3D space. You want to compare this to the heading of the CTRV heading. But if the car is drifting, you have yawrate, which turns your CTRV model as well as the heading of the IMU. Both doing the same calculations.

The units are:

The coordinate system is as in DIN70000:

fahrzeug-koordinatensystem-din70000-940x469

Course offset is necessary because the output of the GPS sensor is 0 degree in north direction and then positive clockwise, the math for the CTRV model needs the heading 0 in east direction and positive counter-clockwise.

storerjeremy commented 8 years ago

Hi,

Thanks for your quick response. That makes sense.

The IMU chip I am using is a Bosch BNO055 which does sensor fusion in the hardware and outputs Euler Angles either relative to the chip or absolute to magnetic north and other sensor fused values such as linear acceleration minus gravity and quaternions. The Euler Angle yaw value is in degrees 0 to 359 and will give me the heading/angle of the car at any point in time.

What I was hoping to do was to compare the Euler yaw value I get from the IMU +- a static offset that can be calculated when the car is not drifting to a corrected gps course over ground value using the CTRA or CTRV method. So when the car is not drifting the Euler yaw value +- the offset should equal the corrected gps course over ground and when the car is drifting the difference between the Euler yaw and gps course will be the drift angle.

My question would be can the CTRA or CTRV model be adjusted to still produce an accurate corrected latitude, longitude and gps course even when a car is drifting or at a large slip angle?

I have run some data through the CTRA model of a car turning a corner without drifting and with drifting see below.

Without drifting this is what it looks like, which looks good. without-drifting

With drifting this is what is looks like, which doesn't look good but makes sense as there are higher gyro rates when drifting which throws the model out therefore making the corrected line further into the middle of the corner. with-drifting

So is it possible to adjust the CTRA or CTRV model to make the "with drifting" corrected line look more like the "without drifting" line? or would it need a different model all together?

Thanks

balzer82 commented 8 years ago

I supervised a bachelor thesis some years ago, where we tried this, but had no luck. The drift angle (sideslip angle) is the angle between the direction of the car and the direction of the velocity vector of the center of mass. You can just calculate some noisy error differences between two filters but no real drift angle.

Solutions:

Take a look at this paper: Integrating INS Sensors With GPS Measurements for Continuous Estimation of Vehicle Sideslip, Roll, and Tire Cornering Stiffness