# Pedro Pathing

Pedro Pathing is a library for FTC which allows you to follow paths on the field with your robot.

Unlike conventional pathing systems such as RoadRunner, Pedro Pathing leverages Bézier curve generation to produce smoother, faster, and more efficient trajectories. Its primary focus is on enhancing the adaptability of robots during autonomous operation by reacting dynamically to environmental changes, reducing error margins, and ensuring optimal path execution. You can learn more about Pedro Pathing here.

For this tutorial, we will use a mecanum chasis with a GoBilda Pinpoint Odometry Computer for feeding position to Pedro Pathing. The process is very similar with other localization systems.

Notes (these will be useful to know for the following steps):

  1. Open the Constants file located at TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/Constants.java in Android Studio
  2. Read this page, it will explain what the Constants file entails
  3. Replace the current imports of the Constants file with the following (Pedro Pathing is not very clear about imports in their documentation):
import com.pedropathing.follower.Follower;
import com.pedropathing.follower.FollowerConstants;
import com.pedropathing.ftc.FollowerBuilder;
import com.pedropathing.ftc.drivetrains.MecanumConstants;
import com.pedropathing.ftc.localization.constants.PinpointConstants;
import com.pedropathing.paths.PathConstraints;
import com.pedropathing.control.PIDFCoefficients;
import com.pedropathing.control.FilteredPIDFCoefficients;
import com.qualcomm.hardware.gobilda.GoBildaPinpointDriver;
import com.qualcomm.robotcore.hardware.DcMotorSimple;
import com.qualcomm.robotcore.hardware.HardwareMap;

import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit;
  1. Set up some of your robot's characteristics using this
  2. Use this page to set up Pinpoint localization, if you aren't using a Pinpoint, select your localizer here and set it up accorrdingly, make sure you change the import statement
  1. Run the localization test if you haven't already at the bottom of the localizers page
  2. The Automatic Tuners are extremely simple tuners that perform a test and output a value which you can put in your Constants file
  3. This page explains how PIDs work in Pedro Pathing, you should read this page to guide your setup. Using the Dual PID system is recomended for accuracy.
  4. Watch this video to tune the Translational PIDF controller, once you complete the tuning, save the values as shown here
  5. Watch this video to tune the Heading PIDF controller, once you complete the tuning, save the values as shown here
  6. Use this guide to tune the Drive PIDF and braking constants. Braking strength and braking start are the last 2 values of PathConstraints in the Constants file. Don't worry about filter tuning, just use defaults.
  7. Watch this video to tune the centripetal factor, once you complete the tuning, save the values as shown here

Thats it for tuning, try all of these test programs to make sure you did the tuning correctly, after this, we're ready to code!