Help with PathPlanner Labview

Our teaming has been working on trajectory planning using LabVIEW and Path Planner so far we have gotten the robot to read a CSV file but it does follow the path we drew at all it just drives in a straight line. Any advice we be appreciated

WE ARE NOT SWTICHING TO JAVA!

2 Likes

What type of drivetrain are you using? Tank or swerve?

Can you post any links to (or screenshots of) your code so that others may be able to assist?

We are running a swerve drive

Here is the link to our code :grin:

There is a pathplanner labview library here. It contains examples. It will be a complete port of PathPlannerLib. Right now everything is done except for the path finding and obstacle avoidance.

Our team is also trying to get Path Planner to work in LabVIEW. We have managed to use the Path Planner interface to create a path that we want to test in our robot. Our question is, where do we run the code from the Path Planner libraries that reads the .path files. Is it in a separate VI, or do we place this code directly into autonomous?

Here is the code we are trying to read.

When we open the “Read Path File Create Trajectory” VI in the Path Planner Libraries it also says that the ChassisSpeeds_New.vi is missing.

Hi. I’m not at home right now. I’ll send a more detailed response when I get home. 1) it sound like the prerequisite math library needs to be installed.

Go to releases to get install files.

  1. the path planner Labview has sample robot projects that read and follow a path/trajectory.

Jim.

1 Like

Okay. Here is some more detailed information.

A couple of trajectory basics first:

  1. There are absolute and relative trajectories. An absolute trajectory is based on the origin of the field. This is the type that PathPlanner makes. Relative trajectories use the robot position at the start of the trajectory as the origin.
  2. Either type of trajectory requires that the robot determine its position on the field. This is known as Odometry or Pose Estimation. Absolute pose estimation requires knowing where the robot is when it starts or requires external position information, for example visual indication of position using cameras and photonvision locating April Tags. ;
  3. Without external position information (visual April tag position), the position error increases with time as the robot moves.
  4. There are several different path / trajectory following programs. The WPILIB LabVIEW math library contains the LabVIEW version of the WPI trajectory routines (with some enhancements). These can create an follow relative or absolute trajectories too.
  5. The WPI trajectory routines do not separate the the direction the robot is traveling and the direction the robot is pointing. For mecanum and swerve robots this can be different. PathPlanner and Choreo both separate these.
  6. There are a number of presentations on path/trajectory following. They are worth hunting down and reviewing. ( I have one here, but there are better ones … FRC_Secret_Book_Of_FRC_LabVIEW_2/ControlTheoryTraining/module20_PathFollowing at main · jsimpso81/FRC_Secret_Book_Of_FRC_LabVIEW_2 · GitHub

Here are the steps to following a path/trajectory ( This is for Path Planner, but the WPI routines are similar ).

  1. Read the path file. The path file has to be copied to the roboRIO first. The help for the read file has documentation on where the default roboRIO directory is. I’d suggest using the default. I think that you can use FTP (something like WinSCP to copy the file. There is also a way to update the robot build spec to do this automatically. I’ll make a separate post on this. )

  2. This needs to be stored for later use. 1) and 2) often are put into begin.vi.

  3. Odometry has to be maintained. If using absolute odometry, it has to be maintained throughout the game. Here is an example for swerve drive. Begin

PP-Swerve-Odom-Init

PeriodicTasks. in a 20 millisecond loop…

  1. When you want to execute the trajectory (in autonomous or teleop) execute the trajectory. Here is a sample for swerve drive. The init value has to be true the first time the trajectory is run so it can init the trajectory sampling. Lots of ways to do this. This example used Edge On detection of the joy stick button that runs the trajejctory.

The zip file included in the path planner labview install files, contains a sample robot that creates, and executes a path. Reading a path from a file is similar. I took the screen shots from slightly modified code of the sample.

Hope this helps.

1 Like


This is what we have for begin does this look correct if so can you provide a screen shot or image on how we should proceed with periodic task

The easiest thing to do is look at the examples. There is a ZIP file with simulated robots that run pathplanner trajectories on a computer. You can see the results.

Hello Jim,

we are trying to use Choreo but it appears to only output .traj files. The Choreo VI’s are looking for .json files. I was able to manually open the .traj file and reformat it into a json file by moving the time stamp and angular velocity lines of code to match what is shown in your examples and it works. Is there a more practical way of reading the files? I am also having a similar issue with pathplanner in that I can only seem to make it produce a .json file while the samples for path planner are looking for .csv files. Any help would be greatly appreciate it.

What I’ve found so far is that there has been a formatting change in the .traj file being exported.

This is what Choreo 2024.0.4 looks like:
CHOREO 24.04

This is what Choreo 2024.2.0 looks like:

Choreo 2024.2