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

Drivetrain Constants


Choose your drivetrain type below and follow the steps to configure it.

Make sure that at the last line of every configuration section you add a semicolon

Replace drivetrainConfig()

@Override public BaseDrivetrainConfig<?> drivetrainConfig() { return new Mecanum.Config() .setFrontLeftMotor(new MotorFactory("frontLeftMotor")) .setBackLeftMotor(new MotorFactory("backLeftMotor")) .setFrontRightMotor(new MotorFactory("frontRightMotor").reverse()) .setBackRightMotor(new MotorFactory("backRightMotor").reverse()); }

Motors

Replace the names of the motors with the names of your drivetrain motors in the hardware configuration. If your motors are reversed, call .reverse() for that motor. See more about the MotorFactory class. You can use the MotorDebugger OpMode in the OpModes page to get your motor positions and directions correct.

Global drivetrain constants (optional)

See the bottom of this page for more details

Global Drivetrain Constants

Some constants are common to all drivetrains. All of these are optional and have default values which are usually sufficient for most robots. You can override them in your drivetrain configuration if you want to customize them.

  • .setRobotCentric(boolean robotCentric)
    • If true, follower.teleOpDrive() will use robot-centric controls, otherwise it will use field-centric controls.
    • Default is true (robot centric)
    • You can swap between robot-centric and field-centric on the fly with follower.setRobotCentric(boolean robotCentric) in your OpMode.
  • .setMaxPower(double maxPower)
    • Sets the maximum power that can be applied to drivetrain motors.
    • Default is 1.0 (100% power)
  • setLinearVelocityLimit(Dist linearVelocityLimit)
    • Sets the maximum linear velocity of the robot as a Dist in units per second.
    • Default is 0 (disabled, no limit)
  • setAngularVelocityLimit(Angle angularVelocityLimit)
    • Sets the maximum angular velocity of the robot as an Angle in units per second.
    • Default is 0 (disabled, no limit)
  • setLinearAccelerationLimit(Dist linearAccelerationLimit)
    • Sets the maximum linear acceleration of the robot as a Dist in units per second squared.
    • Default is 0 (disabled, no limit)
  • setAngularAccelerationLimit(Angle angularAccelerationLimit)
    • Sets the maximum angular acceleration of the robot as an Angle in units per second squared.
    • Default is 0 (disabled, no limit)
Last updated on