Closed cartycrabber closed 7 years ago
Need to thoroughly test this, including edge cases. Test a lot of angles. Some possible edge cases are turning 0 degrees, turning a very small amount of degrees, turning exactly 180 degrees, turning 360 or more degrees, turning negative degrees, etc.
Test the isTurnDegreesDone function while doing this as well (#20)
This is all testable on the Anderson Bot
A function in mobility to rotate the robot a specified amount of degrees using the Gyro. This will be mostly used for autonomous, so we can tell the robot to rotate a certain amount.
For reference, look at the TurnDegrees in ed2016 TurnDegrees.h TurnDegrees.cpp
or Mobility's setRotationDegrees(int) function and the associated part of the process function in ed2015 Mobility.h Mobility.cpp
Here is an example of using the navX gyro to rotate to a predetermined angle (very similar to what we want to do here). This uses a PID controller, which is more complex but also more reliable. We will want to implement this with a PID controller at some point, but a more basic version is okay to start with.
Here is a page on screenstepslive on using the Gyro to drive straight. Similar concept, only our target angle is different. Note that this uses an analog gyro instead of the navX