top of page

Development Environment and Drive Code: FRC Training Part 1

Updated: Sep 24, 2019

Okay so you know how to code. But you're in a robotics team, so that's just the first step. With this guide, you'll familiarize yourself with the resources that FIRST provides you, as well as a few of the important classes and how to use them.


The link to the 2019 Control System is here: https://wpilib.screenstepslive.com/s/currentCS


The format that this guide will take is essentially a scavenger hunt of the WPILib tutorials. You should also use Google-fu (the art of Googling things, a programmer's most valuable skill) to help you.


Team Optix uses Java since that's what AP Computer Science teaches. Open this section of the site.


 

Look through the process of setting up the development environment.


What code editor is used? (optional: can other editors be used?)

What are some things that the Update Suite will install? Which one do we use the most often?


 

Look through the process of creating and running robot programs.


How do you create a new project?

In the Project Creator window, what would Team Optix use as our options for language/template type/team number for a competition bot? How do you deploy code to the robot?


Okay now let's say we're making a TimedRobot.


What does robotInit() do?

What does the Robot() constructor do?

What other methods are there in the Robot class? What do each of them do?


You might have noticed DifferentialDrive. This is for controlling the drive motors, and it's pretty nifty. It takes a speed controller group for the left and right side. A speed controller group just takes a bunch of motor controllers for wheels that work. We use Spark motor controllers on our robot. There's a class for Spark too!


You can learn more about this by looking at the documentation here: https://first.wpi.edu/FRC/roborio/beta/docs/java/edu/wpi/first/wpilibj/drive/DifferentialDrive.html


(I actually usually just google "DifferentialDrive FRC documentation")


Ok hold up. HOLD. The phone. Don't even move. That was a big topic. Here's a few questions to make sure you know what you're doing so far.


What's the difference between a motor and a motor controller?

Is there a class for the different types of motors? What about motor controllers?

What is a speed controller group? What parameters does its constructor take?

What is a speed controller? Do we have any on our robot?


Now here's a challenge. Write code (just instance variables, robotInit and teleopPeriodic) to have a robot with 4 wheels (two on each side) that goes forward forever. The front left wheel uses motor controller connected to PWM channel 0. The back left wheel uses motor controller connected to PWM channel 1. The front right wheel uses motor controller connected to PWM channel 2. The back right wheel uses motor controller connected to PWM channel 3.


Hint: Look through the documentation for the different classes to help you, but DON'T just look for other people's code >:(


Also if you're in Team Optix, add a pull request here with your code: https://github.com/Team-Optix-3749/DefaultTimed

252 views0 comments

Recent Posts

See All
bottom of page