ZQ’s long winded ramble about trials and tribulations. Feel free to skip ahead
My team has always had problems trying to do trajectory following with our robots, and we’ve often been jealous of robots making smooth, complex paths on the field, while ours uh… do the jerky “i-think-this-is-where-i-need-to-be” driving. Apart from the usual problems of not having a robot ready until 10 minutes before our first match, it’s been extra hard last year (and this year), since we are fully remote, and have no access to our robot, nor a build space. With the Romi however, we can get a lot more students learning how to path-plan and get familiar with the WPILib Trajectory system.
Now you too can slalom at home with your Romi! I built a modified version of the RamseteCommand WPILib example and added in a bunch of extra waypoints.
The drivetrain constants were found using the frc-characterization tool, and a Romi characterization template project. The README on that link has a little more information on how to use frc-characterization to get useful numbers about your Romi. The constants defined in the Romi trajectory project were based off a stock Romi kit with no additional components. You may need to tweak values a little to compensate for physical differences between the Romis, or better yet, characterize your own!
Hopefully this helps more teams learn about the joys of trajectory following, on a smaller scale
As the trajectory stuff is very new for me, would you be able to provide a screenshot of what the data analyzer screen looked like for you? It took me awhile to figure out that I needed to change the units to meters in that screen for the trajectory project. Then it took me awhile longer to figure out that I needed to put in 0.219 for the units per rotation. Now I’m wondering if I need to adjust the max controller output and max acceptable control effort for the romi project, and if I should use the WPILib gain settings preset or something else.
This is incredible. Thank you for sharing this with us and as others have said, the docs help us understand how to get it going for ourselves, I was close to figuring it out, but there are so many pieces and we have had a few other projects come through that take precedence. This is such an exciting project and the trajectory feels like the culmination of it. And yet, there is so much more we can do with these bases.
Very cool! Our team experimented with trajectory profiling last year and are trying to improve it. I’m using the Romi, but when I put some coordinates in and run it, the Romi spins around instead of doing what I plugged into it. Do you have any suggestions on how to fix it? Thanks!
I had a similar experience with an earlier release of WPILib. They recently fixed a few things, including the gyro calibration.
Make sure you are fully updated to the latest release of WPILib 2021.2.1 which is just a few days old. You need to update your WPILibPi image and then also the firmware on your Romi, and recalibrate the gyro.
Thanks veg for the response so quickly! Everything was up to date, but I realized that I had inverted the right motor when running usual code, and when I used this code the tankDriveVolts() method inverted it again, so it created the spinning. Now it works. Thanks though for the advice!
Did you fill in all of your robot data in the python code? In the instructions it says to make sure you’re saving it and fill out the settings, including filling out team number, units, units per revolution, and all the python code below.
Do you get this error with a normal program and the Romi? If not, did you open the entire repo as a project, or just the trajectory example? The repo has 3 projects in it, and vscode may not know which to launch. There are other possible path errors that can occur from just launching a repo from a random downloads folder too. I would suggest creating a new window in vscode and adding the downloaded folder (just the root of the trajectory example) to that project. Then try to run simulation.
First time getting this error, no other programs get it. (Also asked my lead programmer to run it and got the same error, assuming we are doing something wrong) I’ve only opened the characterization folder not either simple-arm or Romi-trajectory, not sure what you mean by putting the entire download folder in vscode.
However I have noticed wpilib wants me to download 2021.2.1, and the popup states I’m on 2021.1.2, and when I go into extensions it says I’m on v2021.2.1. Whenever I click download it seems to download it but whenever i reopen vscode it always wants me to update. Im going to try a clean redownload of vscode later tonight and see if that might fix the issue with the wpiHaljni error and the weird downloading thing.
Thanks for putting out this resource! I ran into an issue with frc-characterization that I haven’t been able to resolve - when I run quasistatic forward/backwards it works great, but dynamic forward/backwards does not work at all unless I set the step voltage to 12, at which point it goes full speed. Any other values do not cause the Romi to move at all.