WPILibC++  2020.3.2-60-g3011ebe
RectangularRegionConstraint.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2020 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include <units/units.h>
11 
12 #include "frc/geometry/Rotation2d.h"
13 #include "frc/geometry/Translation2d.h"
14 #include "frc/trajectory/constraint/TrajectoryConstraint.h"
15 
16 namespace frc {
21  public:
32  RectangularRegionConstraint(const Translation2d& bottomLeftPoint,
33  const Translation2d& topRightPoint,
34  const TrajectoryConstraint& constraint);
35 
36  units::meters_per_second_t MaxVelocity(
37  const Pose2d& pose, units::curvature_t curvature,
38  units::meters_per_second_t velocity) const override;
39 
40  MinMax MinMaxAcceleration(const Pose2d& pose, units::curvature_t curvature,
41  units::meters_per_second_t speed) const override;
42 
50  bool IsPoseInRegion(const Pose2d& pose) const;
51 
52  private:
53  Translation2d m_bottomLeftPoint;
54  Translation2d m_topRightPoint;
55  const TrajectoryConstraint& m_constraint;
56 };
57 } // namespace frc
frc::RectangularRegionConstraint::RectangularRegionConstraint
RectangularRegionConstraint(const Translation2d &bottomLeftPoint, const Translation2d &topRightPoint, const TrajectoryConstraint &constraint)
Constructs a new RectangularRegionConstraint.
frc::TrajectoryConstraint::MinMax
Represents a minimum and maximum acceleration.
Definition: TrajectoryConstraint.h:37
frc::RectangularRegionConstraint
Enforces a particular constraint only within a rectangular region.
Definition: RectangularRegionConstraint.h:20
frc::Translation2d
Represents a translation in 2d space.
Definition: Translation2d.h:28
frc::RectangularRegionConstraint::MaxVelocity
units::meters_per_second_t MaxVelocity(const Pose2d &pose, units::curvature_t curvature, units::meters_per_second_t velocity) const override
Returns the max velocity given the current pose and curvature.
frc::TrajectoryConstraint
An interface for defining user-defined velocity and acceleration constraints while generating traject...
Definition: TrajectoryConstraint.h:22
frc::Pose2d
Represents a 2d pose containing translational and rotational elements.
Definition: Pose2d.h:23
frc::RectangularRegionConstraint::IsPoseInRegion
bool IsPoseInRegion(const Pose2d &pose) const
Returns whether the specified robot pose is within the region that the constraint is enforced in.
frc
A class that enforces constraints on the differential drive kinematics.
Definition: PDPSim.h:16
frc::RectangularRegionConstraint::MinMaxAcceleration
MinMax MinMaxAcceleration(const Pose2d &pose, units::curvature_t curvature, units::meters_per_second_t speed) const override
Returns the minimum and maximum allowable acceleration for the trajectory given pose,...