Skip to content

Commit 2983c7a

Browse files
authored
update: removed redundant prerequisites, added extra notes
1 parent 699881d commit 2983c7a

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

content/docs/pathing/tuning/drive-algorithm/predictive/configuration.mdx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,13 @@ title: "Tuning Predictive Braking"
44

55
<Callout type='warn' title="PIDFs vs. Predictive Braking">
66
You may either use PIDFs or Predictive Braking to control your robot.
7-
However, swerve is currently not compatible with Predictive Braking.
7+
However, swerve and tank are currently not compatible with Predictive Braking.
88
All further steps are for Predictive Braking users only.
99
</Callout>
1010

11-
# Prerequisites
12-
- **Mecanum wheels** (support for swerve and tank coming soon)
13-
- **Accurate Localization** (drive encoders alone are insufficient due to wheel slip)
14-
- Works best with robots with a balanced center of mass and robots that do not lift off the ground or turn dramatically when braking. Do not worry if your robot does these things. This algorithm will still work. Just consider adding more weight to your robot.
15-
16-
# Tuning
1711
1. Run the Tuning.java OpMode -> Automatic -> PredictiveBrakingTuner. This will give you values for `kQuadratic` and `kLinear`. In FollowerConstants, add `.predictiveBrakingCoefficients(new PredictiveBrakingCoefficients(kP, kLinear, kQuadratic))`. Insert the values given from the tuner into the method. Use a starting kP value around `0.1`.
18-
- `kQuadratic` represents the braking distance proportional to velocity squared. This is caused by constant forces such as sliding friction.
19-
- `kLinear` represents braking distance roughly proportional to velocity. This is caused by velocity-proportional forces such as back-EMF voltage and viscous friction.
12+
- `kQuadratic` represents the braking distance proportional to velocity squared. This is caused by constant forces such as braking power and sliding friction.
13+
- `kLinear` represents braking distance roughly proportional to velocity. This is caused by velocity-proportional forces such as back-EMF, torque delay, and viscous friction.
2014

2115
<iframe
2216
width="560"
@@ -28,14 +22,18 @@ All further steps are for Predictive Braking users only.
2822
allowFullScreen
2923
></iframe>
3024

25+
Do not be worried if the robot's heading turns while braking in the tuner. This is expected and does not hurt the results. Consider making a more balanced center of mass to combat this. In the future, the tuner will have heading correction.
26+
27+
Also do not be worried if your robot lifts off the ground while braking. This is normal as long as odometry can still get accurate measurements.
28+
3129
2. Run LineTest and adjust kP to your liking. kP usually ranges from `0.05-0.3`. kP changes are harder to notice and have minimal effects due to kP accounting for predicted error. However, tune kP as high as possible to maximize holding strength and accuracy, without jittering the robot. If you want smoother or sooner deceleration, try experimenting with kP of 0.05 or lower and increasing the kQuadratic term, as this will act more like a motion profile.
3230

3331
3. Currently, it is recommended to turn **off centripetal** forces in auto, as predictive braking naturally accounts for this. This can be done by adding the following in FollowerConstants.
3432
```java title="Constants.java"
3533
.centripetalScaling(0)
3634
```
3735

38-
4. **Lower the parametric end constraint**. Set it to a value like 0.97 or 0.95. PIDFs often overshoot and hit the parametric end early, but predictive braking fully stops in time, delaying when actions can trigger. Lowering the constraint lets actions trigger sooner and speeds up overall execution.
36+
4. **Lower the parametric end constraint**. Set it to a value like 0.97 or 0.95. PIDFs often overshoot and hit the parametric end early, but predictive braking fully stops in time, delaying when actions can trigger. Lowering the constraint lets actions trigger sooner and speeds up overall execution. However, do not set the parametric value very low (<0.9) or predictive braking will not work as intended because it will end the path before braking.
3937

4038
At the end of tuning, you should have at least this in FollowerConstants.
4139
```java title="Constants.java"

0 commit comments

Comments
 (0)