Complete Swerve Drive with simulation code in WPI environment

I have been meaning to post this for quite some time, and finally had a moment to address it.

Last season I wanted to completely rewrite the legacy swerve drive code, some of the code dates back to 2007 (e.g. physics code). Using modern c++ techniques, and introducing concepts such as loose coupling of objects, and unit testing of various pieces.

Since the time of these two projects, I look back at this work and know that there was still more improvement that I could have made knowing then what I know now, but still, I think it would be helpful for anyone, as I tried to explain in great detail in the readme various concepts of swerve drive, and some of the mistakes I overlooked while developing it over the years.

The first project was built in parallel with the second where it can be simulated with Open Scene Graph and complete independent of WPI tools.

Robot Simulation

The second project started around kickoff time, this code was for example purposes only as the students wrote completely different code. The interesting thing about this is that I did something that the FRC Beta Team asked me to do back in 2014, where I offer the simulation on the backend of all the WPI calls, so as a proof of concept the back end with all the physics was able to run on the students code with minimal integration tasks.

Swerve 2021

I hope that others will look at this code and it help them in their coding endeavors. If anything needs explanation just let me know.

The github site is JamesTerm that has other projects including our 3481 team’s code. Any code in my repository is available for anyone interested in some of the other open source projects I’ve been working on.

2 Likes

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