Odometry Tuner: directions, offsets and a loop check
Check which way each odometry pod counts, measure where the pods sit, and prove the pose comes back to its start.
In Tune and check: yes, when Robot.java has an odometry(...) line.
You need: a 48 in tape strip with a start mark, room to spin.
Get to the Odometry Tuner
Section titled “Get to the Odometry 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 Odometry Tuner, then press A. -
The Odometry Tuner’s INIT screen shows. Press ▶ (start) on the Driver Hub.
-
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.
The Odometry Tuner is for a robot in five files with an odometry(...) line (odometry).
It needs your robot, in a small file next to Robot.java (the odometry robot’s
OdometryTuner.java;
the whole file to type: the odometry module). Put a 48 in
strip of tape on the floor, with a mark at its start. In every test, the sticks drive slowly (30%). You
can also push the robot by hand. The D-pad chooses, A starts, and B ends the test.
-
Forward 48 in: drive or push the robot 48 in straight forward along the tape, and press B. The screen says “Forward OK” (and how many % off), or “counted BACKWARD”. For BACKWARD, add
"x"to.reversed(...)(dead wheels: that pod’s port name). The simulator’s Pinpoint works the same way.odometry.reversed = xin the robot file is a pod wired backward. The code’s.reversed(...)(and.offsetsMm(...)) is what the library tells the Pinpoint. So a robot file that differs from Robot.java shows the same mistakes as a real robot. An OTOS getsTunables.Odometry: linearScalar = ...to copy (multiply it with the one in use). More than 2% off: check the pod type (Pinpoint) orticksPerMm(...)(dead wheels), and the tape. More than 10% off: the screen asks “was it really 48 in?”. It is a mistake in the test: measure and run it again. -
Left 24 in: drive or push the robot 24 in to its LEFT, and press B. The screen says “Left OK”, or “counted RIGHT”. For RIGHT, add
"y"to.reversed(...)(dead wheels: the sideways pod’s name). Push a tank robot by hand. -
Spin 3+ turns: turn the robot in place at least 3 times with the right stick, and press B. With fewer turns, the screen says how many and asks for more. The tuner measures the turn from the Pinpoint’s own heading. For dead wheels and the OTOS, it uses the Control Hub’s IMU, so they need
.imu(...)indrive(...). Without it, the tuner stops at INIT and says so. The tuner shows the offsets as the numbers to change:Robot.java: in the odometry(...) line, .offsetsMm(-84.2, -167.5)(three wheels:.trackWidthIn(..).perpForwardIn(..); two:.parallelLeftIn(..).perpForwardIn(..)). Change only those numbers:.reversed(...)and the pod type stay as you wrote them. With.podsFromEdgesMm(...)in the line, write the measured.offsetsMm(...)in its place. The tuner cannot measure where an OTOS sits. Measure it from the robot’s edges with a tape (.robotSizeMm(...).mountFromEdgesMm(...)), and its turn scale by hand. -
Copy the numbers into your odometry line, and rebuild.
-
Loop and back: start on the mark and drive anywhere, at least 24 in away. A robot that never left the mark proves nothing, and the tuner says so. Come back onto the mark, facing the same way, and press B. Within 1 in and 2 degrees, the screen shows
Tunables.Odometry: checked = true: set it inTunables.java. Until then, the robot skips autonomousdriveTosteps.
Fix a mistake
Section titled “Fix a mistake”- A bad test (the robot slipped, or you pressed B at the wrong place): choose the same test and run it again (A, then B). The new result replaces the old one.
- The Forward test does not use a result that is more than 10% off. The screen says so: run it again.
Start over: press STOP, then INIT, and open the tool again. It starts empty: 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 and Robot.java, not the finder’s screen. Take a photo of the screen,
and type each line into the file. Or copy it from the results file:
| The finder shows | Put it in |
|---|---|
Robot.java: in the odometry(...) line, .offsetsMm(-84.2, -167.5) |
the odometry line in Robot.java. Change only those numbers |
Tunables.Odometry: linearScalar = ... (OTOS) |
Tunables.Odometry (multiply it with the one in use) |
Tunables.Odometry: checked = true |
Tunables.Odometry. Autonomous driveTo steps run only with it |
Done when
Section titled “Done when”the Loop test shows checked = true and it is in Tunables.java.
Next: Move Tuner: how exactly moves stop and turns end.
Look it up: Odometry: In Tunables.java, Odometry module.
Something wrong on this page? Tell us with a short GitHub form.