Skip to content

Commit c95ebd7

Browse files
authored
Fix BangBang feedforward units (#1762)
Fixes #1753
1 parent f8e03d2 commit c95ebd7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

source/docs/software/advanced-controls/controllers/bang-bang.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ Like a PID controller, best results are obtained in conjunction with a :ref:`fee
5656

5757
// Controls a motor with the output of the BangBang controller and a feedforward
5858
// Shrinks the feedforward slightly to avoid overspeeding the shooter
59-
motor.set(controller.calculate(encoder.getRate(), setpoint) + 0.9 * feedforward.calculate(setpoint));
59+
motor.setVoltage(controller.calculate(encoder.getRate(), setpoint) * 12.0 + 0.9 * feedforward.calculate(setpoint));
6060

6161
.. code-tab:: c++
6262

6363
// Controls a motor with the output of the BangBang controller and a feedforward
6464
// Shrinks the feedforward slightly to avoid overspeeding the shooter
65-
motor.Set(controller.Calculate(encoder.GetRate(), setpoint) + 0.9 * feedforward.Calculate(setpoint));
65+
motor.SetVoltage(controller.Calculate(encoder.GetRate(), setpoint) * 12.0 + 0.9 * feedforward.Calculate(setpoint));

0 commit comments

Comments
 (0)