Skip to content

Commit 8244d13

Browse files
committed
Add more details to PID article
1 parent 7ea21b4 commit 8244d13

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

source/docs/software/commandbased/pid-subsystems-commands.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ One of the most common control algorithms used in FRC\ |reg| is the :term:`PID`
1212
.. tab-item:: Java
1313
:sync: Java
1414

15-
.. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.3.2/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Shooter.java
15+
.. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2025.0.0-alpha-2/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Shooter.java
1616
:language: java
1717
:lines: 5-
1818
:linenos:
@@ -21,7 +21,7 @@ One of the most common control algorithms used in FRC\ |reg| is the :term:`PID`
2121
.. tab-item:: C++
2222
:sync: C++ (Header)
2323

24-
.. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.3.2/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Shooter.h
24+
.. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2025.0.0-alpha-2/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Shooter.h
2525
:language: c++
2626
:lines: 5-
2727
:linenos:
@@ -30,10 +30,10 @@ One of the most common control algorithms used in FRC\ |reg| is the :term:`PID`
3030
.. tab-item:: C++ (Source)
3131
:sync: C++ (Source)
3232

33-
.. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.3.2/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/cpp/subsystems/Shooter.cpp
33+
.. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2025.0.0-alpha-2/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/cpp/subsystems/Shooter.cpp
3434
:language: c++
3535
:lines: 5-
3636
:linenos:
3737
:lineno-start: 5
3838

39-
A ``PIDController`` is declared inside the ``Shooter`` subsystem. It is used by ``ShootCommand`` alongside a feedforward to spin the shooter flywheel to the specified velocity. Once the ``PIDController`` reaches the specified velocity, the ``ShootCommand`` runs the feeder.
39+
The ``Shooter`` subsystem holds a ``PIDController`` and a ``SimpleMotorFeedForward``. They are used by ``shootCommand`` to spin the shooter flywheel to the specified velocity. The calculations and motor setting are performed in a lambda expression that is passed to the ``run`` command factory, which creates a command that repeatedly executes the lambda expression while the command is scheduled. This command runs in parallel (using the ``parallel`` command factory) with another command that waits until the ``PIDController`` reaches the specified velocity, and runs the feeder when the specified velocity is reached. This is command is created with the ``waitUntil`` command factory, which creates a command that does nothing and finishes when ``m_shooterFeedback.atSetpoint`` returns ``true``, and the ``andThen`` decorator which runs the feeders when the previous command is finished.

0 commit comments

Comments
 (0)