Implementing the PathWeaver/Path Planning in Java VSCode

pathplanning
java
wpilib

#1

Hello!

I am the head programmer of my robotics team and I recently discovered the PathWeaver. I never have used this in the past, but I am wondering, once you create a new path or path group in the tool, how do you then implement that path into one’s Java Robot Project?

Additionally, It appears that the new game field is not currently an option for PathWeaver. I am wondering if anyone knows when this map is being released, or if there is some way I can make one myself for this year’s field.

Thanks,
Flash
:zap:


#2

Also, I was wondering whether people think that using path planning or vision would be better this year for auto?


#3

Vision would definitely be better for auto. Lots of things can go wrong with just using encoders and gyro sensors. By using vision, if you’ve tuned it, it almost guarantees that it’ll be in the right place.


#4

Both?

Use a motion profile to get you close to where you want to be and then use vision/alignment line to do the final approach. This would be necessary for sides of the cargo ship or the back of rocket.


#5

I will try to do this. I didn’t think of doing both. Thanks!


#6

There’s a zipfile you can download and use with pathweaver to get the right field image: https://github.com/wpilibsuite/PathWeaver/pull/132


#7

Thanks for this!


#8

In regards to your original question, first hasn’t yet published an official way to use the paths created in pathweaver in your code, however, what you can do is find the csv files generated from pathweaver and put them into your roborio’s file system, via something like putty or a remote system explorer, then you can access those files and implement them in your code via the steps Jaci implements in her Pathfinder v1 wiki

Also, the field for deep space is available for pathweaver, but it isn’t an option by default, to make it an option, follow the steps here.


#9

If you are using the Java/C++ there is a deploy sub-directory in your project, put your paths there and then in java use:

Filesystem.getDeployDirectory()

get the path on the system to read the path. We have pretty good path following code from last year, if you are using talons on your drivetrain it is a good start in java.

I am guessing it is really similar in C++, but let me know if you cannot figure it out.


#10

This seams very helpful since I use Java and my team uses Talons… Thanks! I will let you know if I am having any more trouble :+1:


#11

If you’re using Talon SRX’s, CTRE has a great document here which goes into excruciating detail on how to create, load up, and manage trajectory points in all FRC languages. I think the API for the Victor SPX is similar if not the same.

To load up the CSV file into java, you’ll want to use the following code from Jaci’s example, also mentioned by @Tieguy01 above.

Binary File:

File myFile = new File("myfile.traj"); 
Trajectory trajectory = Pathfinder.readFromFile(myFile);

CSV File:

File myFile = new File("myfile.csv"); 
Trajectory trajectory = Pathfinder.readFromCSV(myFile);

#12

@mrEkko , @Tieguy01 I will try doing this then! thanks!


#13

I should also point out that there is a new, simpler API for firing MPs .
This no longer requires you to perform your own buffering.

Single axis…

Drivetrain with Pigeon…

But we kept the more comprehensive API, so legacy code works, and more advanced teams can directly manage the MPB and MPE.


#14

Its the same API. Instead of selecting an onboard ribbon-cabled signal, you select remote filter 0 or 1, and config remote filter to to a Canifier, Pigeon, Talon, etc.

Also anything a Victor SPX can do, a Talon SRX can do, so the remote api works everywhere.


#15

Awesome that it’s been dumbed-down a bit. Will make it much easier for young/new teams to pick up.

Do you have a link to a newer documentation PDF for the new API? Like this one, but updated. This old one was very clear and helpful and the new docs don’t go into as much detail in the actual API.

For instance, the config API is recommended to be used here, but some of the settings/functions are unclear and I don’t see where the class itself is covered except for the API reference and the github examples page.