Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
maple-sim is a frc physics engine built on top of dyn4j: https://shenzhen-robotics-alliance.github.io/maple-sim/
Out of the box it has things like:
This PR upgrades our very basic drive simulator with one based on maple-sim.
I abstracted our Simulator into a very basic interface
BaseSimulator
so we could swap between different implementations at the dagger module level without having to change other code.Testing
The solid robot is the physics sim ground truth and the red ghost is our PoseSubsystem's perception of where the robot is (currently based only on wheel odometry).
maple-sim-demo.mp4
Future work
Position setting
We need a way for commands like an auto program to reset the current position in the physics sim, probably with a new interface method that someone calls into the sim.
Vision
There's currently no fake vision stuff plugged in but we should add that in next to get april tags and things
Swerve integration
There are multiple ways to integrate with maple-sim, I opted for the 'stupidest' where they provide a fully working simulated swerve drive train and just sort of plugged in our requested swerve states in the top and get back out swerve module positions and gyro angle on the end, effectively skipping our own swerve module logic. https://shenzhen-robotics-alliance.github.io/maple-sim/swerve-sim-easy/
Doing the deeper integration at the motor level would be a good idea but is a much bigger ticket so I didn't opt to start there. https://shenzhen-robotics-alliance.github.io/maple-sim/swerve-sim-hardware-abstraction/