![]() |
WPILibC++ 2027.0.0-alpha-2
|
This holonomic drive controller can be used to follow trajectories using a holonomic drivetrain (i.e. More...
#include <frc/controller/HolonomicDriveController.h>
Public Member Functions | |
constexpr | HolonomicDriveController (PIDController xController, PIDController yController, ProfiledPIDController< units::radian > thetaController) |
Constructs a holonomic drive controller. | |
constexpr | HolonomicDriveController (const HolonomicDriveController &)=default |
constexpr HolonomicDriveController & | operator= (const HolonomicDriveController &)=default |
constexpr | HolonomicDriveController (HolonomicDriveController &&)=default |
constexpr HolonomicDriveController & | operator= (HolonomicDriveController &&)=default |
constexpr bool | AtReference () const |
Returns true if the pose error is within tolerance of the reference. | |
constexpr void | SetTolerance (const Pose2d &tolerance) |
Sets the pose error which is considered tolerable for use with AtReference(). | |
constexpr ChassisSpeeds | Calculate (const Pose2d ¤tPose, const Pose2d &trajectoryPose, units::meters_per_second_t desiredLinearVelocity, const Rotation2d &desiredHeading) |
Returns the next output of the holonomic drive controller. | |
constexpr ChassisSpeeds | Calculate (const Pose2d ¤tPose, const Trajectory::State &desiredState, const Rotation2d &desiredHeading) |
Returns the next output of the holonomic drive controller. | |
constexpr void | SetEnabled (bool enabled) |
Enables and disables the controller for troubleshooting purposes. | |
constexpr PIDController & | getXController () |
Returns the X PIDController. | |
constexpr PIDController & | getYController () |
Returns the Y PIDController. | |
constexpr ProfiledPIDController< units::radian > & | getThetaController () |
Returns the rotation ProfiledPIDController. | |
constexpr PIDController & | GetXController () |
Returns the X PIDController. | |
constexpr PIDController & | GetYController () |
Returns the Y PIDController. | |
constexpr ProfiledPIDController< units::radian > & | GetThetaController () |
Returns the rotation ProfiledPIDController. | |
This holonomic drive controller can be used to follow trajectories using a holonomic drivetrain (i.e.
swerve or mecanum). Holonomic trajectory following is a much simpler problem to solve compared to skid-steer style drivetrains because it is possible to individually control field-relative x, y, and angular velocity.
The holonomic drive controller takes in one PID controller for each direction, field-relative x and y, and one profiled PID controller for the angular direction. Because the heading dynamics are decoupled from translations, users can specify a custom heading that the drivetrain should point toward. This heading reference is profiled for smoothness.
|
inlineconstexpr |
Constructs a holonomic drive controller.
xController | A PID Controller to respond to error in the field-relative x direction. |
yController | A PID Controller to respond to error in the field-relative y direction. |
thetaController | A profiled PID controller to respond to error in angle. |
|
constexprdefault |
|
constexprdefault |
|
inlineconstexpr |
Returns true if the pose error is within tolerance of the reference.
|
inlineconstexpr |
Returns the next output of the holonomic drive controller.
currentPose | The current pose, as measured by odometry or pose estimator. |
trajectoryPose | The desired trajectory pose, as sampled for the current timestep. |
desiredLinearVelocity | The desired linear velocity. |
desiredHeading | The desired heading. |
|
inlineconstexpr |
Returns the next output of the holonomic drive controller.
currentPose | The current pose, as measured by odometry or pose estimator. |
desiredState | The desired trajectory pose, as sampled for the current timestep. |
desiredHeading | The desired heading. |
|
inlineconstexpr |
Returns the rotation ProfiledPIDController.
|
inlineconstexpr |
Returns the rotation ProfiledPIDController.
|
inlineconstexpr |
Returns the X PIDController.
|
inlineconstexpr |
Returns the X PIDController.
|
inlineconstexpr |
Returns the Y PIDController.
|
inlineconstexpr |
Returns the Y PIDController.
|
constexprdefault |
|
constexprdefault |
|
inlineconstexpr |
Enables and disables the controller for troubleshooting purposes.
When Calculate() is called on a disabled controller, only feedforward values are returned.
enabled | If the controller is enabled or not. |
|
inlineconstexpr |
Sets the pose error which is considered tolerable for use with AtReference().
tolerance | Pose error which is tolerable. |