Skip to content
learnFRC.org
programmingmoduleadvanced70 min

Physics Simulation & Mechanism Modeling

Mathematical mechanism modeling with WPILib simulation classes, brushless DCMotor models, and virtual sensor loopback.

What you will learn

  • Formulate physical dynamic parameters including mass, moment of inertia, and gear ratios.
  • Model brushless motor characteristics using the WPILib DCMotor class.
  • Connect simulated plant models to production SubsystemBase classes via simulationPeriodic().
  • Verify closed-loop mechanism trajectories visually using Mechanism2d and AdvantageScope.

Prerequisites:Guided Learning Course

Desktop simulation in WPILib is not just a software unit-testing tool; it is a full numerical physics engine running on your laptop. By pairing physical gear ratios, carriage masses, and arm lengths with accurate DC motor back-EMF and torque models, simulated mechanisms exhibit the same inertia, gravity sag, and current draw as the real robot.

  1. Mechanism Physics Models with DCMotor (35 min): Construct simulation models for elevators, arms, and flywheels using ElevatorSim, SingleJointedArmSim, and FlywheelSim. Configure brushless motor curves including Kraken X60, Minion, and NEO.

  2. Simulated Hardware & AdvantageScope (35 min): Implement the virtual hardware loopback inside simulationPeriodic(). Pass applied motor voltage into the physics engine, feed updated positions back into simulated sensors, and render animated mechanisms in Mechanism2d and AdvantageScope.

Verified Sources & Standards

Evergreen Standard

Lessons