4829 Titanium Tigers 2022 Code Release

Our programming team went above a beyond this year with their code. They produced many firsts for the team, including our most successful autonomous routine ever (a full 5 cargo auto), fully implemented vision targeting, swerve control, and PID (so much so that we named the robot Loopy in honor of the many PID loops that made her tick.) We are proud to release our full code for the use of the community. Special thanks go to our head programmer Ryan, master of auto Jackson, and our mentor Zuntue, along with the rest of the programming team who worked long hours making it all happen.
Here’s the link: https://github.com/Titanium-Tigers-4829/4829RobotCode2022


Can you introduce how you use Pathweaver to accomplish the swerve auto? Does the WPILib fix the swerve auto issue?


No, pathweaver doesn’t support holonomic drive. For the time being, use PathPlanner.

I know, but l find that @Strategic uses PathWeaver and he also uses swerve. And l notice that he has written two paths. l think if they are useless, why he still keep them in his code?

I’m just the Lead Mentor, not the programmer, so I can’t really answer this one. I’ll point my Head Programmer to the thread and have him answer this.


Next year we might use PathPlanner, but PathWeaver actually works pretty well for swerve if you’re willing to deal with it e.g. using reverse spline for when your robot is going backwards, or drawing the trajectories a little different than normal. PathWeaver works with swerve because of the WPILib class SwerveControllerCommand. All of the code for following trajectories is in FollowTrajectory.java. FollowTrajectory is just a wrapper command for SwerveControllerCommand that gets the specified trajectory’s json file from the argument trajectoryFilePath and resets the odometry of the swerve if toReset is true. When it is called with a path, it drives that path for the specified amount of time. The code is a little hacked together and I would want to handle how the command ends a little better next year (we do .withTimeout when calling the FollowTrajectoryCommand), but overall I’m really proud of our auto.

When you say we have 2 written paths, if you’re talking about the Auto folder in the PathWeaver folder, those are just so that we can share our PathWeaver configuration files over github, they’re not important. All of our paths’ json files are in src/main/deploy/output/.

1 Like

Thanks for replying! Your solution is very smart, but how do you deal with the swerve’s heading or rotation in auto? Can you explain it? l am just curious about it.


We have a theta controller that goes with the SwerveControllerCommand. It takes care of most of it, you just have to make sure the paths are realistic and generally heading in one direction, like not going in a circle. Also, on pathweaver you need to have each trajectory’s last tangent lined up with the next trajectory’s first tangent. In addition, we only reset the odometry at the beginning of the first path, this lets the gyro keep track of the robot’s tangent throughout the whole auto, and if anything happens, it can correct for it.


Y’all had an awesome robot that reaaally should have been picked in Roebling.


Thanks! If everything had gone consistently we might have been, but we kept having odd problems that made us too inconsistent for most teams to take a chance on. Just bad luck, but that’s the way it goes sometimes.

By the way, here’s a video of that 5 cargo auto from Roebling Q88, just to show how well PathWeaver can work with a swerve drive. We’re the red alliance bot at the bottom of the screen.


This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.