Skip to content
learnFRC.org
programmingcourseadvanced140 min

Physics Simulation & Modern Control

High-fidelity mechanism physics simulation, virtual sensor loopback, automated SysId characterization, and state-space LQR and Kalman filter control.

What you will learn

  • Simulate elevators, arms, flywheels, and swerve drivetrains using WPILib physics classes and DCMotor models.
  • Construct virtual hardware loopbacks that pipe simulated sensor state into production robot code.
  • Perform automated mechanism system identification using SysId to extract kS, kV, kA, and kG constants.
  • Formulate linear state-space models (x_dot = Ax + Bu) and compute optimal feedback gains using LQR.
  • Fuse noisy sensor measurements with state-space Kalman filters (LinearSystemLoop) for optimal trajectory tracking.

Prerequisites:Guided Learning Course

Waiting for a physical robot before writing and testing software leads to rushed code, uncalibrated control loops, and software bugs discovering hardware travel limits the night before competition.

Modern FRC software engineering is simulation-first. By writing mathematical physics models of your mechanisms in code, you can build, tune, and stress-test autonomous routines and operator controls on a laptop before the mechanical team cuts the first piece of aluminum. Once hardware is built, automated system identification (SysId) and state-space control theory (LQR and Kalman filters) replace manual PID guesswork with optimal, robust mathematical control.

Prerequisites

This course builds upon the fundamentals taught in Guided Learning Course. Students should understand Command-Based programming and basic feedforward and feedback tuning.

The curriculum consists of two focused modules totaling 140 minutes across 4 lessons:

1. Physics Simulation & Mechanism Modeling (70 min, 2 lessons)

Section titled “1. Physics Simulation & Mechanism Modeling (70 min, 2 lessons)”
  • Mechanism Physics Models with DCMotor (35 min): Model elevators, single-jointed arms, and flywheels using differential equations in WPILib’s ElevatorSim, SingleJointedArmSim, and FlywheelSim. Configure accurate brushless motor curves (Kraken X60, Minion, NEO).
  • Simulated Hardware & AdvantageScope (35 min): Feed applied motor controller voltages into simulated physics and loop back simulated encoder states into production subsystem classes. Test commands and visualizer animations in SimGUI and AdvantageScope.

2. SysId Characterization & State-Space Control (70 min, 2 lessons)

Section titled “2. SysId Characterization & State-Space Control (70 min, 2 lessons)”
  • SysId System Characterization (35 min): Run automated quasistatic and dynamic voltage routines to calculate static friction kSk_S, velocity feedforward kVk_V, acceleration feedforward kAk_A, and gravity kGk_G with statistical confidence.
  • State-Space Modeling, LQR & Kalman Filters (35 min): Transition beyond classical single-input PID. Formulate linear continuous-time state-space models x_dot = A * x + B * u, compute optimal gain matrices using Linear-Quadratic Regulators, and estimate unmeasured states with Kalman filters.

Verified Sources & Standards

Evergreen Standard

Course modules