Package com.crossbotics.ftchelper.drive
Class AutoDriveConfig
java.lang.Object
com.crossbotics.ftchelper.drive.AutoDriveConfig
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
FieldsModifier and TypeFieldDescriptiondoubleEach move or turn gives up after this many seconds.booleanMust be set to true beforeAutoDrivewill run.doubledriveTo and routes: power per inch left, insidedriveToNearIn.doubledriveTo and routes: the smallest power insidedriveToNearIn, so the robot does not stall short.doubledriveTo and routes: the smallest turn power while the heading is off, whenturnMinPoweris 0.doubledriveTo and routes: the last part (inches) where the speed follows the distance left.doubleMotor turns per wheel turn.doublemoveWithTurn: largest heading-correction power, so moving stays the main job.doubleSlowest translation power near the end of a move.doublemoveWithTurn: heading correction is multiplied by this before mixing.doubleSlow down over at least this many inches at the end of a move (0 = onlytaperStartFraction).booleanStop a move early if the robot is stuck (pushing a wall or another robot).doubleThe robot counts as stuck if it gets less thanstallProgressIncloser to the target withinstallTimeSec.doubleSeestallProgressIn.doubleMecanum wheels slip sideways: the wheels turn more than the robot moves.doubleThe same for strafing LEFT, if the robot slips differently that way (weight to one side, worn rollers).doubleThe last part of the move (as a fraction, 0.10 = last 10%) where speed tapers down.doubleEncoder counts per motor output turn.doubleTurn D gain.doubleTurn P gain: power per degree of error.doubleSmallest turn power while outside the tolerance, so the robot does not stall just short of the target.double...for this long (seconds).doubleA turn is done when the error is this small (degrees)...doubleWheel diameter, inches. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublestrafeCorrectionFor(double right) The strafe correction for this side: + = right, - = left.doubletaperFraction(double distanceIn) The part of a move of this length (a fraction, 0 to 1) where it slows down: the larger oftaperStartFractionandslowDownInover the length.doubleEncoder counts per inch of wheel travel, worked out from the values above.
-
Field Details
-
calibrationConfirmed
public boolean calibrationConfirmedMust be set to true beforeAutoDrivewill 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 ticksPerRevEncoder counts per motor output turn. goBILDA Yellow Jacket 312 RPM (19.2:1) = 537.7. -
wheelDiameterIn
public double wheelDiameterInWheel 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 gearRatioMotor turns per wheel turn. 1.0 if the wheel is on the motor shaft. -
strafeCorrection
public double strafeCorrectionMecanum 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 strafeCorrectionLeftThe same for strafing LEFT, if the robot slips differently that way (weight to one side, worn rollers). NaN (the default) =strafeCorrectionboth ways. The Drive Tuner's "Strafe left" test finds it. -
turnKp
public double turnKpTurn P gain: power per degree of error. -
turnKd
public double turnKdTurn D gain. Slows the turn as it gets close, to stop overshoot. -
turnToleranceDeg
public double turnToleranceDegA turn is done when the error is this small (degrees)... -
turnSettleSec
public double turnSettleSec...for this long (seconds). -
turnMinPower
public double turnMinPowerSmallest 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 moveMinPowerSlowest translation power near the end of a move. -
taperStartFraction
public double taperStartFractionThe last part of the move (as a fraction, 0.10 = last 10%) where speed tapers down. -
slowDownIn
public double slowDownInSlow down over at least this many inches at the end of a move (0 = onlytaperStartFraction). 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 moveTurnScalemoveWithTurn: heading correction is multiplied by this before mixing. -
moveMaxTurnPower
public double moveMaxTurnPowermoveWithTurn: largest heading-correction power, so moving stays the main job. Routes use it too. -
driveToNearIn
public double driveToNearIndriveTo and routes: the last part (inches) where the speed follows the distance left. -
driveToKp
public double driveToKpdriveTo and routes: power per inch left, insidedriveToNearIn. -
driveToMinPower
public double driveToMinPowerdriveTo and routes: the smallest power insidedriveToNearIn, so the robot does not stall short. -
driveToMinTurn
public double driveToMinTurndriveTo and routes: the smallest turn power while the heading is off, whenturnMinPoweris 0. -
actionTimeoutSec
public double actionTimeoutSecEach 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 stallExitEnabledStop a move early if the robot is stuck (pushing a wall or another robot). -
stallProgressIn
public double stallProgressInThe robot counts as stuck if it gets less thanstallProgressIncloser to the target withinstallTimeSec. Defaults: 0.25 in within 0.4 s. -
stallTimeSec
public double stallTimeSecSeestallProgressIn. 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 oftaperStartFractionandslowDownInover 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.
-