Skip to content
Programming, Controls & Sensors·Lesson 33 of 51

Characterizing a Mechanism with SysId

Using WPILib's system identification tool to measure real kS, kV, kA, kG values instead of guessing.

Sign in to track progress, earn XP, and save lessons.

Rather than guess feedforward constants, you can measure them. WPILib's SysId (System Identification) tool runs your mechanism through controlled tests, records data, and computes kS, kV, kA, (kG for arms/elevators), and starting PID gains.

How SysId works

SysId runs four tests, each forward and backward (reverse):

  • Quasistatic: the mechanism is sped up very slowly so acceleration is negligible — this isolates kS and kV.
  • Dynamic: a constant 'step' voltage is applied so the mechanism accelerates — this reveals kA.

During each test SysId logs voltage, position, and velocity. It then fits these to the feedforward model to extract the constants. Because the fit uses real data from your robot, the numbers reflect your actual friction, gearing, and mass.

The modern workflow

In current WPILib you create a SysIdRoutine in your subsystem. You give it a way to apply a voltage and a logging callback that records the motor's voltage, position, and velocity, then bind the four test commands (quasistatic-forward/reverse, dynamic-forward/reverse) to buttons:

SysIdRoutine routine = new SysIdRoutine(
  new SysIdRoutine.Config(),
  new SysIdRoutine.Mechanism(
    voltage -> motor.setVoltage(voltage.in(Volts)),
    log -> log.motor("arm")
             .voltage(appliedVolts)
             .angularPosition(positionRad)
             .angularVelocity(velocityRadPerSec),
    this));

The Config lets you set the quasistatic ramp rate, the dynamic step voltage, and a timeout so a mechanism does not run into its hard stop. CTRE's Phoenix 6 integrates with SysId as well, logging via signals for Talon FX systems.

Safety and good practice

  • Give the mechanism room to run, and set a short timeout; for limited-travel arms/elevators use a small ramp/step so it does not slam a hard stop.
  • Run each test and stop before the mechanism reaches its limit.
  • Load the resulting log into the SysId analyzer, pick the correct mechanism type (Simple, Arm, or Elevator) so kG is computed correctly, and confirm the fit looks clean (a good R-squared).
  • Treat the PID gains SysId suggests as a starting point, then fine-tune with the methodology from the earlier lesson.

SysId turns control tuning from guesswork into measurement, which is the difference between a robot that occasionally works and one that repeats the same shot all match.

Key takeaways

  • SysId runs quasistatic (isolates kS/kV) and dynamic (reveals kA) tests, forward and reverse, on your real robot.
  • Modern WPILib uses a SysIdRoutine that applies voltage and logs voltage/position/velocity; Phoenix 6 integrates too.
  • Pick the right mechanism type (Simple/Arm/Elevator) so kG is correct, and treat suggested PID gains as a starting point.

Lesson quiz

Required

Answer all 3 questions correctly to complete this lesson.

1.In a SysId routine, what characterizes the quasistatic test?

2.What is the purpose of the dynamic (step) test in SysId?

3.How should the gains produced by SysId be treated?

Answer every question to submit.