Class MotionMath

java.lang.Object
com.crossbotics.ftchelper.drive.MotionMath

public final class MotionMath extends Object
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 Type
    Method
    Description
    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 to minSpeed at the end ("taper").

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 to minSpeed at 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 = none
      minSpeed - speed at the very end
      maxSpeed - cruise speed
      taperStart - start slowing when this fraction is left (e.g. 0.10)
      Returns:
      the motor power to use now, between minSpeed and maxSpeed