Skip to content

Commit 85d23ed

Browse files
Finished System Idenfication section
1 parent 9e7a7d4 commit 85d23ed

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

docs/section-7/feedforward-control.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Feedforward isn't limited to controlling velocity, you can determine the voltage
2222
We will first learn about the most common feedforward model used for motors, then show how the model can be used to control motor velocity and acceleration. Afterwards, we will cover more complicated mechanisms such as the arm subsystem.
2323

2424
## The Permanent-Magnet DC Motor Feedforward Equation
25-
[Click here to read about the equation](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/introduction/introduction-to-feedforward.html). Don't read past the "Variants of the Feedforward Equation".
25+
[Click here to read about the equation](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/introduction/introduction-to-feedforward.html).
2626

2727
For those that only want a quick summary. Here is the equation:
2828

@@ -50,6 +50,8 @@ motor.setVoltage(feedforwardVolts);
5050
!!! warning
5151
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.
5252

53+
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.
54+
5355
## Tuning and System Idenfication
5456
Similar to PID, you can tune values by manually guessing and checking.
5557

@@ -132,6 +134,9 @@ Note that [SysIdRoutineLog](https://github.wpilib.org/allwpilib/docs/release/jav
132134

133135
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.
134136

137+
!!! note
138+
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.
139+
135140
After you set up the testing parameters and mechanism to test, the SysIdRoutine provides functions that return a command to run the test.
136141

137142
```java
@@ -150,10 +155,25 @@ Typically it is recommended to bind these commands to controller buttons or an a
150155
GenericHID controller = new GenericHID(0);
151156
Shooter shooter = new Shooter();
152157

153-
new JoystickButton(controller, Button.kY.value).whileTrue(shooter.sysIdQuasistatic(SysIdRoutine.Direction.kForward));
158+
new JoystickButton(controller, Button.kY.value)
159+
.whileTrue(
160+
shooter.sysIdQuasistatic(SysIdRoutine.Direction.kForward)
161+
);
154162
```
155163
Now you are ready to enable and run the tests! Typically the longer you run them, the more data you get which will lead to more accurate calculations. However, keep in mind not to run too long for safety purposes. After all four tests have been run, use the [DataLogTool](https://docs.wpilib.org/en/stable/docs/software/telemetry/datalog-download.html) to get the files.
156164

165+
Afterwards, put them into the SysID tool which can be opened by `Ctrl + Shift + P` and typing `Start Tool`. Here are the following articles for analyzing the data and determining the constants:
166+
167+
- [Loading Data](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/system-identification/loading-data.html)
168+
- [Viewing Diagnostics](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/system-identification/viewing-diagnostics.html)
169+
- [Analyzing Data](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/system-identification/analyzing-gains.html)
170+
- [Additional Utilities and Tools](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/system-identification/additional-utils.html)
171+
172+
Once you have gotten good data and analysis, you should obtain kS, kV, kA and PID constants.
173+
174+
!!! warning
175+
The PID constants are only a starting point and should be tuned more.
176+
157177
## Implementation
158178

159179
## Conclusion

0 commit comments

Comments
 (0)