Pedro module (Pedro Pathing)
Package: com.crossbotics.ftchelper.pedro, in the pedro folder. It is an optional add-on: the core library never needs it. The step that uses it, follow(...), is in Steps.
New to path following: start with Add Pedro paths.
Quick answers with code to copy: cookbook: Pedro paths.
Worked example: examples/.../pedrobot.
Pedro needs a working, checked odometry, so read the odometry module first.
Pedro Pathing (pedropathing.com) is a path follower. You give it a
path (a line or a smooth curve). Pedro drives the robot along it fast, corrects all the way, and
brakes at the end. driveTo goes to one point. Pedro follows a whole path, curves included.
You need odometry and a mecanum drive.
Odometry: Pedro steers by the robot’s real place on the field, every loop. Only the
odometry(...)line gives that: a Pinpoint, an OTOS or dead wheels, set up and checked (odometry, Add odometry). Drive-wheel encoders slip, so they are not enough. With no odometry line, INIT stops. Until you check the odometry, the robot skips thefollowsteps.
Mecanum: Pedro corrects the robot’s position by sliding it sideways, so it needs wheels that can strafe. Pedro 3.0.2 has two drivetrains, Mecanum and Swerve. It has no tank (two-side) drive. With a tank
drive(...)line,Pedro.follower(...)stops INIT with a clear message. A tank robot uses odometry withturnToandmoveinstead (building autos). Swerve: build Pedro’sSwervedrivetrain yourself through the escape hatch. Nobody has tested this, and the library has no swervedrive(...)line.
When to use which:
| You want | Use |
|---|---|
| go to a point, with code that is short and clear | driveTo (no add-on, no extra tuning) |
| a curved path, or more speed with smooth braking | Pedro (follow), after Pedro’s own tuning |
Both use the same field numbers and the same odometry, so you can mix them in one autonomous.
| Class | Use it to |
|---|---|
Pedro |
the one line in Robot.java: follower(Pedro.follower(...)) |
PedroPath |
make a line or a curve in our field numbers |
PathAt |
start things along a path (in the core library: com.crossbotics.ftchelper.robot) |
PedroTuning |
run Pedro’s own tuners on your robot’s drive and odometry lines |
PedroFollower |
Pedro’s Follower as a part of the robot (made for you) |
PedroLocalizer |
gives Pedro the pose from your odometry(...) line (made for you) |
PedroFrame |
turns poses between our numbers and Pedro’s |
flowchart LR
O["odometry(...) line<br/>(read first, every loop)"] --> L["PedroLocalizer"]
L --> F["Pedro's Follower<br/>(Foresight)"]
P["follow("To the goal", path)"] --> F
F --> M["the drive motors<br/>(only while a path runs)"]
Add it to your robot project
Section titled “Add it to your robot project”Pedro is a separate library (from Maven Central). The pedro folder brings Pedro in and connects it to
your robot files. Do this once, after the library itself works (Add the library).
1. settings.gradle, in the project folder (not in TeamCode). Under the library’s two lines, add:
include ':ftc-helper-lib-pedro'project(':ftc-helper-lib-pedro').projectDir = new File(rootDir, 'ftc-helper-lib/pedro')2. TeamCode/build.gradle, in dependencies { ... }, under the library’s line:
implementation project(':ftc-helper-lib-pedro')3. Sync (File > Sync Project with Gradle Files).
Why: the pedro folder brings in Pedro version 3.0.2, the version we test this module with.
Teams that do not add these lines do not get Pedro.
Robot.java: the follower line
Section titled “Robot.java: the follower line”One line, after the odometry(...) line:
odometry(Odometry.pinpoint("pinpoint").offsetsMm(-84, -168));follower(Pedro.follower(PedroConstants.foresight));- The drive motors come from your
drive(...)line: the names, and which ones are reversed. Pedro needs a mecanum drive. - The pose (the robot’s place and heading) comes from your
odometry(...)line. Pedro does not read the Pinpoint itself. So you set up and tune the odometry once, with the library’s Odometry Tuner. PedroConstants.foresightholds Pedro’s own numbers: how fast the robot goes, how it brakes, how hard it corrects. They come from Pedro’s Foresight tuner. To start, copyPedroConstants.javafrom the example into your TeamCode. We measured its numbers on the simulated example robot (The simulator). They are not yours: run the tuner before you trust a path.
Pedro reads PedroConstants at INIT. These numbers are not in the library’s tuning menu. Change them in the
file and send the code again.
follow: the autonomous step
Section titled “follow: the autonomous step”s.start("Against our wall, left corner tile, facing the field", -56, -61, 0) .follow("To the goal", PedroPath.line(-56, -61, -30, -30).turnTo(0, 45)) .follow("Park", PedroPath.curve(-30, -30, -50, -24, -56, -36).keepHeading(0));follow(label, path) starts the path and waits until Pedro is at the end. Then the next step runs.
follow(label, path, seconds) sets your own time limit (the default is 10 s).
What the report says:
| Report | Meaning | What to do |
|---|---|---|
To the goal: done |
Pedro reached the end | nothing |
timed out |
the robot was still going after the time limit | give a longer limit, or check the path for walls |
STALLED |
the distance left did not go down for 1.5 s (the robot is stuck on something) | check the path. The robot stops and the next step runs |
NO_ODOMETRY |
the odometry did not answer (at the start, or for 0.2 s on the way) | check the Pinpoint cable. The robot stops |
skipped: Tunables.Odometry.checked is false |
nobody checked the odometry | run the Odometry Tuner, then set checked = true |
cut short |
park time or STOP came first | nothing: this is normal at the end of the match |
..., not fired: Spin up |
the path ended early, so these PathAt things never started |
fix the early end. If they matter, start them in a later step |
After a problem the next steps still run, as with driveTo. When the next step needs the robot at
the end of the path, guard it with a waitUntil, or plan a safe next step.
Skipped until checked: an odometry with a wrong offset or a reversed pod can send the robot the
wrong way at full speed. So, like driveTo, follow does nothing on a real robot until
Tunables.Odometry.checked = true. The simulator does not need it.
Do things along the path
Section titled “Do things along the path”Pedro has no “do this at this point” of its own. PathAt adds it: put things after the path in the
follow step. Each one starts something once, at its place along the path. The robot keeps
driving, as with a run step in the middle of the path:
s.follow("To the goal", TO_GOAL, 15, // 15 s at most, then the things to do PathAt.fraction(0.5, "Intake on", robot.intake::in), // halfway along the whole path PathAt.part(2, "Intake off", robot.intake::stop), // where part 2 starts PathAt.inchesLeft(12, "Spin up", robot.launcher::spinUp)); // 12 in before the endrobot.intake and robot.launcher are the parts in your Robot.java: use your own part names.
| Write | It starts |
|---|---|
PathAt.inchesDone(10, ...) |
after 10 in of the path |
PathAt.inchesLeft(12, ...) |
when 12 in of the path are left (the whole path, all its parts) |
PathAt.fraction(0.5, ...) |
when that much of the WHOLE path is done (0.5 = halfway, all parts counted; 0.25 = a quarter) |
PathAt.part(2, ...) |
where part 2 of a then path starts (part(1) = at once) |
PathAt.near(-40, -40, 6, ...) |
when the robot’s center is within 6 in of the field point (-40, -40) |
What to do: a name and a command ("Intake on", robot.intake::in), or an action from your
Actions.java (PathAt.inchesLeft(12, Actions.scoreHigh(robot))). Any action you wrote works too, and
the step uses its name. An action keeps running after the step, like alongside. A command must not
wait: it starts things (spinUp, goTo), as in a run step.
The rules:
- Once each. Every loop the step checks them in the order you wrote them. So when the robot reaches two in the same loop, they start in that order. Write them in the order they come along the path.
- At the end of the path, the ones reached there start. This holds even when Pedro called the path done a little short of the end (it is done within 2.5 in). It also holds when Pedro called it done in its very first loop.
- A path that comes back the same way (out 24 in, then back along the same line) keeps counting.
Halfway back is 36 in done, never back to 12. The robot’s place on the path only moves forward. It
may slip back a few inches, no more.
nearstarts only when the robot truly came that close. - If the path ends early (
timed out,STALLED,NO_ODOMETRY,cut short), the rest do not start, and the report names them:To the goal: STALLED, not fired: Spin up. When a path got to its end but missed anearpoint, the report saysTo the goal: done, not fired: .... - Mirrored like the path: distances along the path are the same on both sides. You write
near’s point for BLUE, and the step mirrors it for RED, likedriveTo’s. - Mistakes stop INIT with a message: a fraction that is not 0 to 1, a part 0, or
part(3)on a path with 2 parts.
How far along the robot is: the step measures it along the path. It finds the robot’s closest point on
the path, and the distance along the path from there to the end (PedroFollower.remainingIn()). The
“part” is the part that closest point is on, so part(2) starts where the robot passes the join.
The step does not use Pedro’s own distance left. That distance counts only the part Pedro steers along
now, and Pedro looks ahead: it may start steering along part 2 well before the join.
With driveTo too: driveTo("To the goal", -30, -30, 45, 0.7, PathAt.inchesLeft(12, "Spin up", robot.launcher::spinUp)).
Its “path” is the straight line from the robot’s place at the start of the step to the point. So it
has one part.
alongside or PathAt: .alongside(action) before the follow starts the action when the path
starts. PathAt starts it later, at a place along the path.
Another path follower (an add-on that fills in PathFollower) works with PathAt too. When it does
not give its path’s length, the step uses the distance left at the start. When it does not say which
part it drives, part(n) starts at the end of the path (PathFollower).
PedroPath: paths in our field numbers
Section titled “PedroPath: paths in our field numbers”The numbers are the same as for driveTo and the start spot. Seen from your drivers’ wall, x is
inches right of the center line, and y is inches away from the center toward the far wall. The
heading is in degrees: 0 = facing away, counterclockwise + (the frame).
Draw it first: the Pedro Path Builder is a web page with the BIOBUZZ field. Draw lines and curves, and set the heading and speed of each part. The page shows the robot’s footprint along the path, in red where it hits a field element. It writes the
PedroPathcode (ordriveTosteps), and it reads your code back so you can change it.
Make a path:
| Code | The path |
|---|---|
PedroPath.line(x1, y1, x2, y2) |
a straight line |
PedroPath.line(fromPose, toPose) |
a straight line, turning from the first heading to the second |
PedroPath.curve(x1, y1, cx, cy, x2, y2) |
a smooth curve from (x1, y1) to (x2, y2). The control point (cx, cy) pulls the curve toward it. The robot does not drive through it. For more control points, put more pairs in the middle |
Then choose the heading with one of these. The default is facePath().
| Code | The robot |
|---|---|
.turnTo(startDeg, endDeg) |
turns evenly from one heading to the other on the way |
.turnTo(startDeg, endDeg, from, until) |
turns only on one stretch of the part (0 = its start, 1 = its end). 0, 0.3 turns first, then drives. 0.7, 1 drives first, then turns. On the last part, add .holdEnd() so the turn can finish |
.keepHeading(deg) |
keeps one heading the whole way (it slides sideways as needed) |
.facePath() |
faces along the path, front first |
.facePathBackwards() |
faces along the path, back first |
.facePoint(x, y) |
keeps facing a field point, for example the goal |
More options: add them after the heading.
| Code | What it does |
|---|---|
.then(otherPath) |
adds another part. The robot drives on with no stop between the parts. Start the next part where this one ends, at the same heading, or the robot turns fast at the join. If otherPath has .holdEnd(), the whole path holds |
.maxSpeed(0.5) |
at most half of the robot’s top speed on this part (Pedro’s maxPathSpeed), for example near a field element. The limit starts where the part starts, so the robot brakes inside the part: give it room |
.holdEnd(), .holdEnd(seconds) |
keeps holding the end point after the robot gets there, for at most 5 s or your time (hold) |
The heading and maxSpeed settings work on the last part added so far. holdEnd() works on the
whole path. So write each part’s settings right after that part:
static final PedroPath TO_GOAL = PedroPath.line(-56, -61, -48, -50).keepHeading(0) // part 1 .then(PedroPath.curve(-48, -50, -44, -36, -30, -30)).turnTo(0, 45) // part 2 .maxSpeed(0.6) // part 2 only .holdEnd(); // the whole pathA path that comes straight back along itself: in the pretend-robot tests, Pedro’s own steering
took a shortcut onto the way back at once. Our progress measure handles such a path, but Pedro’s steering
does not. Use two follow steps, out and back, or a curve that turns around. Nobody has checked this on a robot yet.
Without then, each follow brakes to a stop at its end. So two follow steps in a row stop between them.
Hold the end point
Section titled “Hold the end point”With .holdEnd(), the follow step still ends when the robot gets to the end, so the next steps run.
But Pedro keeps the robot on that point: when another robot bumps it, Pedro pushes back. The hold ends at:
- the next
follow(the new path takes over), - the next driving step (
driveTo,move,turn,turnTo). That step ends the hold first, so the two never drive the wheels at once, - the end of the autonomous,
- its time limit: 5 s, or your own with
.holdEnd(seconds). Why: a robot wedged against something must not push for the rest of autonomous. When the limit ends the hold, the Driver Station showsPath: the hold ended after 5 s (its limit).
run, waitSeconds, waitUntil and alongside do not end the hold, because they do not drive the wheels.
Your own step(...) or an action that drives the wheels does not end it either. Call
robot.follower().cancel() first.
A PedroPath never changes. Every method (then, turnTo, holdEnd…) gives back a new path. So
TO_GOAL.then(...) makes a longer path and leaves TO_GOAL as it was. then also checks that the
next part starts where the path ends (within 0.5 in). If it does not, INIT stops.
Use the hold for a step that needs the robot still, for example waitSeconds while it scores. The Driver
Station shows Path: holding the end (0.4 in off): how far the robot is from the point.
Mirroring: with mirrorForRed() on, the step mirrors the path for RED (x and headings flip), like
every other step. Write the path once.
Tip: make each path once, as a static final field (see the example). It is the same every match.
Pedro’s own paths: follow also takes a Pedro Path (for example with Pedro’s other path modifiers).
Pedro’s paths use Pedro’s numbers, not ours (the frame). The step never mirrors them.
The frame
Section titled “The frame”Pedro uses the same x and y as we do. Only the heading is different. Pedro measures it in radians from the +x direction (right). We measure it in degrees from “away”. So:
Pedro heading = our heading + 90 degrees. PedroFrame.toPedro(...) and PedroFrame.fromPedro(...)
do it for you. PedroPath uses them, so you only need them for Pedro’s own paths.
Tuning Pedro
Section titled “Tuning Pedro”Tune in this order. Each step needs the one before it.
- The drive: motor directions and the drive check (Drive Tuner).
- The odometry: the library’s Odometry Tuner, then
Tunables.Odometry.checked = true(odometry). - Pedro’s Foresight tuner, which fills
PedroConstants. Set it up once:-
In
build.dependencies.gradle, add Pedro’s tuning library and the place it comes from:repositories {maven { url 'https://repo.dairy.foundation/releases/' }}dependencies {implementation 'com.pedropathing:tuning:1.0.1'} -
Copy the
pedro/proceduresfolder andpedro/Tuning.javafrom Pedro’s Quickstart into your TeamCode. ItsTuning.javais empty (// Tuners go here). Add this method to it, with the imports at the top:import com.crossbotics.ftchelper.pedro.PedroTuning;import com.pedropathing.tuning.autotune.Procedure;import com.pedropathing.tuning.autotune.Tuner;import org.firstinspires.ftc.teamcode.Robot;import org.firstinspires.ftc.teamcode.pedro.procedures.ForesightTuner;public class Tuning {@Tunerpublic static Procedure foresightTuner() {return new ForesightTuner(PedroTuning.localizer(Robot::new), PedroTuning.drivetrain(Robot::new));}}(If your files are in other packages, change the
RobotandForesightTunerimports.) -
Run it as Pedro’s tuning page says (the robot’s web page, “Foresight Procedure”). Copy the “Java” output into
PedroConstants. The tuner does not change your code, so copy the numbers back intoPedroConstants.javaevery time.
-
- Test before you trust it. This step is optional, but a good idea. Run Pedro’s “Tests” procedure
(Line and Curve tests). Add it to
Tuning.javathe same way, from Pedro’s testing page. Then run onefollowstep at low power (the PRACTICE profile).
Versions: use tuning:1.0.1, the version Pedro’s Quickstart uses. Its procedures files match
it. The tuning library asks for an older Pedro (3.0.x), and this module asks for 3.0.2. Gradle uses the
newer one, 3.0.2. That is correct: do not change it back. You need the repo.dairy.foundation line,
because the tuning library gets one of its parts (Sloth) from there. (Checked 2026-10-21.)
Take the tuner out before an event. Pedro’s tuning library runs a web page on the robot (the
“192.168.43.1:10158” page). This season’s rule R704.D bans “additional logging/streaming services”
like FTC Dashboard and FTControl Panels at events. Before an event, remove or comment out the tuning
line in build.dependencies.gradle. Also remove the pedro/Tuning.java and procedures files, or move
them out of TeamCode. Then build and install again. Your PedroConstants numbers stay, because the
follower does not need the tuner.
The tuner drives at full power. It uses Pedro’s own drivetrain, without the library’s power
limit (maxPower). Give it room, and keep a hand on STOP.
Skip Pedro’s localization tuners. Step 2 already tuned your odometry(...) line, and
PedroTuning.localizer uses it.
When is a path “done”?
Section titled “When is a path “done”?”Pedro decides. By default a path is done within 2.5 in of the end (translationalDeviationTolerance)
and 11.25 degrees of heading (headingDeviationTolerance). That is looser than driveTo (1 in,
2 degrees). To make it tighter, set them in PedroConstants. The heading is in radians, like
everything in Pedro:
c.translationalDeviationTolerance.set(1.0); // inchesc.headingDeviationTolerance.set(Math.toRadians(5)); // 5 degreesWhat runs every loop
Section titled “What runs every loop”- The odometry reads the device (first of all parts).
PedroLocalizercopies that pose for Pedro and works out the speed from the change since the last loop (Pedro brakes using the speed).- Only while a path runs or holds its end: Pedro’s Follower works out the wheel powers and sets them.
When no path runs or holds, Pedro sets nothing. So it never fights TeleOp driving or a driveTo step.
The power limit: no wheel gets more than the drive’s limit (Tunables.Drive.maxPower, or
practiceMaxPower in the PRACTICE profile). Every other drive in the library works the same way.
Brake or coast: Pedro brakes with power, on purpose, so it lets the wheels coast while it drives a path. After the path, the robot’s own setting (brake) comes back.
The drive motors’ run mode: autonomous runs the drive motors at a set speed (RUN_USING_ENCODER).
Pedro expects plain power. So during a path the library switches the motors to RUN_WITHOUT_ENCODER,
and puts them back after it.
At the end of a path the wheels stop, unless the path asks to hold the end.
Telemetry: Path: 18 in to go while a path runs; Path: holding the end (0.4 in off) while it holds.
Escape hatches
Section titled “Escape hatches”| You want | Use |
|---|---|
| Pedro’s own Follower (its debug data, its settings) | Pedro.of(robot) |
another drivetrain (for example Pedro’s Swerve) or algorithm |
follower(Pedro.follower((hardwareMap, localizer) -> new Follower(localizer, yourDrivetrain, yourAlgorithm))). Make the Follower with the localizer you are given. Not for tank: Pedro has no tank drivetrain |
| Pedro’s Mecanum settings from your drive line | Pedro.mecanumConfig(robot.drive()) |
| the pose for Pedro in a tool with no robot loop | PedroTuning.localizer(Robot::new) |
Pedro commands you start yourself (Pedro.of(robot).hold(...), manual(...)) do not run. The
library updates Pedro’s Follower only during a follow step and its hold. For a hold, use .holdEnd().
The simulator
Section titled “The simulator”Pedro runs in the simulator like the rest of the robot: follow steps drive the simulated robot.
See the path. The field map (Control Hub, Robot tab) and the 3D view draw two lines:
| Line | What it is |
|---|---|
| orange, dashed | the plan: the path the running follow step drives, with a ring at its end. It fades after the step ends |
| green | the trail: where the robot truly went, in its last 30 seconds of driving |
To check whether a curve hits a field element: look at the orange line first. If it crosses a
field element, change the path: move the control point, or add a part with then. Then run it and look
at the green line. Where the green line leaves the orange one, the robot did not drive the plan. Either
it bumped something (the robot turns red), or it was too fast to turn or brake in time (try
maxSpeed(...) on that part). The robot is wider than the line. So leave half the robot’s width (9 in
for an 18 in robot), plus a little, between the line and any field element.
Clear lines clears both. When you put the robot somewhere by hand, a new piece of trail starts.
The plan comes from PedroFollower.plannedPoints(): the running path as points about 1 in apart (at
most 200), in our field numbers, mirrored as driven. It only reads, and changes nothing.
The numbers. The simulator uses the numbers in PedroConstants. The Pedro example robot
(examples/.../pedrobot) has numbers measured on the simulated robot itself: we ran the measuring steps
of Pedro’s Foresight tuner in the simulator. So its paths brake the way the simulated robot brakes.
(Pedro’s Quickstart of 2026-10-15, on the example’s simulator robot file, with the tuner’s default
distances: 48 in, 30 in/s, 36 in. Measured 2026-10-21.)
Your robot needs its own numbers: tune on the real robot (Tuning Pedro).
Pedro’s Foresight tuner in the simulator: it runs in part. Pedro’s tuner menu (the robot’s web page) needs the real Robot Controller app, so it does not start in the simulator. Its measuring steps are plain OpModes, and those do run there. They need the robot’s speed. When we worked out the speed from the simulated odometry, it was too uneven: the tuner gave different brake numbers every run. With the physics engine’s own speed, it gave the same numbers every run (within a few percent). The example’s numbers come from that. They are not a real robot’s numbers. For example, the simulated robot coasts to a stop more slowly than a real one.
If something goes wrong
Section titled “If something goes wrong”| Problem | Cause | Fix |
|---|---|---|
| INIT stops: “follower(…) needs an odometry(…) line too” | no odometry line | add odometry(...) |
| INIT stops: “Pedro.follower needs a mecanum drive(…) line” | a tank drive | Pedro needs mecanum. Use turnTo and move |
| INIT stops: “follow(…) needs a path follower” | a follow step but no follower line |
add follower(Pedro.follower(...)) |
the report says skipped for every follow |
Tunables.Odometry.checked is false |
run the Odometry Tuner, then set it true |
| the robot drives the wrong way | a reversed drive motor, or the odometry’s x/y swapped | run the drive check and the Odometry Tuner again |
| it overshoots and comes back | PedroConstants not tuned (the example robot’s numbers) |
run Pedro’s Foresight tuner |
| it stops a little short | Pedro’s “done” distance is 2.5 in | tighten it |
| it is slow | Tunables.Drive.maxPower is low (or practiceMaxPower, in PRACTICE) |
raise it |
| Pedro’s tuner does not compile | the tuning library or its repository is missing | step 3 of Tuning Pedro |
Known Pedro bug (fixed in 3.0.2, checked 2026-10-21 with the issue’s own test): in Pedro 3.0.1, a path with “hold the end” off stayed “busy” forever (Pedro issue #191). This module checks Pedro’s mode instead of its busy flag, so it works with both versions.
Something wrong on this page? Tell us with a short GitHub form.