I successfully generated .csv files using the Motion Profile Generator tool found here.
How do I use the values in the .csv files in my autonomous code?
I successfully generated .csv files using the Motion Profile Generator tool found here.
How do I use the values in the .csv files in my autonomous code?
You have to find a way to send the files over to your roboRIO (ssh works), and then read them from your code.
OK, but how do I incorporate the values into code? Do I use them in a PID loop? And how would I ensure that the robot is following the waypoints?
You can implement them by using something similar to the code here but instead of an array of waypoints read from the files like this
File leftFile = new File("/path/to/left/trajectory/on/roborio.csv");
File rightFile = new File("/path/to/right/trajectoryon/roborio.csv");
Trajectory leftTrajectory = Pathfinder.readFromCSV(leftFile);
Trajectory rightTrajectory = Pathfinder.readFromCSV(rightFile);
In the installation instructions, it says:
Copy the Pathfinder-Java jar file to <user home>/wpilib/user/lib. In your project, open the build.properties file and uncomment the line #userLibs=${user.home}/wpilib/user/lib (remove the # from the front to uncomment).
Do I copy the Pathfinder-Java jar file from \Pathfinder-master\Pathfinder-Java\build\libs\Pathfinder-Java-1.8.jar? Or from somewhere else? - this wasn’t specified.
Also I do not have a build.properties file in my WPILib Project (VS Code), so I cannot uncomment that line that is mentioned. Is it safe to skip this step?
Those instructions are intended for the eclipse plugins (i.e. last year). If you’re using GradleRIO, I’m fairly sure that you can just add the following line in the dependencies {} section of your build.gradle:
compile pathfinder()
The wiki has detailed step-by-step instructions that go over implementing the follower in your code.
Thanks everyone for your help.
One last question, how do I calculate the max velocity, max acceleration and jerk of the robot? Is it something I have to test and figure out or can I find it based on my drivetrain components?
Don’t worry too much about jerk.
Read the drivetrain characterization whitepaper in my sig for information that will help with velocity and acceleration.