⤴️Path Planning

PathPlanner Set Up:

  1. Go to https://github.com/mjansen4857/pathplanner and click on PathPlanner v2022.1.1, which is the latest release of PathPlanner.

  1. Scroll to the bottom and download and extract the PathPlanner zip file corresponding with your computer’s operating machine.

  1. In your downloads, open the pathplanner folder and open the pathplanner application

  1. Once you open pathplanner, click open robot project and click the project called deploy

How to use pathplanner:

  • To change the robot’s dimensions, go to settings and edit the width to whatever the robot’s dimensions are. The units are in meters.

  • To create a new path, click the Add Path button.

  • If your robot’s drivetrain is a swerve drive, turn on Holonomic mode under settings. Otherwise, if your robot’s drivetrain is a tank drive, leave Holonomic mode off.

  • If you want to change the position of a robot at a certain point in the path, you can either drag the robot icon to a certain point on the field or click on the big dot at the center of the robot icon and change the x and y position

  • If you are not using Holonomic mode and you want to change the angle of the robot at a certain point in the path, you can either change the angle of the black line to a different angle or click on the big dot at the center of the robot icon and change the heading

if you are using holonomic mode, you cannot change the angle of the robot

  • To change the robot’s path between two points, change the angle of the black line connected to the robot icon at that position position

if you are not using holonomic mode, changes to the path will also change the robot’s heading at certain points on the path

  • To add a point to the trajectory, double click on the point on the field that you want the robot to travel to

  • To delete a point in the trajectory, click on the dot in the middle of the robot icon at the specified point and then click the trash can icon

  • If you want to play a path to see how the robot moves along a specified path, click the play button at the bottom of pathplanner

  • If you want to stop playing a path, click the edit button next to the play button

  • If you want to change the max velocity and max acceleration of the robot, click the play button and edit the max velocity and acceleration as appropriate

  • To duplicate a path, click the three lines in the upper left corner of pathplanner, drag the specified path to the right, and click the blue duplicate button

  • To delete a path, click the three lines in the upper left corner of pathplanner, drag the specified path to the right, and click the red trash can button

Generating a trajectory using code:

  • First, set up the config of the trajectory, containing the max velocity and max acceleration while the robot is following the trajectory

  • To create a starting point, create a new Pose2d object with the initial x and y coordinates as well as the initial heading of the robot.

  • Next, create an ArrayList containing all the points

  • Add all the points you want the robot to travel to to the ArrayList as Translation2d objects

  • Create Pose2d objects with the positions of the points

  • Create a trajectory object with the parameters as the points you are trying to connect, the interiorWaypoints ArrayList, and the trajectory config object

  • To connect more than 2 points, you must create multiple trajectories and then concatenate the trajectories

Last updated