Constants Setup and Testing
The constants file is where information about your robot is stored in order to make the library function. Think of it as the blueprint, it holds all the most important data for your robot. It holds two subconfigs:
- Drivetrain Constants: Defines your drivetrain type and information about it
- Localizer Constants: Defines how your robot tracks its position on the field
Defining Constants
Open Constants.java
Open Android Studio and double click the shift key to open the search prompt. Search for
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Constants.java. When you press enter, the constants class will open.
Drivetrain Constants
Head over to the Drivetrain Configuration page which will guide you through the process of configuring your drivetrain. Once you’ve done that, come back here.
Localizer Constants
Similarly, the Localizer Configuration page which will guide you through setting up your localizer. Once you’ve done that, come back here.
Verify functionality
At this point, all of your constants should be filled out. Now you can open up the Apex TeleOp Test OpMode on your
driver hub and run it, you should see the current x, y, and heading values in the telemetry. Everything should behave as
follows:
X/Y/Heading values should all start at 0 when the OpMode is initialized.
| Value | Behavior |
|---|---|
| X | Increases when moving forward |
| Y | Increases when moving left |
| Heading | Increases when turning counterclockwise (left) |
You should be able to drive the robot like a normal TeleOp OpMode.
| Joystick | Behavior |
|---|---|
| Left stick: forward and backward | Moves the robot forward and backward accordingly |
| Left stick: left and right | Moves the robot left and right accordingly (only for holonomic drivetrains) |
| Right stick: left and right | Turns the robot counterclockwise (left) and clockwise (right) accordingly |
If the above checks do not pass, your robot will not behave correctly. First check the troubleshooting section at the bottom of this page, and if you still can’t figure out the issue, reach out on Discord and we would be happy to offer some assistance.
Troubleshooting
If your robot isn’t behaving as expected, here are some common issues to check for:
| Issue | Resolution |
|---|---|
| Controls are backwards or inverted | Verify and correct your motor reversals. |
| X or Y position going the wrong way | Reverse the corresponding localizer direction. |
| X and Y axes are swapped | Reverse the X and Y localizer directions (or check encoder port/direction assignments). |
Tuning
The last step before being able to run your first path is tuning the follower. Don’t worry, it’s automatic! The tuning guide will show you how to run the tuner.