Skip to content

Getting Started

Welcome to Pedro Pathing Plus! This guide will walk you through creating your first autonomous program using the library.

Before you begin, ensure you have:

  1. Installed Pedro Pathing Plus in your project (see Installation).
  2. Configured your robot’s hardware map (motors, sensors) in the Driver Station or FtcRobotController.

The modern Pedro Pathing Plus workflow is “Visualizer-First”:

  1. Design your path in the Visualizer web interface.
  2. Export the path as a complete Java OpMode.
  3. Run the generated code on your robot.

This approach eliminates the need to manually write complex geometry code and ensures your paths are visualized correctly before you even touch the robot.

Go to the Pedro Pathing Visualizer (or your hosted instance).

  1. Click the + (Add Path) button or press P.
  2. Click on the field to place your starting point.
  3. Click again to place the end point.
  4. Drag the control handles to shape the curve if desired.

When you are ready to export, you have two options: a standard Java OpMode or a Command-Based structure.

Use this option if you want a standalone OpMode that handles the path following logic directly.

  1. Click the Export button in the top right corner.
  2. Ensure “Java OpMode” is selected.
  3. Check “Generate Full Class”.
  4. Enter your team’s package name (e.g., org.firstinspires.ftc.teamcode).
  5. Click Copy to Clipboard.
  6. Paste the code into a new Java file in your Android Studio project.

Below is an example of the auto-generated OpMode. Note the use of PanelsTelemetry and Constants.

package org.firstinspires.ftc.teamcode.Commands.AutoCommands;
import com.bylazar.configurables.annotations.Configurable;
import com.bylazar.telemetry.PanelsTelemetry;
import com.bylazar.telemetry.TelemetryManager;
import com.pedropathing.follower.Follower;
import com.pedropathing.geometry.BezierCurve;
import com.pedropathing.geometry.BezierLine;
import com.pedropathing.geometry.Pose;
import com.pedropathing.paths.PathChain;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.util.ElapsedTime;
import org.firstinspires.ftc.teamcode.pedroPathing.Constants;
@Autonomous(name = "Pedro Pathing Autonomous", group = "Autonomous")
@Configurable // Panels
public class PedroAutonomous extends OpMode {
private TelemetryManager panelsTelemetry; // Panels Telemetry instance
public Follower follower; // Pedro Pathing follower instance
private int pathState; // Current autonomous path state (state machine)
private ElapsedTime pathTimer; // Timer for path state machine
private Paths paths; // Paths defined in the Paths class
@Override
public void init() {
panelsTelemetry = PanelsTelemetry.INSTANCE.getTelemetry();
// ...
panelsTelemetry.debug("Status", "Initialized");
panelsTelemetry.update(telemetry);
follower = Constants.createFollower(hardwareMap);
// Determine starting heading: prefer geometric heading when a path exists, otherwise fall back to explicit startPoint values
follower.setStartingPose(new Pose(56.000, 8.000, Math.toRadians(90.000)));
pathTimer = new ElapsedTime();
paths = new Paths(follower); // Build paths
}
@Override
public void loop() {
follower.update(); // Update Pedro Pathing
pathState = autonomousPathUpdate(); // Update autonomous state machine
// Log values to Panels and Driver Station
panelsTelemetry.debug("Path State", pathState);
panelsTelemetry.debug("X", follower.getPose().getX());
panelsTelemetry.debug("Y", follower.getPose().getY());
panelsTelemetry.debug("Heading", follower.getPose().getHeading());
panelsTelemetry.update(telemetry);
}
public static class Paths {
public PathChain line1;
public Paths(Follower follower) {
line1 = follower
.pathBuilder()
.addPath(
new BezierLine(new Pose(56.000, 8.000), new Pose(56.000, 36.000))
)
.setLinearHeadingInterpolation(Math.toRadians(90), Math.toRadians(180))
.build();
}
}
public int autonomousPathUpdate() {
switch (pathState) {
case 0:
follower.followPath(paths.line1, true);
setPathState(1);
break;
case 1:
if (!follower.isBusy()) {
setPathState(2);
}
break;
case 2:
requestOpModeStop();
pathState = -1;
break;
}
return pathState;
}
public void setPathState(int pState) {
pathState = pState;
pathTimer.reset();
}
}
  • pathState: A state machine variable that tracks which segment of the path is currently running.
  • Paths Class: Contains all your generated PathChain definitions.
  • autonomousPathUpdate(): The logic that switches between paths and waits for completion.