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
where \\(V\\) is the applied voltage, \\(d\\) is the displacement (position) of the motor, \\(\dot{d}\\) is its velocity, and \\(\ddot{d}\\) is its acceleration (the “overdot” notation traditionally denotes the derivative with respect to time). \\(K_{s}\\), \\(K_{v}\\), and \\(K_{a}\\) are all constants that are tuned.
29
+
where `V` is the applied voltage, `d` is the displacement (position) of the motor, `d` with a single dot is its velocity, and `d` with a double dot is its acceleration (the “overdot” notation traditionally denotes the derivative with respect to time). `kS`, `kV`, and `kA` are all constants that are tuned.
30
30
31
-
-\\(k_{s} \cdot sgn(\dot{d})\\) is the amount of voltage needed to overcome the motor's static friction, or in other words to just barely get it moving.
32
-
-\\(k_{v} \cdot \dot{d}\\) is the amount of voltage needed to hold the motor at a given constant velocity.
33
-
-\\(k_{a} \cdot \ddot{d}\\) is the amount of voltage needed to drive the motor at a given constant acceleration.
31
+
-The `kS` term (including the `sgn(d)` part) is the amount of voltage needed to overcome the motor's static friction, or in other words to just barely get it moving.
32
+
-The `kV` term (including the `d` dot part) is the amount of voltage needed to hold the motor at a given constant velocity.
33
+
-The `kA` term (incluidng the `d` double dot part) is the amount of voltage needed to drive the motor at a given constant acceleration.
34
34
35
-
When you add up all these values which equals \\(V\\), that is voltage needed to keep a motor at velocity \\(\dot{d}\\) and acceleration \\(\ddot{d}\\).
35
+
When you add up all these values which equals `V`, that is voltage needed to keep a motor at velocity (`d` with dot) and acceleration (`d` with two dots).
36
36
37
37
Then, to drive the motor at the desired velocity and acceleration, it is as easy as writing:
The code excerpt is only meant to show how feedforward works. This is not how we actually implement feedforward, but should give you a better idea of the inner workings of feedforward.
50
50
51
-
In addition, feedforward can also be used for elevators and arms. There is one additional constant \\(k_{g}\\) which is used to counteract the force of gravity.
51
+
In addition, feedforward can also be used for elevators and arms. There is one additional constant `kG` which is used to counteract the force of gravity.
52
52
53
53
## Tuning and System Idenfication
54
54
Similar to PID, you can tune values by manually guessing and checking.
@@ -57,12 +57,12 @@ Similar to PID, you can tune values by manually guessing and checking.
57
57
58
58
Follow the instructions and see if you can get the optimal tuning solution. The model simulates a flywheel shooter mechanism and halfway through the simulation it shoots a ball. **DO NOT SKIP THIS PRACTICE**
59
59
60
-
While manual tuning works, WPILIB provides a way to generate kS, kV, and kA, called System Identification, or SysID for short.
60
+
While manual tuning works, WPILIB provides a way to generate `kS`, `kV`, and `kA`, called System Identification, or SysID for short.
61
61
62
62
!!! warning
63
63
Do not move on if you don't know how [lambdas/consumers](https://docs.wpilib.org/en/stable/docs/software/basic-programming/functions-as-data.html) work and the [Java Unit library](https://docs.wpilib.org/en/stable/docs/software/basic-programming/java-units.html).
64
64
65
-
System Identification is the process of determining a mathematical model for the behavior of a system through statistical anaylsis of its inputs and outputs. SysID has a process to determine kS, kV, and kA for the motor, so you don't have to do any tuning! They also provide PID values, but treat them as a "starting point" for further tuning.
65
+
System Identification is the process of determining a mathematical model for the behavior of a system through statistical anaylsis of its inputs and outputs. SysID has a process to determine `kS`, `kV`, and `kA` for the motor, so you don't have to do any tuning! They also provide PID values, but treat them as a "starting point" for further tuning.
66
66
67
67
Read the following WPILIB articles:
68
68
@@ -133,7 +133,7 @@ Note that [SysIdRoutineLog](https://github.wpilib.org/allwpilib/docs/release/jav
133
133
You may also notice that the only values that the logger logs are of instances that must be of `MutableMeasure<(insert measure)>`. This records the values along with its units. You can't just log a value.
134
134
135
135
!!! note
136
-
Notice that you can write anything in the `driveMotor()` and `logMotor()` methods. You are not limited to only powering a single motor but can power an entire elevator, arm, etc. SysID also analyzes elevators and arms which calculate the \\(k_{g}\\) constant.
136
+
Notice that you can write anything in the `driveMotor()` and `logMotor()` methods. You are not limited to only powering a single motor but can power an entire elevator, arm, etc. SysID also analyzes elevators and arms which calculate the `kG` constant.
137
137
138
138
After you set up the testing parameters and mechanism to test, the SysIdRoutine provides functions that return a command to run the test.
139
139
@@ -167,14 +167,14 @@ Afterwards, put them into the SysID tool which can be opened by `Ctrl + Shift +
-[Additional Utilities and Tools](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/system-identification/additional-utils.html)
169
169
170
-
Once you have gotten good data and analysis, you should obtain kS, kV, kA and PID constants.
170
+
Once you have gotten good data and analysis, you should obtain `kS`, `kV`, `kA` and PID constants.
171
171
172
172
!!! warning
173
173
The PID constants are only a starting point and should be tuned more.
174
174
175
175
## Implementation
176
176
177
-
WPILIB provides a [SimpleMotorFeedforward](https://github.wpilib.org/allwpilib/docs/release/java/edu/wpi/first/math/controller/SimpleMotorFeedforward.html) class that runs feedforward for a motor. After you obtain your feedforward constants (kS, kV, kA) from SysID, you put them into the constructor of the `SimpleMotorFeedforward` and use the listed methods.
177
+
WPILIB provides a [SimpleMotorFeedforward](https://github.wpilib.org/allwpilib/docs/release/java/edu/wpi/first/math/controller/SimpleMotorFeedforward.html) class that runs feedforward for a motor. After you obtain your feedforward constants (`kS`, `kV`, `kA`) from SysID, you put them into the constructor of the `SimpleMotorFeedforward` and use the listed methods.
178
178
```java
179
179
// Create a new SimpleMotorFeedforward with gains kS, kV, and kA
Similarly WPILIB provides a `ArmFeedforward` and an `ElevatorFeedforward` class whose only difference from `SimpleFeedforward` is that it accepts a \\(k_{g}\\) value.
193
+
Similarly WPILIB provides a `ArmFeedforward` and an `ElevatorFeedforward` class whose only difference from `SimpleFeedforward` is that it accepts a `kG` value.
0 commit comments