Foresight Options
Configure path execution behavior, deviation tolerances, and drive ratios in ForesightConfig.
Foresight Options define how the robot balances heading, position and speed while driving a path. All of these are configured in ForesightConfig.
Heading Drive Ratio
headingDriveRatio controls how much priority is given to heading correction compared to forward movement. Higher values give heading correction more priority, while lower values allow more forward movement before heading correction takes priority.
The default value is 0.5.
c.headingDriveRatio.set(0.5);Path Continuation
brakeAtEnd determines whether the robot should start braking before getting to the end of the path or keep coasting.
This only affects the final location, the rest of the paths continue normally.
The default value is true.
c.brakeAtEnd.set(true);Deviation Tolerances
translationalDeviationTolerance and headingDeviationTolerance determine whether the robot's position and heading are still on track. If either error exceeds its tolerance, the follower prioritizes correcting the error instead of continuing normally along the path.
The default value for translationalDeviationTolerance is 2.5 inches, and for headingDeviationTolerance is 11.25 degrees.
c.translationalDeviationTolerance.set(2.5);
c.headingDeviationTolerance.set(Math.toRadians(11.25));Cosine scaling
cosineScale reduces the robot's forward speed when its position or heading error gets too large.
Once the error passes twice the deviation tolerance, forward speed drops to zero, giving the correction controllers full use of the remaining power. It doesn't make the correction stronger; it just reduces the competition from forward movement. Below the tolerance, forward speed stays unchanged.
The default value is false.
c.cosineScale.set(false);Setting Foresight Options
Constraints can be changed in ForesightConfig alongside the other follower constants:
public static ForesightConfig foresightConfig = new ForesightConfig(
c -> {
c.headingDriveRatio.set(0.5);
c.brakeAtEnd.set(true);
c.translationalDeviationTolerance.set(2.5);
c.headingDeviationTolerance.set(Math.toRadians(11.25));
c.cosineScale.set(false);
// Other Foresight constants...
}
);Last updated on