Simulation Details
Swerve-Drive Simulation Dynamics with Interactive Field
The standout feature of this project is the integration of the dyn4j physics engine, which enables a highly realistic and interactive simulation environment.
In traditional swerve drive simulations, the drivetrain is typically modeled using several DCMotorSim instances to simulate motor behavior.
In maple-sim, the drivetrain simulation goes a step further by calculating the frictional and propelling forces on each swerve module. These forces are used to model the drivetrain as a rigid body, allowing for more accurate interaction with the field environment.
The realistic simulation dynamics allow you to test and refine auto paths as they would perform in real-world conditions.
View Full Document on Swerve Simulation >>>
Odometry + Vision Simulation
By modeling the interaction between the wheels and the floor, our simulation can replicate odometry measurement errors caused by skidding.
Additionally, the IMU simulation includes drift, where hard impacts on the virtual robot will cause the IMU to behave similarly to how it would in real-world scenarios.
Beyond odometry, you can integrate photonlib to simulate how vision-based odometry can correct your robot’s position.
Game Pieces and Intake Simulation
In maple-sim, game pieces on the field have collision boundaries and can interact with the robot. The simulator also supports a fixed intake module, allowing the robot to automatically collect game pieces upon contact.
View Full Document on Intake Simulation >>>
Projectile Simulation
In FRC, game pieces are often launched into the air. maple-sim offers a straightforward physics simulation to model the behavior of these projectiles.
View Full Document on Projectile Simulation >>>
Opponent Robots Simulation
Simulated opponent robots can be manually controlled with a gamepad for defensive play or set to follow pre-programmed cycle paths. Just like real robots, these opponents have collision boundaries, enabling drivers to practice both defensive and offensive strategies effectively.