So our team purchased four 2910 swerve modules but we only received one so far (they weren’t all in the same order) and we have some code we would like to test so is there simulation software or another way we can be sure the code works. The other modules will be coming in July so we’d like to get as far with the code as possible.
We’re currently in a similar boat, as it’s going to be a while before CAD will be finalized and we can get parts ordered to start making ours.
Keep in mind, we write all our code in Java. Not how simulation stuff would apply to C++, and have absolutely no clue on LabView.
A lot of work went into the setup of our motor controller wrappers, which allow us to swap out Talons and simulated classes easily and accurately (enough) track position and speed.
(keep in mind, none of this code has yet touched a RIO)
I’ve found it incredibly useful to test logic for the swerve (minus the details like tuning PID loops), and a great way to troubleshoot instead of staring at a console printout of numbers.
This 2011 thread touched on how we tested it and includes some equations on computing the angles and velocities.
The simulation technique is close circuited where we interpret the physics and plotted using OSG as a rendering solution. I presented this idea when we did beta and they asked if we could make it work where it interprets WPI calls instead. So this year we started to make it work like that, but it is currently too clunky to be ready to present to anyone. However, if you wish to see these in their current state I’ve put the legacy code here with the latest simulation demo code here.
I realize it’s not an easy fix now, but eventually for the newer technique we’ll want to make a simulation module to work on this idea so any c++ code can use it… and we’ll want it to be high performance and lean, so that it doesn’t take forever to load and run!