Skip to main content

Control Theory

Control theory is a branch of engineering and mathematics that deals with the behavior of dynamical systems. The main goal of control theory is to develop models and strategies to influence the behavior of these systems to achieve desired outcomes. In the context of FRC robotics, control theory is essential for designing systems that can respond accurately and efficiently to changing conditions on the field. In this module, we will explore some fundamental concepts of control theory that are relevant to FRC robots.


Presentation


Do this lesson in Scriptum

The exercises below are the Control Theory lesson in Scriptum. Open the lesson, start the simulated robot and follow its README. Each step is checked with the Verify button.

New Java in this lesson: no new syntax. You practice enums, switch, small methods and unit conversion.

Exercises​

Three ways to hold a speed​

  • Write a Bang Bang controller for the flywheel
    • Full power when too slow, no power when fast enough
  • Write a Feed Forward controller for the flywheel
    • Work out the power from the target speed and kV, with no measuring: volts = FLYWHEEL_KV * SHOOT_VELOCITY
    • kV is in volts per rad/s: 12 V / 628 rad/s (a Kraken's free speed) is about 0.0191
    • Find a good kV by experiment
  • Use PID (feed forward plus feedback) to hold the speed
    • Tune kP and compare how each style recovers from a simulated ball launch

Tuning​

  • Tune the flywheel for velocity control in simulation
    • Make sure your system measurements like MOI and radius are close to the real robot
      • Wheel Radius: 0.0762 m
      • Wheel Mass: 2.3 kg
    • Spin up in under about 1.5 seconds without overshooting the target
    • Once you have tuned in simulation try final values on the robot

WPILib exercises​


Related Documentation

Controls​