GithubHelp home page GithubHelp logo

pololu_open_imu's People

Contributors

funkyflier avatar mikeshub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pololu_open_imu's Issues

use of Magdwick algorithm ?

Hello,

Quickly comparing Pololu_Open_IMU code with your OpenIMU generic library I don't find the code issued from Madgwick algorithm... Am I wrong or you've removed it for now ?
Maybe it is what you want to say in your TODO at the beginning of the file...

Can you clarify me on this point ?

Regards,

Jérémie

Some errors in the code and questions about the filter's operation

Hello @mikeshub!
When adapting this code to the LSM303 and L3DG20 sensors, I discovered a completely ineffective code.
By reviewing the lines of code

gyroSumX = groRead[X_];

and
acc_x = -accScaled[X_];

an oddity was found in this line and replaced with the following code.

gyroSumX += groRead[X_];
gyroSumY += groRead[Y_];
gyroSumZ += groRead[Z_];

and

acc_x = accScaled[X_];
acc_y = accScaled[Y_];
acc_z = accScaled[Z_];

respectively.
As a result, I compiled the code into firmware and output it to the plotter, I got reasonable pitch and roll angles, but I have drift.
Also, when changing the roll angle, there is no effect on the pitch angle.
But when I change the pitch angle more than 80 or -80 degrees, the roll angle begins to change.
I also found differences in calculating pitch and roll angles in radians based on quaternions.
Source:

pitchInRadians = asin(2.0 * (q0 * q2 - q3 * q1));

rollInRadians = atan2(2 * (q0 * q1 + q2 * q3),1 - 2.0 * (q1 * q1 + q2 * q2));

yawInRadians = atan2(2.0 * (q0 * q3 + q1 * q2),1 - 2.0 * (q2 * q2 + q3 * q3));

My corrected code:

void GetPitch() {
	// pitch = asin(2.0 * (q[0] * q[2] - q[1] * q[3]));
        // pitchInRadians = asin(2.0 * (q0 * q2 - q3 * q1));
	  pitchInRadians = asin(2.0 * (q0 * q2 - q1 * q3));
	  pitchInDegrees =  pitchInRadians * RAD_TO_DEG;

}

void GetRoll() {
    // roll  = atan2((q[0] * q[1] + q[2] * q[3]), 0.5 - (q[1] * q[1] + q[2] * q[2]));
    // rollInRadians = atan2(2 * (q0 * q1 + q2 * q3),1 - 2.0 * (q1 * q1 + q2 * q2));
	rollInRadians = atan2((q0 * q1 + q2 * q3), 0.5 - (q1 * q1 + q2 * q2));
	rollInDegrees = rollInRadians * RAD_TO_DEG;
}

void GetYaw() {
    // yaw   = -atan2((q[1] * q[2] + q[0] * q[3]), 0.5 - (q[2] * q[2] + q[3] * q[3]));
    // yawInRadians = atan2(2.0 * (q0 * q3 + q1 * q2),1 - 2.0 * (q2 * q2 + q3 * q3));
	yawInRadians = -atan2((q1 * q1q2 + q0 * q3), 0.5 - (q2 * q2 + q3 * q3));
	yawInDegrees = yawInRadians * RAD_TO_DEG;

	 if (yawInDegrees < 0){
	 yawInDegrees +=360;
	 }
	 if (yawInDegrees > 360){
	 yawInDegrees -=360;
	 }
}
void GetEuler() {
	GetPitch();
	GetRoll();
	GetYaw();
}

As far as I understand, the author of the code does not support and does not respond to requests... this is of course very bad when a person’s work is forgotten and becomes moldy.
I wanted the code and the project to continue to live and benefit others.

Lots of Drift,YPR

Hi Mike, have been playing with your open and a V3. I have very large drift in Yaw and the pitch and roll are increasing (this is with the IMU sitting stationary)
I did find that my Z axias was -15726 +17611 = +1885/2 = +942, X = -59, Y = -277 .
I have tried with and without Merlins cal defines. I have also played with the accel scale factors, which enabled the roll or the pitch to stop increamenting but not both.
I have also tried changing the Mag gaus (is there a LSB offset to put in?) as well as the Accel g
Were did you get the Accel scale factor from? as it seems different from the data sheet, but this all could be due to me as l have limited programming skills.
What l did like was that compared to The Pololu AHRS which my V3 had up to +-15 yaw difference on some headings when tilted, with your code this was down to +-2, but the Yaw would start stable for a second or 2 then start drifting along with the Roll and Pitch.
Any guidance would be appreciated.
Regards Kevin

nan values when computining initial quaternion

Thank for sharing the sketch -- it's very usefull;

I'm randomly getting a NaN values on pitch,roll,yaw vector when computing initial values. Repeting the procedure till all the values are not NaN solves the problem somehow, but if its a bug? feature? how to solve it properly?

Question about reading fluctuations

Thanks for sharing your sketch.

Could you tell me what are normal fluctuations for an IMU laying flat on a table and not moving? My readings with your sketch have less fluctuation than with the MinIMU-9-Arduino-AHRS code, but I want to make sure I don't need to do further tuning. I did use the numbers from the calibration sketch.

Chart of just the pitch reading.
Screen Shot 2013-03-13 at 8 17 02 PM

0.5 degrees of drift per second on all 3 axes, regardless of orientation or calibration

I'm using the MiniIMU v3 with your code, it was working great for a while, but now suddenly all 3 axes are drifting at about 0.5 degrees per second, regardless of what orientation I hold the device in (suggesting it's not a mag calibration problem), and regardless of what values I enter in the mag calibration section (also suggesting it's not a mag calibration problem).

I have tried running the mag for cal code, copying the output into a text file, and entering that text file, along with my magnetic norm at my location, into the magneto program linked in the code. The 0's stayed close to 0, the 1's changed to around 0.15, and the offsets were between 20,000 and 50,000. This had absolutely no effect on the drift from the original 0's and 1's in the calibration section - still getting about 0.5 degrees of drift per second on all 3 axes.

I've tried different USB cables, I've tried different rooms of my house, I've tried different computers, but I'm always getting about 0.5 degrees of drift on all 3 axes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.