Go Down

Topic: Getting angles from Gyro (Read 791 times) previous topic - next topic

matstra

Mar 27, 2013, 03:49 pm Last Edit: Mar 27, 2013, 04:05 pm by matstra Reason: 1
I'm trying to get the angles from a gyroscope, and assuming I already have the rate of change (V, degree/s) of the angle Axz, can I calculate the angle Axz_1 with the following:

   VAxz = (Axz_1-Axz_0) / (t1-t0)

Which would give us that:

   Axz_1 = VAxz*(t1-t0)+Axz_0

When  VAxz = Rate of change of the angle Axz(in deg/s);
        Axz_0 = Starting angle; Axz_1 = New angle;
        t0 = Starting time; t1 = New time(in seconds)

Is this correct ?

Would appreciate opinions and thoughts about this! :)

pylon

Quote
Is this correct ?


The math is correct. If you want to know if you chose the right algorithm, you have to tell us, where you get the values from and what you want to achieve.

matstra


The math is correct. If you want to know if you chose the right algorithm, you have to tell us, where you get the values from and what you want to achieve.


I'm using a digital sensor called L3G4200D.
So my question is basically, do I get degree/s as a value out as data from this kind of sensor ?

I got the algorithm from this site http://www.starlino.com/imu_guide.html

pylon



pylon

The units you're getting are 70 millidegrees (per second), so about 14 units make one degree (per second). Datasheet page 10.

matstra

ok thanks! :)

I tried to understand why there is 10 bits in the code for CTRL_REG4, and not 8 bits as I asumed there should be when I look on the datasheet, you know why ?

This is from the code:

    writeRegister(L3G4200D_Address, CTRL_REG4, 0b00000000);

pylon

Quote
I tried to understand why there is 10 bits in the code for CTRL_REG4, and not 8 bits as I asumed there should be when I look on the datasheet, you know why ?


In that code there are 8 bits (which are all 0). Did you notice the '0b' at the start which prepends a binary constant?

matstra

ok, I see. That is strange...
Does it work if I just use hex instead like this ?

    writeRegister(L3G4200D_Address, CTRL_REG4, 0x00);

Erdin

"0b00000000" should be B00000000.
http://arduino.cc/en/Reference/IntegerConstants
But I never use binary. So use 0x00.

matstra


Go Up