Move Tuner: how exactly moves stop and turns end
Make autonomous moves stop where they should, and turns end on their heading.
In Tune and check: yes, when there is a Robot.java.
You need: a charged battery, the Drive Tuner done (calibrated = true), clear floor (about 6 ft by 6
ft of tiles; on a game field, see On a game field), a tape measure.
The Drive Tuner makes a move the right length. The Move Tuner makes it stop in the right place. A fast robot slides past the end of a move, and a turn can swing past its heading or stop short of it. Each test drives real autonomous moves, measures them, and changes one number. The tuner uses the new number at once, so you run the test again until it says OK. Every test ends about where it began.
Get to the Move Tuner
Section titled “Get to the Move Tuner”-
On the Driver Hub, open the TeleOp list and pick Tune and check (group “Finders”). Press INIT.
-
The menu shows. Press D-pad down until the arrow (
>) is on Move Tuner, then press A. -
The Move Tuner’s INIT screen shows. Nothing moves yet. Press ▶ (start) on the Driver Hub. When the screen says
Run the Drive Tuner first, do that first (Drive Tuner). -
The test list shows. For each test below, press D-pad up/down until the arrow is on the test, then press A to start it. D-pad left/right sets the power of the moves and turns (
Power : 0.5; 0.3 to 1.0). Set the power that your autonomous moves use (.move("...", 24, 0, 0.6): 0.6). Why: a faster robot slides farther, so the numbers fit the power you measured them at.
On a game field
Section titled “On a game field”Spare tiles off the field are best: the same floor, with nothing in the way. On a game field, the tests fit between the field’s parts, because each test ends where it began. Each test needs room on some sides only, and you can put the robot in a new spot before each test:
| Test | Clear floor it needs |
|---|---|
| 1 Creep | a few inches ahead, and (mecanum) to the right |
| 2 Stops | 24 in ahead of the robot’s front edge |
| 3 Turns | a circle as wide as the robot’s diagonal (an 18 in robot: about 26 in), with the robot in its middle |
| 4 Drift | 48 in ahead of the front edge. Mecanum: also 48 in to the right of the right edge |
| 5 Move and turn | 24 in to the left of the left edge and 24 in to the right of the right edge, and room to turn |
BIOBUZZ: only the HIVE frame’s two feet are on the floor in the middle of the field. The HIVE is higher than 29 in, so the robot drives under it. Between the frame’s feet and each side wall there is a clear strip, about 50 in wide and as long as the field. In that strip:
- Creep, Stops, Turns and Drift: the robot’s front points along the strip (along the side wall). On a mecanum, Drift’s 48 in move to the right does not fit. Drift only gives a report, so do it on spare tiles, or skip it.
- Move and turn: the robot’s front points at the side wall, in the middle of the strip. Then its moves to the left and right go along the strip.
Keep the robot away from the FLOWERs on the walls, and from the frame’s feet.
Run the tests in this order. Each one uses the numbers that the tests before it found.
-
1 Creep (finds
moveMinPower): the robot creeps forward, then (mecanum) to the right, with a little more power each step. It stops when the robot rolls. The tuner setsmoveMinPowerto that power x 1.3, for a lower battery. Why: each move ends atmoveMinPower. With too much, the robot arrives fast and slides. With too little, it stalls before the end. -
2 Stops (finds
slowDownIn): the robot drives 6, 12 and 24 in, each out and back. Then it tries again with a biggerslowDownIn(0, 3, 6, 9, 12) until every move slides 0.5 in or less past its end. The screen shows a line for each try: the worst slide, and how long the 24 in move took. A biggerslowDownInstops better, but every move takes longer, so the tuner keeps the smallest one that is good.STUCK: a move stalled before its end. Run Creep first, or clear the path.slowDownIn does not help: every move already ends atmoveMinPower. Run Creep, then Stops again.
-
3 Turns (finds the turn numbers): the robot turns 90, 135 and 45 degrees left, and back each time. The screen shows a line per turn: how far it went past its target, how far off it stopped, and how long it took. Then the tuner changes one number:
What the turns do The tuner changes stop off target (short of it, or past it) and stay there turnMinPowerup (0.05, then 0.08, then 0.11), thenturnKpuprock in and out, just outside the tolerance turnToleranceDeg+ 0.5 (up to 3)swing past the target, or back and forth turnKdup (more brake), orturnKpdown (less push)end on target, but a 90-degree turn takes more than 2 s turnKpupWhy
turnMinPowerfirst: near the target, the push (turnKpx the degrees left) is too weak to move the robot at all. MoreturnKpwould also make the turn come in faster and swing more. Run Turns again until it saysOK. -
4 Drift (a report, nothing to copy): the robot drives 48 in forward and back (on a mecanum, also right and left). The screen shows how much the heading changed on each move. A plain move does not correct its heading. More than 2 degrees: check the weight and the wheels, and use
moveWithTurnon long moves (it holds the heading). -
5 Move and turn (mecanum; finds
moveTurnScaleandmoveMaxTurnPower): the robot drives 24 in sideways while it turns 90 degrees (moveWithTurn), four times. The screen shows how far the heading was still off when the move ended. When the turn lags, the tuner raisesmoveTurnScale(up to 1), thenmoveMaxTurnPower. When the heading swings past its target, it lowersmoveTurnScale. Run it again until it saysOK. -
Check with a tape: without odometry, the tuner measures with the wheel counts. A robot can slide with its wheels locked, and the wheel counts do not see that. So check one move with a tape. Use the Drive Tuner’s tape line (Set up the floor): the front left wheel’s front edge on 0. Run a 24 in forward move in an autonomous, at your autonomous’s power. Read where that wheel edge stops. Within 0.5 in of 24: done. Else, find what you see in the table:
The tape shows Why Do this short or long by the same share on every move (run a 48 in move too: 1 in short on 24 and 2 in short on 48) the wheel size number is wrong run the Drive Tuner again, then the Move Tuner again past the end, by more than the tuner’s screen said the wheels skid when the move stops, and the wheel counts miss it in Tunables.Drive, makeslowDownIn3 bigger. Install, then run the move againstill past the end with slowDownIn = 12the robot is too fast for this floor use a lower power for the move (0.6 to 0.5), and run the Move Tuner at that power. Clean the tiles and check the wheels Why
slowDownIn, and not the tuner: the tuner cannot see the skid, so it thinks the stops are good. A biggerslowDownInmakes the robot slower at the end, so it skids less. With anodometry(...)line, the tuner measures with the odometry, which sees a skid (Measures with : the odometry). Then the tuner finds this number by itself.
Fix a mistake
Section titled “Fix a mistake”- A test went wrong (something was in the way, the robot hit a wall): run the same test again. Each run starts from the numbers in use now.
- Stop a test that drives: press GUIDE (or hold START). The robot stops, and that run is not
used. A Stops test that you stop goes back to the
slowDownInit had before. - A number got worse: the screen’s
Now usingandTurnslines show the numbers in use. Start over to go back to the numbers inTunables.java.
Start over: press STOP, then INIT, and open the tool again. It starts from the numbers in Tunables.java:
nothing carries over. The lines saved at STOP stay in the results file, the newest at the end.
Put the numbers in your code
Section titled “Put the numbers in your code”The robot uses Tunables.java, not the finder’s screen. Take a photo of the screen, and type each line
that starts with Tunables.Drive: into Tunables.Drive. Or copy it from the
results file:
| The finder shows | What it does |
|---|---|
Tunables.Drive: moveMinPower = 0.10 |
the slowest power at the end of a move |
Tunables.Drive: slowDownIn = 3 |
every move slows down over at least its last 3 in |
Tunables.Drive: turnMinPower = 0.05 |
the least turn power while the heading is still off |
Tunables.Drive: turnKp = ..., turnKd = ... |
how hard a turn pushes, and how hard it brakes near the end |
Tunables.Drive: turnToleranceDeg = 1.5 |
a turn is done this close to its heading |
Tunables.Drive: moveTurnScale = ..., moveMaxTurnPower = ... |
how hard moveWithTurn turns while it moves |
Older helpers: the c. lines go in RobotSettings.auto().
Done when
Section titled “Done when”Stops, Turns and (on a mecanum) Move and turn say OK, the lines are in Tunables.Drive, and one 24 in move
ends within 0.5 in on the tape.
Next: Camera lighting.
Look it up: Drive: In Tunables.java, Move Tuner in the finders reference.
Something wrong on this page? Tell us with a short GitHub form.