Pedro Pathing 1.1.0 has released! If you haven't already, migrate now.
Pedro Pathing LogoPedro Pathing

Drive

The Drive PIDF manages acceleration and braking along a path, ensuring smooth motion and minimizing overshoot.

Setup

  1. Open Panels. If you haven't used Panels before, you can read the documentation on the Panels tab of this website (You can switch on the Top Left of the Website).
  2. On your Driver Hub or Driver Station, and connect a gamepad to it. Make sure to press "start" + "a" on the gamepad.
  3. Select the Tuning Opmode. Use your gamepad to select the Manual folder. Then, select Drive Tuner.
  4. Run the run the OpMode.

WARNING: Immediately after running the Drive Tuner Opmode, the robot will move straight back and forth 40 inches. Make sure you have enough space before running this opmode. You can adjust the distance the robot drives back and forth through Panels.

Tuning Process

Follow this video to help you tune the PIDF: TODO: THIS WILL NEED TO BE UPDATED LATER

Setting the Zero Power Acceleration

Go to the line public static PathConstraints pathConstraints = new PathConstraints(0.99, 100, 3, 1);. If for some reason you don't have it, feel free to add it in. The third number in new PathConstraints(0.99, 100, 3, 1) is your zero power acceleration multiplier (ZPAM). The ZPAM affects the speed of your robot's deceleration at the end of a path.

  • Higher ZPAMs will allow your robot to have faster braking at the end of the path, but at the cost of more oscillations and a less accurate localization.
  • Lower ZPAMs will cause your robot to have slower, but smoother braking at the end of the path, reducing oscillations.

The ZPAM should ideally be somewhere between 2 to 8.

The ZPAM you set in the Constants class will be the default ZPAM for all paths the robot follows.

Note: You can set ZPAMs individually for specific paths using the setZeroPowerAccelerationMultiplier() method on a Path.

TODO: Go through this process in more detail

  1. Observe how the robot moves back and forth through its path.
  2. Adjust the PIDF constants (drivePIDFCoefficients) in the FollowerConstants tab of Panels to ensure that the robot accurately drive straight back and forth with minimal oscillations. If you do not have prior experience with tuning PIDFs, we reccommend that you check out the resources provided at the bottom of the PIDF Tuners page to learn more about tuning PIDFs.

If you have a dual PIDF system enabled, it is recommended to first tune the main PIDF, drivePIDFCoefficients, to ensure that the robot can smoothly correct back from large errors. Then, tune the secondary PIDF, secondaryDrivePIDFCoefficients, so the robot can smoothly correct from smaller errors.

Warning: After adjusting a value in Panels, hit "enter" in order to save it and cause the robot to correct differently. However, any values you modify through Panels are not saved into your code! In order to transfer the values you just tuned on Panels into your code, go to the Update Tuned Values section to learn more.

Feedforward Adjustments (Optional)

If additional feedforward is needed, use the feedforward term directly in the drivePIDFCoefficients and/or secondaryDrivePIDFCoefficients if you are using dual PID.

Update Tuned values Into Your Code

  1. Once you are satisfied with your drivePIDF values, head over to the Constants file.
  2. Navigate to the line .drivePIDFCoefficients(new FilteredPIDFCoefficients(0.1,0.0,0.01,0.6,0.0))
  3. Update the parameters in new FilteredPIDFCoefficients(0.1,0.0,0.01,0.6,0.0) with the drivePIDFCoefficients values, P, I, D, F, you tuned on Panels in that order.
  4. If you are using the dual PIDF system, add the line .secondaryDrivePIDFCoefficients(new FilteredPIDFCoefficients(0.1,0,0.01,0.6,0.01)) and update the secondaryDrivePIDF values you tuned on Panels.

Troubleshooting

If you encounter a problem while tuning the Drive PIDF, check out the troubleshooting page.

Last updated on