NRG948 / NRGRobot2018

3 stars 2 forks source link

Issue #6 Robot Turn to Heading #6

Closed ChuweyBar closed 6 years ago

ChuweyBar commented 6 years ago

In autonomous, sometimes we need to turn the robot to some specific degrees. Ex: Turn left 15 degrees, turn right 20 degrees. Using the Gyro we can control the robot to output the exact power to turn to the angle we desire. Look into last year's code, the following "TurnToHeading" would help. https://github.com/NRG948/NRGRobot2017/blob/master/NRGRobot2017/src/org/usfirst/frc/team948/robot/commands/TurnToHeading.java Ask for mentor or leadership's assistance on this issue. Don't commit any changes without mentor's approval.

edreed commented 6 years ago

There's sample code for using the navX AHRS class as an input to the PIDController and using the output to rotate the robot. It's pretty straightforward, but will need to be implemented in the TurnToHeading command.

https://github.com/kauailabs/navxmxp/blob/master/roborio/java/navXMXP_Java_RotateToAngle/src/org/usfirst/frc/team2465/robot/Robot.java