Package com.crossbotics.ftchelper.drive
Class MotionMath
java.lang.Object
com.crossbotics.ftchelper.drive.MotionMath
Speed-profile math for autonomous moves. No hardware here.
(A "speed profile" is the plan for how fast to go at each point of a move.)
Docs: docs/modules/drive.md (section "How a move works (cruise and taper)")
-
Method Summary
Modifier and TypeMethodDescriptionstatic doubletaperSpeed(double remainingFraction, double minSpeed, double maxSpeed, double taperStart) The speed for this part of a move: full speed ("cruise") until the last part, then a straight-line slow-down tominSpeedat the end ("taper").
-
Method Details
-
taperSpeed
public static double taperSpeed(double remainingFraction, double minSpeed, double maxSpeed, double taperStart) The speed for this part of a move: full speed ("cruise") until the last part, then a straight-line slow-down tominSpeedat the end ("taper"). Slowing down at the end makes the robot stop closer to the target, without skidding past it.Example: min 0.3, max 0.8, taper 0.1. With 50% left: 0.8. With 5% left: 0.55. With 0% left: 0.3.
- Parameters:
remainingFraction- how much of the move is left, 1 = all, 0 = noneminSpeed- speed at the very endmaxSpeed- cruise speedtaperStart- start slowing when this fraction is left (e.g. 0.10)- Returns:
- the motor power to use now, between minSpeed and maxSpeed
-