Vertical NavX Rotation2D

Hey, so our team uses a NavX for our gyroscope
an issue we’re experiencing is we’re executing a trajectory while the NavX is at a 90 degree angle to the floor, so as we use the .getRotation2D() method, it measures the Rotation2D of our heading, not of our roll.

Is there a way to have the NavX use roll instead of heading?
Or a way to construct Rotation2D using the .getRoll() method?
Thank you

You can construct a Rotation2D from a radians value by simply creating it (new Rotation2d(radiansValue)) or from a degrees value by calling Rotation2d.fromDegrees(degreesValue).

Awesome! And just so I know, do I have to adjust it from the range of -180 to 180 to the range from 0 to 360 for the .fromDegrees() method?
Thanks a lot!

It appears the constructors don’t do that for you, but I believe most things that use this class will normalize to the -180 to 180 range (because they actually use the sin/cos values, not the raw value). To be on the safe side it’s probably best if you do.

5 Likes