Class CentripetalAccelerationConstraint

  • All Implemented Interfaces:
    TrajectoryConstraint

    public class CentripetalAccelerationConstraint
    extends Object
    implements 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 Detail

      • CentripetalAccelerationConstraint

        public CentripetalAccelerationConstraint​(double maxCentripetalAccelerationMetersPerSecondSq)
        Constructs a centripetal acceleration constraint.
        Parameters:
        maxCentripetalAccelerationMetersPerSecondSq - The max centripetal acceleration.
    • Method Detail

      • getMaxVelocityMetersPerSecond

        public double getMaxVelocityMetersPerSecond​(Pose2d poseMeters,
                                                    double curvatureRadPerMeter,
                                                    double velocityMetersPerSecond)
        Returns the max velocity given the current pose and curvature.
        Specified by:
        getMaxVelocityMetersPerSecond in interface TrajectoryConstraint
        Parameters:
        poseMeters - The pose at the current point in the trajectory.
        curvatureRadPerMeter - The curvature at the current point in the trajectory.
        velocityMetersPerSecond - The velocity at the current point in the trajectory before constraints are applied.
        Returns:
        The absolute maximum velocity.
      • getMinMaxAccelerationMetersPerSecondSq

        public TrajectoryConstraint.MinMax getMinMaxAccelerationMetersPerSecondSq​(Pose2d poseMeters,
                                                                                  double curvatureRadPerMeter,
                                                                                  double velocityMetersPerSecond)
        Returns the minimum and maximum allowable acceleration for the trajectory given pose, curvature, and speed.
        Specified by:
        getMinMaxAccelerationMetersPerSecondSq in interface TrajectoryConstraint
        Parameters:
        poseMeters - The pose at the current point in the trajectory.
        curvatureRadPerMeter - The curvature at the current point in the trajectory.
        velocityMetersPerSecond - The speed at the current point in the trajectory.
        Returns:
        The min and max acceleration bounds.