You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/docs/software/advanced-controls/controllers/feedforward.rst
+9-6Lines changed: 9 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,10 +9,13 @@ A feedforward controller injects information about the system’s dynamics (like
9
9
10
10
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.
11
11
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
+
------------------------------
13
14
14
15
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.
15
16
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
+
16
19
WPILib currently provides the following three helper classes for feedforward control:
@@ -66,7 +69,7 @@ To calculate the feedforward, simply call the ``calculate()`` method with the de
66
69
ArmFeedforward
67
70
--------------
68
71
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`.
70
73
71
74
.. 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.
72
75
@@ -80,13 +83,13 @@ To create an ``ArmFeedforward``, simply construct it with the required gains:
80
83
81
84
.. code-tab:: java
82
85
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);
85
88
86
89
.. code-tab:: c++
87
90
88
-
// Create a new ArmFeedforward with gains kS, kCos, kV, and kA
0 commit comments