WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
MaxVelocityConstraint.hpp
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
8#include "wpi/units/math.hpp"
9#include "wpi/units/velocity.hpp"
11
12namespace wpi::math {
13
14/**
15 * Represents a constraint that enforces a max velocity. This can be composed
16 * with the EllipticalRegionConstraint or RectangularRegionConstraint to enforce
17 * a max velocity within a region.
18 */
20 public:
21 /**
22 * Constructs a new MaxVelocityConstraint.
23 *
24 * @param maxVelocity The max velocity.
25 */
26 constexpr explicit MaxVelocityConstraint(
27 wpi::units::meters_per_second_t maxVelocity)
28 : m_maxVelocity(wpi::units::math::abs(maxVelocity)) {}
29
30 constexpr wpi::units::meters_per_second_t MaxVelocity(
31 const Pose2d& pose, wpi::units::curvature_t curvature,
32 wpi::units::meters_per_second_t velocity) const override {
33 return m_maxVelocity;
34 }
35
37 const Pose2d& pose, wpi::units::curvature_t curvature,
38 wpi::units::meters_per_second_t velocity) const override {
39 return {};
40 }
41
42 private:
43 wpi::units::meters_per_second_t m_maxVelocity;
44};
45
46} // namespace wpi::math
#define WPILIB_DLLEXPORT
Definition SymbolExports.hpp:36
constexpr MaxVelocityConstraint(wpi::units::meters_per_second_t maxVelocity)
Constructs a new MaxVelocityConstraint.
Definition MaxVelocityConstraint.hpp:26
constexpr MinMax MinMaxAcceleration(const Pose2d &pose, wpi::units::curvature_t curvature, wpi::units::meters_per_second_t velocity) const override
Returns the minimum and maximum allowable acceleration for the trajectory given pose,...
Definition MaxVelocityConstraint.hpp:36
constexpr wpi::units::meters_per_second_t MaxVelocity(const Pose2d &pose, wpi::units::curvature_t curvature, wpi::units::meters_per_second_t velocity) const override
Returns the max velocity given the current pose and curvature.
Definition MaxVelocityConstraint.hpp:30
Represents a 2D pose containing translational and rotational elements.
Definition Pose2d.hpp:27
constexpr TrajectoryConstraint()=default
Definition LinearSystem.hpp:20
Definition CvSource.hpp:15
Represents a minimum and maximum acceleration.
Definition TrajectoryConstraint.hpp:36