Class CentripetalAccelerationConstraint

java.lang.Object
edu.wpi.first.math.trajectory.constraint.CentripetalAccelerationConstraint
All Implemented Interfaces:
TrajectoryConstraint

A constraint on the maximum absolute centripetal acceleration allowed when traversing a trajectory. The centripetal acceleration of a robot is defined as the velocity squared divided by the radius of curvature.

Effectively, limiting the maximum centripetal acceleration will cause the robot to slow down around tight turns, making it easier to track trajectories with sharp turns.

  • Constructor Details

    • CentripetalAccelerationConstraint

      public CentripetalAccelerationConstraint(double maxCentripetalAcceleration)
      Constructs a centripetal acceleration constraint.
      Parameters:
      maxCentripetalAcceleration - The max centripetal acceleration in m/s².
  • Method Details

    • getMaxVelocity

      public double getMaxVelocity(Pose2d pose, double curvature, double velocity)
      Returns the max velocity given the current pose and curvature.
      Specified by:
      getMaxVelocity in interface TrajectoryConstraint
      Parameters:
      pose - The pose at the current point in the trajectory.
      curvature - The curvature at the current point in the trajectory in rad/m.
      velocity - The velocity at the current point in the trajectory before constraints are applied in m/s.
      Returns:
      The absolute maximum velocity.
    • getMinMaxAcceleration

      public TrajectoryConstraint.MinMax getMinMaxAcceleration(Pose2d pose, double curvature, double velocity)
      Returns the minimum and maximum allowable acceleration for the trajectory given pose, curvature, and speed.
      Specified by:
      getMinMaxAcceleration in interface TrajectoryConstraint
      Parameters:
      pose - The pose at the current point in the trajectory.
      curvature - The curvature at the current point in the trajectory in rad/m.
      velocity - The speed at the current point in the trajectory in m/s.
      Returns:
      The min and max acceleration bounds.