Skip to Content
Apex Pathing is currently not released! Join the  Discord Server  to help or keep up with development.
DocumentationConstantsSetup

Constants Setup


The constants file is where the user adds all the info about their robot that the localizer stores in order to make the library function. Here, you will input motor names, odo pod offsets, robot measurements, tuning values, and more. This is the most important file because it stores all the data for your robot.

Clone the project on github and navigate to the constants file. The constants file holds three main types of constants:

  • Drivetrain Constants: Constants specifically related to your drivetrain, different for each type
  • Localizer Constants: Constants relating to your odometry pods, encoder offsets, and more
  • Follower Constants: Define how your robot follows a path

Open Constants.java

In Android Studio, double press the shift key to open the search prompt and search for TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Constants.java. When you press enter, the file holding robot constants will open up, this is the only file you will need to edit.

Drivetrain Constants

Head over to the Drivetrain Configuration page which will guide you through the process of creating the DrivetrainConstants for your robot. Once you’ve done that, come back here.

Localizer Constants

Similarly, the Localizer Configuration page which will guide you through setting up a LocalizerConstants class for your robot. This should be done after the drivetrain constants are set up. Once you’ve done that, come back here.

Leave follower constants for now

The follower constants will be filled out as we tune your robot, so you can leave those for now.

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.

ValueBehavior
XIncreases when moving forward
YIncreases when moving left
HeadingIncreases when turning counterclockwise (left)

You should be able to drive the robot like a normal TeleOp OpMode.

JoystickBehavior
Left stick: forward and backwardMoves the robot forward and backward accordingly
Left stick: left and rightMoves the robot left and right accordingly (only for holonomic drivetrains)
Right stick: left and rightTurns 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 in the Discord and we will help you get it sorted out!

Troubleshooting

If your robot isn’t behaving as expected, here are some common issues to check for:

IssueResolution
Controls are backwards or invertedVerify and correct your motor reversal settings (setFrontRightReversed, setBackRightReversed, etc.).
X or Y position going the wrong wayReverse the corresponding odometry pod direction using setXPodDirection or setYPodDirection.
X and Y axes are swappedReverse the X and Y odometry directions (or check encoder port/direction assignments).

Tuning

The last step before being able to run your first path is tuning the follower constants. This entire process will be completely automated in the future, but for now, you’ll need to tune manually with the tuning guide.

Last updated on