Shop OBEX P1 Docs P2 Docs Learn Events
how to integrate the angle rate of gyroscope L3G4200D — Parallax Forums

how to integrate the angle rate of gyroscope L3G4200D

qiuqiuaaaqiuqiuaaa Posts: 37
edited 2012-07-20 01:23 in Accessories
The demo code can only get the angle rate, but I want to integrate the value to get angle. How can I integrate the discrete values? And I also have the same problem to get position information from acceleration. Anyone can help me? Thanks. (I use BS2)

Comments

  • ratronicratronic Posts: 1,451
    edited 2012-07-16 08:38
    qiuqiuaa I do not have a working BS2 at the moment but you can integrate the axis readings by adding each sequential axis reading to a variable at consistent timing such as in a DO/LOOP that does the same exact thing every time thru the loop.
  • SRLMSRLM Posts: 5,045
    edited 2012-07-16 13:37
    While you could, in theory, add the readings together and get an answer, there are some things to keep in mind:
    1. You must have a constant delta-t (sample time) in order to get a reliable answer
    2. You'll have to scale your answer if you want it in terms of real units

    And, most importantly:
    3. You will not get valid results with this method for any sample period longer than a few seconds. The sensors (gyros and accelerometers) are just too noisy. Do a search for IMU and Kalman filtering to see why.

    And now, a slight modification: if you're very careful, you might get decent results with the accelerometer for short paths (20 feet or so). There was a forum post about it a while back, possibly even in this search:
    accelerometer integrate position site:forums.parallax.com
    
  • qiuqiuaaaqiuqiuaaa Posts: 37
    edited 2012-07-20 01:23
    Thanks. I will try.
Sign In or Register to comment.