In the previous examples, we learned to apply power to the wheel motors and to see how far the wheel has turned using encoders. Now we're going to put them together to drive the robot a controlled distance. We're also going to learn about autonomous mode. Every FRC match starts with a 15 second autonmous period where the robot drives itself and tries to accomplish some task with no human driver. For this example, our task is to drive 3 feet forward and then stop (harder than it sounds).

Create another program using the TimedRobot java template and name it AutonomousTest1.

When you launch the driver station, you'll need to select "Autonomous" mode (look above the Enable button) and then press the Enable button. The autonomousInit() method will run first and then the autonomousPeriodic() method will be called repeatedly until the robot is disabled. If your robot isn't doing what it should be, press the Disable button immediately to stop the robot. It's usually a good idea to test your code with the robot up on a stool or blocks (wheels not touching the ground) in case your code doesn't work properly.

Why didn't the robot go straight?

Extra credit

Try to make the robot travel in a straight line.


Follow ControlSystems/SoftwareTeam/Training/GettingStarted/Autonomous/Vision

Last modified 18 months ago Last modified on Nov 12, 2019, 6:22:44 PM