The linear time-varying unicycle controller has a similar form to the LQR, but the model used to compute the controller gain is the nonlinear model linearized around the drivetrain's current state.
More...
#include <frc/controller/LTVUnicycleController.h>
|
| LTVUnicycleController (units::second_t dt, units::meters_per_second_t maxVelocity=9_mps) |
| Constructs a linear time-varying unicycle controller with default maximum desired error tolerances of (0.0625 m, 0.125 m, 2 rad) and default maximum desired control effort of (1 m/s, 2 rad/s). More...
|
|
| LTVUnicycleController (const wpi::array< double, 3 > &Qelems, const wpi::array< double, 2 > &Relems, units::second_t dt, units::meters_per_second_t maxVelocity=9_mps) |
| Constructs a linear time-varying unicycle controller. More...
|
|
| LTVUnicycleController (LTVUnicycleController &&)=default |
| Move constructor. More...
|
|
LTVUnicycleController & | operator= (LTVUnicycleController &&)=default |
| Move assignment operator. More...
|
|
bool | AtReference () const |
| Returns true if the pose error is within tolerance of the reference. More...
|
|
void | SetTolerance (const Pose2d &poseTolerance) |
| Sets the pose error which is considered tolerable for use with AtReference(). More...
|
|
ChassisSpeeds | Calculate (const Pose2d ¤tPose, const Pose2d &poseRef, units::meters_per_second_t linearVelocityRef, units::radians_per_second_t angularVelocityRef) |
| Returns the linear and angular velocity outputs of the LTV controller. More...
|
|
ChassisSpeeds | Calculate (const Pose2d ¤tPose, const Trajectory::State &desiredState) |
| Returns the linear and angular velocity outputs of the LTV controller. More...
|
|
void | SetEnabled (bool enabled) |
| Enables and disables the controller for troubleshooting purposes. More...
|
|
The linear time-varying unicycle controller has a similar form to the LQR, but the model used to compute the controller gain is the nonlinear model linearized around the drivetrain's current state.
See section 8.9 in Controls Engineering in FRC for a derivation of the control law we used shown in theorem 8.9.1.
◆ LTVUnicycleController() [1/3]
frc::LTVUnicycleController::LTVUnicycleController |
( |
units::second_t |
dt, |
|
|
units::meters_per_second_t |
maxVelocity = 9_mps |
|
) |
| |
|
explicit |
Constructs a linear time-varying unicycle controller with default maximum desired error tolerances of (0.0625 m, 0.125 m, 2 rad) and default maximum desired control effort of (1 m/s, 2 rad/s).
- Parameters
-
dt | Discretization timestep. |
maxVelocity | The maximum velocity for the controller gain lookup table. |
- Exceptions
-
std::domain_error | if maxVelocity <= 0. |
◆ LTVUnicycleController() [2/3]
frc::LTVUnicycleController::LTVUnicycleController |
( |
const wpi::array< double, 3 > & |
Qelems, |
|
|
const wpi::array< double, 2 > & |
Relems, |
|
|
units::second_t |
dt, |
|
|
units::meters_per_second_t |
maxVelocity = 9_mps |
|
) |
| |
Constructs a linear time-varying unicycle controller.
- Parameters
-
Qelems | The maximum desired error tolerance for each state. |
Relems | The maximum desired control effort for each input. |
dt | Discretization timestep. |
maxVelocity | The maximum velocity for the controller gain lookup table. |
- Exceptions
-
std::domain_error | if maxVelocity <= 0. |
◆ LTVUnicycleController() [3/3]
◆ AtReference()
bool frc::LTVUnicycleController::AtReference |
( |
| ) |
const |
Returns true if the pose error is within tolerance of the reference.
◆ Calculate() [1/2]
ChassisSpeeds frc::LTVUnicycleController::Calculate |
( |
const Pose2d & |
currentPose, |
|
|
const Pose2d & |
poseRef, |
|
|
units::meters_per_second_t |
linearVelocityRef, |
|
|
units::radians_per_second_t |
angularVelocityRef |
|
) |
| |
Returns the linear and angular velocity outputs of the LTV controller.
The reference pose, linear velocity, and angular velocity should come from a drivetrain trajectory.
- Parameters
-
currentPose | The current pose. |
poseRef | The desired pose. |
linearVelocityRef | The desired linear velocity. |
angularVelocityRef | The desired angular velocity. |
◆ Calculate() [2/2]
Returns the linear and angular velocity outputs of the LTV controller.
The reference pose, linear velocity, and angular velocity should come from a drivetrain trajectory.
- Parameters
-
currentPose | The current pose. |
desiredState | The desired pose, linear velocity, and angular velocity from a trajectory. |
◆ operator=()
Move assignment operator.
◆ SetEnabled()
void frc::LTVUnicycleController::SetEnabled |
( |
bool |
enabled | ) |
|
Enables and disables the controller for troubleshooting purposes.
- Parameters
-
enabled | If the controller is enabled or not. |
◆ SetTolerance()
void frc::LTVUnicycleController::SetTolerance |
( |
const Pose2d & |
poseTolerance | ) |
|
Sets the pose error which is considered tolerable for use with AtReference().
- Parameters
-
poseTolerance | Pose error which is tolerable. |
The documentation for this class was generated from the following file: