001// Copyright (c) FIRST and other WPILib contributors. 002// Open Source Software; you can modify and/or share it under the terms of 003// the WPILib BSD license file in the root directory of this project. 004 005package edu.wpi.first.math.trajectory.constraint; 006 007import edu.wpi.first.math.geometry.Pose2d; 008 009/** 010 * Represents a constraint that enforces a max velocity. This can be composed with the {@link 011 * EllipticalRegionConstraint} or {@link RectangularRegionConstraint} to enforce a max velocity in a 012 * region. 013 */ 014public class MaxVelocityConstraint implements TrajectoryConstraint { 015 private final double m_maxVelocity; 016 017 /** 018 * Constructs a new MaxVelocityConstraint. 019 * 020 * @param maxVelocity The max velocity in m/s. 021 */ 022 public MaxVelocityConstraint(double maxVelocity) { 023 m_maxVelocity = maxVelocity; 024 } 025 026 @Override 027 public double getMaxVelocity(Pose2d pose, double curvature, double velocity) { 028 return m_maxVelocity; 029 } 030 031 @Override 032 public TrajectoryConstraint.MinMax getMinMaxAcceleration( 033 Pose2d pose, double curvature, double velocity) { 034 return new MinMax(); 035 } 036}