WPILibC++  2020.3.2
RamseteController.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2019-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/Pose2d.h"
13 #include "frc/kinematics/ChassisSpeeds.h"
14 #include "frc/trajectory/Trajectory.h"
15 
16 namespace frc {
17 
46  public:
55  RamseteController(double b, double zeta);
56 
63 
67  bool AtReference() const;
68 
75  void SetTolerance(const Pose2d& poseTolerance);
76 
88  ChassisSpeeds Calculate(const Pose2d& currentPose, const Pose2d& poseRef,
89  units::meters_per_second_t linearVelocityRef,
90  units::radians_per_second_t angularVelocityRef);
91 
102  ChassisSpeeds Calculate(const Pose2d& currentPose,
103  const Trajectory::State& desiredState);
104 
110  void SetEnabled(bool enabled);
111 
112  private:
113  double m_b;
114  double m_zeta;
115 
116  Pose2d m_poseError;
117  Pose2d m_poseTolerance;
118  bool m_enabled = true;
119 };
120 
121 } // namespace frc
frc::RamseteController::RamseteController
RamseteController()
Construct a Ramsete unicycle controller.
Definition: RamseteController.h:62
frc::Trajectory::State
Represents one point on the trajectory.
Definition: Trajectory.h:39
frc::RamseteController::AtReference
bool AtReference() const
Returns true if the pose error is within tolerance of the reference.
frc::RamseteController::SetTolerance
void SetTolerance(const Pose2d &poseTolerance)
Sets the pose error which is considered tolerable for use with AtReference().
frc::ChassisSpeeds
Represents the speed of a robot chassis.
Definition: ChassisSpeeds.h:26
frc::Pose2d
Represents a 2d pose containing translational and rotational elements.
Definition: Pose2d.h:23
frc::RamseteController::SetEnabled
void SetEnabled(bool enabled)
Enables and disables the controller for troubleshooting purposes.
frc
A class that enforces constraints on the differential drive kinematics.
Definition: SPIAccelerometerSim.h:16
frc::RamseteController::Calculate
ChassisSpeeds Calculate(const Pose2d &currentPose, const Pose2d &poseRef, units::meters_per_second_t linearVelocityRef, units::radians_per_second_t angularVelocityRef)
Returns the next output of the Ramsete controller.
frc::RamseteController
Ramsete is a nonlinear time-varying feedback controller for unicycle models that drives the model to ...
Definition: RamseteController.h:45