13#include "wpi/units/angular_velocity.hpp"
14#include "wpi/units/math.hpp"
15#include "wpi/units/time.hpp"
16#include "wpi/units/velocity.hpp"
58 wpi::units::second_t dt)
77 const auto& eTranslate = m_poseError.Translation();
78 const auto& eRotate = m_poseError.Rotation();
79 const auto& tolTranslate = m_poseTolerance.Translation();
80 const auto& tolRotate = m_poseTolerance.Rotation();
81 return wpi::units::math::abs(eTranslate.X()) < tolTranslate.X() &&
82 wpi::units::math::abs(eTranslate.Y()) < tolTranslate.Y() &&
83 wpi::units::math::abs(eRotate.Radians()) < tolRotate.Radians();
93 m_poseTolerance = poseTolerance;
109 wpi::units::meters_per_second_t linearVelocityRef,
110 wpi::units::radians_per_second_t angularVelocityRef);
137 Eigen::Matrix<double, 3, 3> m_Q;
138 Eigen::Matrix<double, 2, 2> m_R;
140 wpi::units::second_t m_dt;
144 bool m_enabled =
true;
#define WPILIB_DLLEXPORT
Definition SymbolExports.hpp:36
LTVUnicycleController(const wpi::util::array< double, 3 > &Qelems, const wpi::util::array< double, 2 > &Relems, wpi::units::second_t dt)
Constructs a linear time-varying unicycle controller.
Definition LTVUnicycleController.hpp:56
void SetEnabled(bool enabled)
Enables and disables the controller for troubleshooting purposes.
Definition LTVUnicycleController.hpp:133
LTVUnicycleController(wpi::units::second_t dt)
Constructs a linear time-varying unicycle controller with default maximum desired error tolerances of...
Definition LTVUnicycleController.hpp:40
bool AtReference() const
Returns true if the pose error is within tolerance of the reference.
Definition LTVUnicycleController.hpp:76
LTVUnicycleController & operator=(LTVUnicycleController &&)=default
Move assignment operator.
LTVUnicycleController(LTVUnicycleController &&)=default
Move constructor.
ChassisVelocities Calculate(const Pose2d ¤tPose, const Pose2d &poseRef, wpi::units::meters_per_second_t linearVelocityRef, wpi::units::radians_per_second_t angularVelocityRef)
Returns the linear and angular velocity outputs of the LTV controller.
ChassisVelocities Calculate(const Pose2d ¤tPose, const Trajectory::State &desiredState)
Returns the linear and angular velocity outputs of the LTV controller.
Definition LTVUnicycleController.hpp:122
void SetTolerance(const Pose2d &poseTolerance)
Sets the pose error which is considered tolerable for use with AtReference().
Definition LTVUnicycleController.hpp:92
Represents a 2D pose containing translational and rotational elements.
Definition Pose2d.hpp:27
This class is a wrapper around std::array that does compile time size checking.
Definition array.hpp:26
Definition LinearSystem.hpp:20
constexpr Eigen::Matrix< double, sizeof...(Ts), sizeof...(Ts)> CostMatrix(Ts... tolerances)
Creates a cost matrix from the given vector for use with LQR.
Definition StateSpaceUtil.hpp:34
Definition CvSource.hpp:15
Represents robot chassis velocities.
Definition ChassisVelocities.hpp:26
Represents one point on the trajectory.
Definition Trajectory.hpp:33
Pose2d pose
The pose at that point of the trajectory.
Definition Trajectory.hpp:44
wpi::units::meters_per_second_t velocity
The velocity at that point of the trajectory.
Definition Trajectory.hpp:38
wpi::units::curvature_t curvature
The curvature at that point of the trajectory.
Definition Trajectory.hpp:47