Class AutoDriveConfig

java.lang.Object
com.crossbotics.ftchelper.drive.AutoDriveConfig

public class AutoDriveConfig extends Object
Tuning for AutoDrive (autonomous encoder and IMU moves).

The defaults are last season's (DECODE 2025-26) values. They are a starting point only. Measure and tune them on the new robot: docs/modules/drive.md, "Tune AutoDrive". Tutorial 09 walks through the tuning on a real robot.

These are plain public numbers (no getters): make one, change what is different on your robot, and give it to AutoDrive.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
    Each move or turn gives up after this many seconds.
    boolean
    Must be set to true before AutoDrive will run.
    double
    driveTo and routes: power per inch left, inside driveToNearIn.
    double
    driveTo and routes: the smallest power inside driveToNearIn, so the robot does not stall short.
    double
    driveTo and routes: the smallest turn power while the heading is off, when turnMinPower is 0.
    double
    driveTo and routes: the last part (inches) where the speed follows the distance left.
    double
    Motor turns per wheel turn.
    double
    moveWithTurn: largest heading-correction power, so moving stays the main job.
    double
    Slowest translation power near the end of a move.
    double
    moveWithTurn: heading correction is multiplied by this before mixing.
    double
    Slow down over at least this many inches at the end of a move (0 = only taperStartFraction).
    boolean
    Stop a move early if the robot is stuck (pushing a wall or another robot).
    double
    The robot counts as stuck if it gets less than stallProgressIn closer to the target within stallTimeSec.
    double
    double
    Mecanum wheels slip sideways: the wheels turn more than the robot moves.
    double
    The same for strafing LEFT, if the robot slips differently that way (weight to one side, worn rollers).
    double
    The last part of the move (as a fraction, 0.10 = last 10%) where speed tapers down.
    double
    Encoder counts per motor output turn.
    double
    Turn D gain.
    double
    Turn P gain: power per degree of error.
    double
    Smallest turn power while outside the tolerance, so the robot does not stall just short of the target.
    double
    ...for this long (seconds).
    double
    A turn is done when the error is this small (degrees)...
    double
    Wheel diameter, inches.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    strafeCorrectionFor(double right)
    The strafe correction for this side: + = right, - = left.
    double
    taperFraction(double distanceIn)
    The part of a move of this length (a fraction, 0 to 1) where it slows down: the larger of taperStartFraction and slowDownIn over the length.
    double
    Encoder counts per inch of wheel travel, worked out from the values above.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • calibrationConfirmed

      public boolean calibrationConfirmed
      Must be set to true before AutoDrive will run. It is a reminder: set it only after you checked the wheel size, motor directions and IMU mounting. (A robot with wrong numbers can drive the wrong way or much too far in autonomous.)
    • ticksPerRev

      public double ticksPerRev
      Encoder counts per motor output turn. goBILDA Yellow Jacket 312 RPM (19.2:1) = 537.7.
    • wheelDiameterIn

      public double wheelDiameterIn
      Wheel diameter, inches. Tune it so a 48-inch move really moves 48 inches. 96 mm = 3.78 in. The default 4.098 in is last season's value (about the size of a 104 mm wheel).
    • gearRatio

      public double gearRatio
      Motor turns per wheel turn. 1.0 if the wheel is on the motor shaft.
    • strafeCorrection

      public double strafeCorrection
      Mecanum wheels slip sideways: the wheels turn more than the robot moves. Sideways wheel travel is divided by this to get the real distance, and the sideways power is raised by it so diagonal moves keep their direction. Tune on field tiles.
    • strafeCorrectionLeft

      public double strafeCorrectionLeft
      The same for strafing LEFT, if the robot slips differently that way (weight to one side, worn rollers). NaN (the default) = strafeCorrection both ways. The Drive Tuner's "Strafe left" test finds it.
    • turnKp

      public double turnKp
      Turn P gain: power per degree of error.
    • turnKd

      public double turnKd
      Turn D gain. Slows the turn as it gets close, to stop overshoot.
    • turnToleranceDeg

      public double turnToleranceDeg
      A turn is done when the error is this small (degrees)...
    • turnSettleSec

      public double turnSettleSec
      ...for this long (seconds).
    • turnMinPower

      public double turnMinPower
      Smallest turn power while outside the tolerance, so the robot does not stall just short of the target. 0 = off (last season's behavior). Try 0.05 to 0.1 if turns stop early.
    • moveMinPower

      public double moveMinPower
      Slowest translation power near the end of a move.
    • taperStartFraction

      public double taperStartFraction
      The last part of the move (as a fraction, 0.10 = last 10%) where speed tapers down.
    • slowDownIn

      public double slowDownIn
      Slow down over at least this many inches at the end of a move (0 = only taperStartFraction). WHY: 10% of a short move is too little road to slow down on: an 8 in move would slow down over 0.8 in only, still reach the end fast, and slide past it. With 6, every move slows down over its last 6 in (or all of it, if it is shorter), so it reaches the end at about the same slow speed and slides about the same amount, whatever its length. (A faster cruise still arrives a little faster: test the Drive Tuner at your moves' power.) driveTo and routes also slow over their last 8 in.
    • moveTurnScale

      public double moveTurnScale
      moveWithTurn: heading correction is multiplied by this before mixing.
    • moveMaxTurnPower

      public double moveMaxTurnPower
      moveWithTurn: largest heading-correction power, so moving stays the main job. Routes use it too.
    • driveToNearIn

      public double driveToNearIn
      driveTo and routes: the last part (inches) where the speed follows the distance left.
    • driveToKp

      public double driveToKp
      driveTo and routes: power per inch left, inside driveToNearIn.
    • driveToMinPower

      public double driveToMinPower
      driveTo and routes: the smallest power inside driveToNearIn, so the robot does not stall short.
    • driveToMinTurn

      public double driveToMinTurn
      driveTo and routes: the smallest turn power while the heading is off, when turnMinPower is 0.
    • actionTimeoutSec

      public double actionTimeoutSec
      Each move or turn gives up after this many seconds. This keeps one bad move (a wrong number, a robot in the way) from eating the whole autonomous period.
    • stallExitEnabled

      public boolean stallExitEnabled
      Stop a move early if the robot is stuck (pushing a wall or another robot).
    • stallProgressIn

      public double stallProgressIn
      The robot counts as stuck if it gets less than stallProgressIn closer to the target within stallTimeSec. Defaults: 0.25 in within 0.4 s.
    • stallTimeSec

      public double stallTimeSec
      See stallProgressIn. Seconds.
  • Constructor Details

    • AutoDriveConfig

      public AutoDriveConfig()
  • Method Details

    • strafeCorrectionFor

      public double strafeCorrectionFor(double right)
      The strafe correction for this side: + = right, - = left.
    • taperFraction

      public double taperFraction(double distanceIn)
      The part of a move of this length (a fraction, 0 to 1) where it slows down: the larger of taperStartFraction and slowDownIn over the length.
      Parameters:
      distanceIn - the move's length, inches
      Returns:
      the fraction to slow down over, 0 to 1
    • ticksPerInch

      public double ticksPerInch()
      Encoder counts per inch of wheel travel, worked out from the values above.