From d3df94180e8852240cb858353ac2215c875438f9 Mon Sep 17 00:00:00 2001 From: vivi-o Date: Sun, 27 Sep 2026 14:34:31 -0700 Subject: [PATCH 1/3] adding sysid doc basic overview, pretty short --- Docs/3_Specifics/3.6_SysID.md | 114 ++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 Docs/3_Specifics/3.6_SysID.md diff --git a/Docs/3_Specifics/3.6_SysID.md b/Docs/3_Specifics/3.6_SysID.md new file mode 100644 index 0000000..8d67399 --- /dev/null +++ b/Docs/3_Specifics/3.6_SysID.md @@ -0,0 +1,114 @@ +# SysId: System Identification +What is SysId? + +SysId is a WPILib tool that characterizes a mechanism by applying controlled voltages and measuring its response. It uses this data to determine feedforward constants: +kS: Voltage needed to overcome static friction +kV: Voltage needed to maintain velocity +kA: Voltage needed to accelerate + +SysId determines feedforward constants. After characterization, we use the constants in our feedforward controller and tune PID separately. + +### Creating SysId Routines + +Our example shooter has two mechanisms: a flywheel, which is a continuously rotating roller, and a hood, which is a limited-angle pivot. + +They need separate routines because the hood must stop before reaching its mechanical limits, while the flywheel can rotate freely. + +Flywheel: + +```Java +private SysIdRoutine flywheelSysid = + new SysIdRoutine( + new Config( + null, null, null, + (state) -> Logger.recordOutput( + "Shooter/Flywheel/SysID State", + state.toString())), + new Mechanism( + (voltage) -> flywheelIO.setFlywheelVoltage(voltage.in(Volts)), + null, + this)); + +``` + +Hood: + +```Java +private SysIdRoutine hoodSysid = + new SysIdRoutine( + new Config( + null, + Volts.of(5), + null, + (state) -> Logger.recordOutput( + "Shooter/Hood/SysID State", + state.toString())), + new Mechanism( + (voltage) -> hoodIO.setHoodVoltage(voltage.in(Volts)), + null, + this)); +``` + +Config sets the test parameters and logs the current state. Mechanism tells SysId how to apply voltage through our IO layer. + +Then we will create commands to run these routines + +SysId uses two types of tests: + +Quasistatic: Slowly ramps up voltage to measure the mechanism's response across different velocities. + +Dynamic: Applies a step voltage to measure acceleration. + +Each routine runs forward and reverse tests of both types. + +Flywheel: + +```Java +@Override +public Command runFlywheelSysid() { + return Commands.sequence( + flywheelSysid.quasistatic(Direction.kForward), + flywheelSysid.quasistatic(Direction.kReverse), + flywheelSysid.dynamic(Direction.kForward), + flywheelSysid.dynamic(Direction.kReverse)); +} +``` +The flywheel does not need position-based stopping conditions because it can continuously rotate. + +Hood: + +```Java +@Override +public Command runHoodSysid() { + return Commands.sequence( + hoodSysid.quasistatic(Direction.kForward) + .until(() -> hoodInputs.hoodPositionRotations.getDegrees() + > HOOD_MAX_ANGLE.getDegrees() - 5), + hoodSysid.quasistatic(Direction.kReverse) + .until(() -> hoodInputs.hoodPositionRotations.getDegrees() + < HOOD_MIN_ANGLE.getDegrees() + 5), + hoodSysid.dynamic(Direction.kForward) + .until(() -> hoodInputs.hoodPositionRotations.getDegrees() + > HOOD_MAX_ANGLE.getDegrees() - 5), + hoodSysid.dynamic(Direction.kReverse) + .until(() -> hoodInputs.hoodPositionRotations.getDegrees() + < HOOD_MIN_ANGLE.getDegrees() + 5)); +} +``` +The .until(...) conditions stop the hood 5° before its mechanical limits to prevent damage. + +Adding routines to the Auto Chooser to run them as autos: + +```Java +autoChooser.addOption("Flywheel Sysid", shooter.runFlywheelSysid()); +autoChooser.addOption("Hood Sysid", shooter.runHoodSysid()); +``` + +Analyze the Data by running the SysId routine to collect data. Then, load the log into the WPILib SysId tool and select the corresponding tests. Extract kS, kV, and kA values. +Add the constants to the mechanism's feedforward controller. +Always check th#e diagnostic plots before using the results. Poor data can produce inaccurate constants. + +Further Reading + +- [WPILib SysId docs](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/system-identification/index.html) +- [helpful Chief delphi thread](https://www.google.com/url?q=https://www.chiefdelphi.com/t/sysid-pid-and-feedfoward-tuning-for-elevator/482797&sa=D&source=docs&ust=1788129798942293&usg=AOvVaw1IUPkZIfUi8t0NkQ_1eo3A) From 4efc6fc2148b87ac184af3cd4d06ee8e54c105eb Mon Sep 17 00:00:00 2001 From: vivi-o Date: Sun, 27 Sep 2026 14:50:34 -0700 Subject: [PATCH 2/3] some rewording and formating --- Docs/3_Specifics/3.6_SysID.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Docs/3_Specifics/3.6_SysID.md b/Docs/3_Specifics/3.6_SysID.md index 8d67399..677f37a 100644 --- a/Docs/3_Specifics/3.6_SysID.md +++ b/Docs/3_Specifics/3.6_SysID.md @@ -2,11 +2,11 @@ What is SysId? SysId is a WPILib tool that characterizes a mechanism by applying controlled voltages and measuring its response. It uses this data to determine feedforward constants: -kS: Voltage needed to overcome static friction -kV: Voltage needed to maintain velocity -kA: Voltage needed to accelerate +kS: Represents voltage needed to overcome static friction +kV: Represents voltage needed to maintain velocity +kA: Represents voltage needed to accelerate -SysId determines feedforward constants. After characterization, we use the constants in our feedforward controller and tune PID separately. +We use SysId to determine feedforward constants for our feedforward controller. SysId can also provide baseline PID values but we will often tune PID separately. ### Creating SysId Routines @@ -54,10 +54,8 @@ Config sets the test parameters and logs the current state. Mechanism tells SysI Then we will create commands to run these routines SysId uses two types of tests: - -Quasistatic: Slowly ramps up voltage to measure the mechanism's response across different velocities. - -Dynamic: Applies a step voltage to measure acceleration. +- Quasistatic: Slowly ramps up voltage to measure the mechanism's response across different velocities. +- Dynamic: Applies a step voltage to measure acceleration. Each routine runs forward and reverse tests of both types. @@ -104,9 +102,9 @@ autoChooser.addOption("Flywheel Sysid", shooter.runFlywheelSysid()); autoChooser.addOption("Hood Sysid", shooter.runHoodSysid()); ``` -Analyze the Data by running the SysId routine to collect data. Then, load the log into the WPILib SysId tool and select the corresponding tests. Extract kS, kV, and kA values. +Analyze the Data by running the SysId routine to collect data. Then, load the log into the WPILib SysId tool and select the corresponding tests and values. Extract kS, kV, and kA values. Add the constants to the mechanism's feedforward controller. -Always check th#e diagnostic plots before using the results. Poor data can produce inaccurate constants. +Check the diagnostic plots before using the results. Poor data can produce inaccurate constants. Further Reading From a98e2d42f99afb5ec2df8e8286c96a499efb7ec6 Mon Sep 17 00:00:00 2001 From: vivi-o Date: Sun, 27 Sep 2026 14:53:50 -0700 Subject: [PATCH 3/3] formatting --- Docs/3_Specifics/3.6_SysID.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Docs/3_Specifics/3.6_SysID.md b/Docs/3_Specifics/3.6_SysID.md index 677f37a..e707146 100644 --- a/Docs/3_Specifics/3.6_SysID.md +++ b/Docs/3_Specifics/3.6_SysID.md @@ -2,9 +2,9 @@ What is SysId? SysId is a WPILib tool that characterizes a mechanism by applying controlled voltages and measuring its response. It uses this data to determine feedforward constants: -kS: Represents voltage needed to overcome static friction -kV: Represents voltage needed to maintain velocity -kA: Represents voltage needed to accelerate +- kS: Represents voltage needed to overcome static friction +- kV: Represents voltage needed to maintain velocity +- kA: Represents voltage needed to accelerate We use SysId to determine feedforward constants for our feedforward controller. SysId can also provide baseline PID values but we will often tune PID separately. @@ -109,4 +109,4 @@ Check the diagnostic plots before using the results. Poor data can produce inacc Further Reading - [WPILib SysId docs](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/system-identification/index.html) -- [helpful Chief delphi thread](https://www.google.com/url?q=https://www.chiefdelphi.com/t/sysid-pid-and-feedfoward-tuning-for-elevator/482797&sa=D&source=docs&ust=1788129798942293&usg=AOvVaw1IUPkZIfUi8t0NkQ_1eo3A) +- [Helpful Chief delphi thread](https://www.google.com/url?q=https://www.chiefdelphi.com/t/sysid-pid-and-feedfoward-tuning-for-elevator/482797&sa=D&source=docs&ust=1788129798942293&usg=AOvVaw1IUPkZIfUi8t0NkQ_1eo3A)