Set Up Your Robot
To get started with these exercises, you’ll need a mecanum chassis & Driver Hub. Note which ones you have and use the same ones as you move through the exercises.
Put a battery in your robot and make sure the Driver Hub connects to the robot’s WiFi network.
On the Driver Hub, touch the three dots in the upper-right corner to access the menu, and then choose Configure Robot.
You will need to either choose an existing configuration or create a new one that correctly identifies which device is plugged in to which spot on the Control Hub.
You will need the names assigned to each device in the robot configuration to access those devices from your code.
It is highly recommended to use short, descriptive names for everything - for example DT-RF for the right-front motor in your drivetrain.
Once you have finished examining or creating your configuration, go back to the main screen.
In the Driver Hub menu, select Program & Manage. Use the information on the screen to connect a laptop to the robot’s WiFi network, open a web browser, and navigate to the URL shown on the Driver Hub to access the programming interface.
You can create as many OpModes, runnable programs for your robot, as you want. You select which OpMode you want to run on the Driver Hub before starting the robot. Click the “+” symbol toward the upper-left corner of the screen to create a new file. Choose “Blank OpMode” and “Iterative OpMode” for the File Type. Use your first name and team number with “.java” at the end for the file name - “Brad4366.java” for example. Note that your file name must start with a capital letter! Choose “TeleOp” for the OpMode type.
The top line starts with package.
This groups all of our code together and lets us share things between OpModes.
At the top of the file, you find several lines that begin with the word import.
These are references to other code that allow us to operate the robot. We’ll add more references as we add more functionality to our robots.
Your file should have the following imports.
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
Further down in the code, look for a line that starts with @TeleOp. This controls how & where the OpMode shows up on the Driver Hub. To add a more descriptive name, so you can find your program, make it look more like this:
@TeleOp(name="Brad's Learning OpMode")
We will build off of this program as we work through the rest of the exercises.