One or two more things for today. I found that changing the ramsete gain parameters allows the simulated robots to perform much better. (2 -> 3.5, 0.7 -> 0.35) Also, I was able to get pathfinder trajectory creation to work on the roboRIO. I have a new robot sample project that uses this. (There are now 4 sample robot projects and a sample dashboard for running with the simulated robots.) This isn’t posted yet. Hopefully today or tomorrow.
Absolutely I’m interest in the newest code. I can say without reservation that barring a major problem, this will be our navigation system next year. Our current system works well and is very quick to create a new auto, but it’s not as accurate as trajectory planning.
I was going to go through and start commenting it thoroughly, but if you’re still updating it I’ll wait. If you want to tell me VI’s that you aren’t touching, I can go through and thoroughly comment those and send them back to you. I want these to be understandable from the viewpoint of my incoming freshmen. I’m pretty excited about this! Working through it and understanding it is a great placeholder for robotics meetings.
As far as I’m concerned, once you are done this should be incorporated into the basic robot project in the same way that WPILib gives new java/etc programmers the ability to do trajectories.
Here is a mostly up to date snapshot of the library.FRC_LabVIEW_Trajectory_Library_Routines_00_01.pdf (76.8 KB)
Another quick note before I forget. When originally creating this library using only the Pathfinder “paths”, I implemented a way to execute a trajectory backwards. This allowed a robot to use the same trajectory data structure in either direction. When implementing the WPI library calls this functionality disappeared, but I’ve been thinking about resurrecting it, at least as part of one of the samples.
Damn. That’s a lot of work on your part. Thank you so much.
I posted the ZIP file of library version 1.1. Use the original link. Make certain to get the file with the newest date and version, since both ZIP files are sill there.
This version has a much more complete implementation of the spline routines, a more complete implementation of the ramsete controller, 2 additional robot samples, and some other things.
Documentation is still a work in progress. There is a spreadsheet listing what is and isn’t done yet.
For convenience, here is the link (same link as the first post).
https://drive.google.com/open?id=14KZICKT-SQjeS49M0bDEz_fxdLbrXlEP
Jim S.
Those three and SwerveControllerCommand in place of RamseteCommand and RamseteController. Ironically, that’s actually significantly easier; it’s just three individual controllers for the two axes and rotation. All the fancy stuff is in the kinematics and odometry.
I’ll have to take a closer look at whether to also include generic swerve classes or not. I don’t think I need to, but at that point I might just do it for completion.
Jim, I was playing with this today and I noticed that when I use the pathweaver utility to generate a path, even with the dT set to .020, the resulting output file is in steps of .060
Out of curiosity, I switched over to the trajectory utility, the time steps are variable. For instance, for the default path, the time steps look like this:
#-------- Time
0
0.33561
0.47256
0.5763
0.66269
0.73791
0.80515
0.86633
0.9227
0.97516
1.02434
I was always under the impression that for these trajectories you would expect to see regular time intervals - and with the pathfinder dt set at .020 I would expect 20 ms intervals. Are my assumptions wrong?
I sent you a direct message with more information… The WPILIB routines output samples based on deviations so the samples don’t have an even dT. I haven’t looked at the source of PathWeaver so I don’t know what it does. The library has a trajectory sample routine to get an interpolated sample given any time. I kept this as it was for the LabVIEW library.
Are you talking about Pathweaver (not Pathfinder)? Pathweaver removed dt settings for 2020 because they don’t make sense anymore.
I’ve been trying to run a trajectory I made using the utility in the sample 2 program but I cant find where I would put the file name/path in the sample 2 program to read the trajectory file. Could someone tell me where/how I would make the sample 2 program read my trajectory file?
Hello. A couple of notes first:
-
there is a newer post for this library here… Somewhere it this thread is a picture of all the different ways to create a trajectory. LabVIEW Trajectory Library (WPILib port) V1.3 - #8 by JSIMPSO
-
Make certain that you have the latest version of the library installed (1.3-12). Use NI Package manager to uninstall any old versions first. On Windows start menu…
Then
Then install the new version.
On to your question. Robot Sample 2 reads a CSV file into a Trajectory cluster data structure. This is done from the BEGIN.VI which calls TRAJECTORY_READFILE_BEGIN.VI (Note that all the custom code for this sample is in this virtual project directory.
Here is the section of BEGIN.VI
There is an optional filename input to this VI. The sample uses the default. Here is a screenshot of the front panel with the file name.
You can add the input parameter to BEGIN.VI to make the filename whatever you want.
Now to the tricky part. The CSV file, “Sample-Robot-2-Trajectory-TrajLibrary.csv”, has to be copied someplace useful for it to be read. If you are running the simulated robot on a PC then the file has to be copied to the "%HOMEDRIVE%%HOMEPATH%\Documents\LabView Data" directory. If you are running the sample on the robot then the file needs to be copied to the NI RoboRIO and placed in the “/home/lvuser/natinst/LabVIEW Data” directory. The LabVIEW project has a build specification to help do this. As far as I can tell this is a two step process. Right click and select Build. When this is done, right click again and select Deploy. (I could be wrong about needing both steps.)
Hope this helps. If I didn’t read your questions correctly let me know.
Jim: First thanks for doing all this - great stuff - as well as your update of Secret Book.
Wehave recently been testing out the trajectory routines. We have been successful running the simulator versions - and have made our own custom trajectories there. More recently have been trying to get them to go on the robot, and have been stuck.
We have followed above directions, used the build specification (CopyTrajectoryDataFileToRobot) to put in on the RoboRio, after deploying, it seemed to have been successful in getting it there. Then we build code and Run As Sartup but when it goes through the Begin an error comes up on the driver station that it cannot read/finf the file. We have tried it with the default as well as a custom trajectory. Any thoughts?
Your welcome. I’m glad you were able to get some use from it. It has been a pleasure to work on the library.
First, just in case, I’d suggest that you get the newest version of the library. It is version 1.4. The link at the bottom has a link to that post. It is a real NI package. You can look at the NI package manager to see what you have installed.
I’d suggest the following to diagnose:
-
What happens when you download “Sample 2” to the robot and run it. (You don’t have to enable the robot. It just needs to get through Begin.VI and start writing to the dashboard.) There is a “Traj/IsGood” network table variable that should tell you if it could read the file or not. (If this doesn’t work then I have a bug!!!) You will need to change your team number in the Target. (Right click, select properties and change the 99xx value to your team number.)
-
I’d suggest not putting any spaces in the file name. (I’m not certain how my code deals with this. It maybe okay, or maybe not…) Also make certain the file name contains the extension. The read routine doesn’t automatically append .csv to the file name.
-
When calling “Util_Trajectory_ReadFile.VI” on the robot if file name starts with a “/” it is considered an absolute path. Otherwise it looks for a file relative to “/home/lvuser/natinst/LabVIEW Data” on the RoboRIO.
-
I’d be happy to look at your code if you like. If you can zip of the project and make it available. Make sure to include the trajectory file too. Send me a direct message on Chief Delphi with instructions on how I can get the file. I don’t have a robot to test with but I do have a roboRIO.
If possible it might be best to continue the discussion on the post of the newest library…
Hope this helps.
One more quick thought.
- Likely the RoboRIO linux file system is case sensitive so make certain the file name in your call to the read file VI and the actual file name match exactly.
One last thought.
- To debug, enable “+prints” on the driver station and reboot your robot code. The trajectory read VI will write an informational line to the log about what it tried to do. The picture shows the Network Tables value from the sample 2 robot and the driver station log file.
Thanks for quick reply. I have been running 1.4.
I started with sample 2 in the 1.4 library (same as had used in simulation mode), updated the target, modified the drive motors and encoders to be consistent with our robot (Talon FX’s).
Left the trajectory read in the begin as is with the default file name (also tried inserting a name but no difference)
Before this I ran the utility to put the file on the RoboRio and it seemed to say it was ok but maybe it wasn’t?
As soon as it hits the Begin it sends a message that it can’t find the trajectory file. We can drive the robot when not in trajectory following mode, (and tuned the PID).
I will try your other suggestions - and provide more detail of the exact error message we are getting. Probably not until tomorrow.
Thanks.
There are a number of ways to look at the robot’s file system. Putty(ssh), FTP. Here is a screen shot from firefox of what I tried last night.
Still perplexed:
Checked on file on the Rio - it appears to be there and correct:
Execute the program and get this message on DS:
You can see it is looking for the right filename as was listed on the Roborio directory.
Saying it cannot find file at that location. Rest of program runs fine.
The file path names are not the same:
“LabVIEW Data” vs “LabVIEW data”
File names are case-sensitive.
Doh! Thanks Mark! missed that.