Skip to content

Commit de2b2ae

Browse files
moved warning block about feedforward
1 parent 132fd2f commit de2b2ae

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

docs/section-7/feedforward-control.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,17 @@ where `V` is the applied voltage, `d` is the displacement (position) of the moto
3434

3535
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).
3636

37-
Then, to drive the motor at the desired velocity and acceleration, it is as easy as writing:
37+
!!! warning
38+
The amount of voltage calculated is the amount of voltage used to **MAINTAIN** the motor at the specified velocity and acceleration. When `motor.setVoltage(feedforwardVolts)` is run, that does not automatically drive the motor to the specified velocity and acceleration. If the code was run when the motor is at rest, then the voltage will be used the overcome the static friction and accelerate the motor, not to maintain the motor at the specified velocity and acceleration as the motor is not at the specified velocity.
39+
40+
Then, to keep the motor at the desired velocity and acceleration, it is as easy as writing:
3841
```java
3942
// assume kS, kV, and kA are defined
4043
double vel = 5;
4144
double accel = 1;
4245
double feedforwardVolts = kS * Math.signum(vel) + kV * vel + kA * accel;
4346
motor.setVoltage(feedforwardVolts);
4447
```
45-
!!! warning
46-
The amount of voltage calculated is the amount of voltage used to **MAINTAIN** the motor at the specified velocity and acceleration. When `motor.setVoltage(feedforwardVolts)` is run, that does not automatically drive the motor to the specified velocity and acceleration. If the code was run when the motor is at rest, then the voltage will be used the overcome the static friction and accelerate the motor, not to maintain the motor at the specified velocity and acceleration as the motor is not at the specified velocity.
4748

4849
!!! warning
4950
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.

0 commit comments

Comments
 (0)