Skip to content

Commit 7f70f96

Browse files
authored
add link to recalc from feedforward doc (#1700)
1 parent b4b1a2e commit 7f70f96

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ A feedforward controller injects information about the system’s dynamics (like
99

1010
There are two types of feedforwards: model-based feedforward and feedforward for unmodeled dynamics. The first solves a mathematical model of the system for the inputs required to meet desired velocities and accelerations. The second compensates for unmodeled forces or behaviors directly so the feedback controller doesn't have to. Both types can facilitate simpler feedback controllers. We'll cover several examples below.
1111

12-
.. note:: The WPILib feedforward classes closely match the available mechanism identification tools available in the :ref:`SysId toolsuite <docs/software/pathplanning/system-identification/introduction:Introduction to System Identification>` - the system identification toolsuite can be used to quickly and effectively determine the correct gains for each type of feedforward. The toolsuite will indicate the appropriate units for each of the gains.
12+
The WPILib Feedforward Classes
13+
------------------------------
1314

1415
WPILib provides a number of classes to help users implement accurate feedforward control for their mechanisms. In many ways, an accurate feedforward is more important than feedback to effective control of a mechanism. Since most FRC\ |reg| mechanisms closely obey well-understood system equations, starting with an accurate feedforward is both easy and hugely beneficial to accurate and robust mechanism control.
1516

17+
The WPILib feedforward classes closely match the available mechanism characterization tools available in the :ref:`SysId toolsuite <docs/software/pathplanning/system-identification/introduction:Introduction to System Identification>`. The system identification toolsuite can be used to quickly and effectively determine the correct gains for each type of feedforward. If you are unable to empirically characterize your mechanism (due to space and/or time constraints), reasonable estimates of ``kG``, ``kV``, and ``kA`` can be obtained by fairly simple computation, and are also available from `ReCalc <https://www.reca.lc/>`__. ``kS`` is nearly impossible to model, and must be measured empirically.
18+
1619
WPILib currently provides the following three helper classes for feedforward control:
1720

1821
* `SimpleMotorFeedforward`_ (`Java <https://first.wpi.edu/wpilib/allwpilib/docs/release/java/edu/wpi/first/math/controller/SimpleMotorFeedforward.html>`__, `C++ <https://first.wpi.edu/wpilib/allwpilib/docs/release/cpp/classfrc_1_1_simple_motor_feedforward.html>`__)
@@ -66,7 +69,7 @@ To calculate the feedforward, simply call the ``calculate()`` method with the de
6669
ArmFeedforward
6770
--------------
6871

69-
.. note:: In C++, the ``ArmFeedforward`` class assumes distances are angular, not linear. The passed-in gains *must* have units consistent with the angular unit, or a compile-time error will be thrown. ``kS`` and ``kCos`` should have units of ``volts``, ``kV`` should have units of ``volts * seconds / radians``, and ``kA`` should have units of ``volts * seconds^2 / radians``. For more information on C++ units, see :ref:`docs/software/basic-programming/cpp-units:The C++ Units Library`.
72+
.. note:: In C++, the ``ArmFeedforward`` class assumes distances are angular, not linear. The passed-in gains *must* have units consistent with the angular unit, or a compile-time error will be thrown. ``kS`` and ``kG`` should have units of ``volts``, ``kV`` should have units of ``volts * seconds / radians``, and ``kA`` should have units of ``volts * seconds^2 / radians``. For more information on C++ units, see :ref:`docs/software/basic-programming/cpp-units:The C++ Units Library`.
7073

7174
.. note:: The Java feedforward components will calculate outputs in units determined by the units of the user-provided feedforward gains. Users *must* take care to keep units consistent, as WPILibJ does not have a type-safe unit system.
7275

@@ -80,13 +83,13 @@ To create an ``ArmFeedforward``, simply construct it with the required gains:
8083

8184
.. code-tab:: java
8285

83-
// Create a new ArmFeedforward with gains kS, kCos, kV, and kA
84-
ArmFeedforward feedforward = new ArmFeedforward(kS, kCos, kV, kA);
86+
// Create a new ArmFeedforward with gains kS, kG, kV, and kA
87+
ArmFeedforward feedforward = new ArmFeedforward(kS, kG, kV, kA);
8588

8689
.. code-tab:: c++
8790

88-
// Create a new ArmFeedforward with gains kS, kCos, kV, and kA
89-
frc::ArmFeedforward feedforward(kS, kCos, kV, kA);
91+
// Create a new ArmFeedforward with gains kS, kG, kV, and kA
92+
frc::ArmFeedforward feedforward(kS, kG, kV, kA);
9093

9194
To calculate the feedforward, simply call the ``calculate()`` method with the desired arm position, velocity, and acceleration:
9295

0 commit comments

Comments
 (0)