-
Notifications
You must be signed in to change notification settings - Fork 0
Gyro
Gyros serve two main purposes: guaging current direction and measuring change in direction. First, absolute compass direction can be calibrated at the start to give your programs a sense of direction which is absolutely essential for auton programs. This is like a unit circle for direction. Relative direction can be used for programs such as DriveStraight which uses the compass to augment motor powers in order to keep the robot going straight even when hit by obstacles.
-
First you want to calibrate during the initialization process and set this to your relative bearing value of 0.
Robot.drive.resetGyro();
-
After that you can simply use the output of the Gyro. (The modulus 360 keeps the value within our bearing)
m_gyro.getAngle() % 360
- Telling the robot to turn at this point is just telling to to move towards the target angle and this value should be absolute.
We hope you enjoy. Submit requests through the issues tab.