so i just got my inertial sensor and i was trying to look at the heading and see how accurate it is and for some reason the heading is never negative. When i turn clockwise and goes from 0 to 360 and when i turn counterclockwise then it goes from 360 to 0,
any ideas why?
Because thats how angles work. In a polar coordinate system, everything is the same if you add or subtract 360 deg
1 Like
but then in the PROS doc it says its contained between -360 to 360
This value is bounded by (-360,360). Clockwise rotations are represented with positive degree values, while counterclockwise rotations are represented with negative ones.
btw i have updated the brain and everything already
For VEXcode
heading() will return 0-359.99 and rotation() will return unlimited positive and negative values.
https://api.vexcode.cloud/v5/html/classvex_1_1inertial.html#a07caa7a985850b317c7155fd40cd255b
2 Likes
Is it the same thing for PROS?
They have get_rotation() I believe, you would need to look at their documentation.
1 Like
yea that works thanks,
if possible could you explain the difference between the two, get_heading
and get_rotation
?
One works more like a compass does, in VEXcode, using turnToHeading() in the drivetrain class would turn the robot using the shortest route to the “compass” heading. Rotation is more of an absolute concept, you could turn the robot through two full rotations by sending it to 720 degrees.
4 Likes
ahhh ok makes sense thanks