Thread: Reset navX roll
View Single Post
  #2   Spotlight this post!  
Unread 07-02-2016, 23:09
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Reset navX roll

Quote:
Originally Posted by TimTheGreat View Post
Our readouts say differently. Not buy much, but about .05 degree a second. We are trying to tell if we are on the ramps of the obstacles. I know it isn't much but it also doesn't equal 0 when we are on the ground.
Since it's reported to you as a float, it will never exactly equal zero. Floating point numbers aren't exact, they are only approximations, so you can never use an == comparison on floats or doubles and expect it to work.

The NavX is performing a sensor fusion algorithm which combines accelerometer and gyro data. When the robot is not moving, the accelerometers will read a constant 1G vector due to gravity, and this vector can be used to trim the pitch/roll readings even with zero gyro movement so they are exact. While moving, the estimated pitch/roll reading can be used to subtract gravity and get vehicle accelerations from an accelerometer reading both gravity and vehicle accelerations.

The 'drift' you're seeing is probably the error in the gyros being slowly corrected by the accelerometers.

There's also the possibility that you aren't truly flat on the ground, since e.g. a 6wd drop center will have a few degrees of normal chassis rock.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack