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
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?
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.
the path planner Labview has sample robot projects that read and follow a path/trajectory.
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.
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. ;
Without external position information (visual April tag position), the position error increases with time as the robot moves.
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.
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.
Here are the steps to following a path/trajectory ( This is for Path Planner, but the WPI routines are similar ).
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. )
This needs to be stored for later use. 1) and 2) often are put into begin.vi.
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.
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.
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.