Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Reset navX roll (http://www.chiefdelphi.com/forums/showthread.php?t=143388)

TimTheGreat 07-02-2016 14:52

Reset navX roll
 
Is there a way to zero the navx roll midgame?

slibert 07-02-2016 19:03

Re: Reset navX roll
 
Quote:

Originally Posted by TimTheGreat (Post 1536508)
Is there a way to zero the navx roll midgame?

Yaw (z axis rotation angle): yes

Roll and Pitch (x and y axis rotation angles): no

See this page for detailed description of these terms.

Roll/Pitch angle does not drift over time - can you please explain why you would like to reset it, and what you would reset it to?

Dan Waxman 07-02-2016 21:28

Re: Reset navX roll
 
While I don't think it's supported by navx, you can get around and effectively reset. I would do this by having a reset method which reads the current roll and sets it to a variable (lets say lastResetRoll). Then just subtract lastResetRoll from the current roll whenever you access roll and you have an effectively "reset" roll.

TimTheGreat 07-02-2016 22:41

Re: Reset navX roll
 
Quote:

Originally Posted by slibert (Post 1536629)

Roll/Pitch angle does not drift over time

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.

apalrd 07-02-2016 23:09

Re: Reset navX roll
 
Quote:

Originally Posted by TimTheGreat (Post 1536752)
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.

Dan Waxman 07-02-2016 23:12

Re: Reset navX roll
 
Here, try something like this.


All times are GMT -5. The time now is 00:57.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi