Represents the state of one swerve module.
More...
#include <frc/kinematics/SwerveModuleState.h>
|
constexpr bool | operator== (const SwerveModuleState &other) const |
| Checks equality between this SwerveModuleState and another object.
|
|
constexpr void | Optimize (const Rotation2d ¤tAngle) |
| Minimize the change in the heading this swerve module state would require by potentially reversing the direction the wheel spins.
|
|
constexpr void | CosineScale (const Rotation2d ¤tAngle) |
| Scales speed by cosine of angle error.
|
|
|
units::meters_per_second_t | speed = 0_mps |
| Speed of the wheel of the module.
|
|
Rotation2d | angle |
| Angle of the module.
|
|
Represents the state of one swerve module.
◆ CosineScale()
void frc::SwerveModuleState::CosineScale |
( |
const Rotation2d & | currentAngle | ) |
|
|
inlineconstexpr |
Scales speed by cosine of angle error.
This scales down movement perpendicular to the desired direction of travel that can occur when modules change directions. This results in smoother driving.
- Parameters
-
currentAngle | The current module angle. |
◆ operator==()
Checks equality between this SwerveModuleState and another object.
- Parameters
-
- Returns
- Whether the two objects are equal.
◆ Optimize() [1/2]
void frc::SwerveModuleState::Optimize |
( |
const Rotation2d & | currentAngle | ) |
|
|
inlineconstexpr |
Minimize the change in the heading this swerve module state would require by potentially reversing the direction the wheel spins.
If this is used with the PIDController class's continuous input functionality, the furthest a wheel will ever rotate is 90 degrees.
- Parameters
-
currentAngle | The current module angle. |
◆ Optimize() [2/2]
Minimize the change in heading the desired swerve module state would require by potentially reversing the direction the wheel spins.
If this is used with the PIDController class's continuous input functionality, the furthest a wheel will ever rotate is 90 degrees.
- Parameters
-
desiredState | The desired state. |
currentAngle | The current module angle. |
◆ angle
◆ speed
units::meters_per_second_t frc::SwerveModuleState::speed = 0_mps |
Speed of the wheel of the module.
The documentation for this struct was generated from the following file: