Advanced Control

advanced30 min

Overview

PID covers most mechanisms on a typical robot. State-space models, LQR, and multi-input control matter when several states are coupled (swerve modules, multi-joint arms, balancing) or when you need coordinated control across more than one actuator.

Techniques

Key concepts:

  • State-Space: Models systems using state variables (position, velocity) and matrix equations.
  • LQR (linear quadratic regulator): Picks gains that trade tracking error against how hard you drive the motors.
  • Feedforward: Predicts required output based on physics models (gravity, friction, inertia).
  • MIMO: Multi-Input Multi-Output control for coupled systems (e.g., Swerve).

State-Space Control

State-space control uses ẋ = Ax + Bu to model how position, velocity, and other states evolve together. You can command more than one related variable at once (for example arm angle and arm angular velocity). WPILib provides LinearSystem and LinearSystemLoop.

LQR

LQR chooses feedback gains by minimizing a cost function. You set Q (how much you penalize state error) and R (how much you penalize control effort). Higher Q tends toward snappier tracking; higher R tends toward gentler motor commands.

When to Use

PID: Intakes, elevators, single-axis arms, shooters, and most independent mechanisms.

Advanced control: Balancing robots, inverted pendulums, tightly coupled multi-DOF arms, or full drivetrain models where WPILib’s state-space tooling is already wired in.

Resources