Swerve Module class that encapsulates a swerve module powered by CTR Electronics devices.
More...
#include <ctre/phoenix6/swerve/impl/SwerveModuleImpl.hpp>
Swerve Module class that encapsulates a swerve module powered by CTR Electronics devices.
This class handles the hardware devices but does not configure them for swerve module operation using the Phoenix 6 API. Users should create a high-level SwerveModule instead of using this directly.
◆ SwerveModuleImpl()
template<typename DriveMotorConfigsT , typename SteerMotorConfigsT , typename EncoderConfigsT >
ctre::phoenix6::swerve::impl::SwerveModuleImpl::SwerveModuleImpl |
( |
SwerveModuleConstants< DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT > const & | constants, |
|
|
CANBus | canbus ) |
Construct a SwerveModuleImpl with the specified constants.
- Parameters
-
constants | Constants used to construct the module |
canbus | The CAN bus this module is on |
◆ ~SwerveModuleImpl()
ctre::phoenix6::swerve::impl::SwerveModuleImpl::~SwerveModuleImpl |
( |
| ) |
|
◆ Apply() [1/2]
template<typename DriveReq , typename SteerReq >
void ctre::phoenix6::swerve::impl::SwerveModuleImpl::Apply |
( |
DriveReq && | driveRequest, |
|
|
SteerReq && | steerRequest ) |
|
inline |
Controls this module using the specified drive and steer control requests.
This is intended only to be used for characterization of the robot; do not use this for normal use.
- Parameters
-
driveRequest | The control request to apply to the drive motor |
steerRequest | The control request to apply to the steer motor |
◆ Apply() [2/2]
void ctre::phoenix6::swerve::impl::SwerveModuleImpl::Apply |
( |
ModuleRequest const & | moduleRequest | ) |
|
Applies the desired ModuleRequest to this module.
- Parameters
-
moduleRequest | The request to apply to this module |
◆ ConfigNeutralMode()
Configures the neutral mode to use for the module's drive motor.
- Parameters
-
neutralMode | The drive motor neutral mode |
timeoutSeconds | Maximum amount of time to wait when performing configuration |
- Returns
- Status code response of the request
◆ GetCachedPosition()
SwerveModulePosition ctre::phoenix6::swerve::impl::SwerveModuleImpl::GetCachedPosition |
( |
| ) |
const |
|
inline |
Gets the last cached swerve module position.
This differs from GetPosition in that it will not perform any latency compensation or refresh the signals.
- Returns
- Last cached SwerveModulePosition
◆ GetCurrentState()
SwerveModuleState ctre::phoenix6::swerve::impl::SwerveModuleImpl::GetCurrentState |
( |
| ) |
const |
|
inline |
Get the current state of the module.
This is typically used for telemetry, as the SwerveModulePosition is used for odometry.
- Returns
- Current state of the module
◆ GetDriveClosedLoopOutputType()
ClosedLoopOutputType ctre::phoenix6::swerve::impl::SwerveModuleImpl::GetDriveClosedLoopOutputType |
( |
| ) |
const |
|
inline |
Gets the closed-loop output type to use for the drive motor.
- Returns
- Drive motor closed-loop output type
◆ GetPosition()
SwerveModulePosition ctre::phoenix6::swerve::impl::SwerveModuleImpl::GetPosition |
( |
bool | refresh | ) |
|
Gets the state of this module and passes it back as a SwerveModulePosition object with latency compensated values.
This function is blocking when it performs a refresh.
- Parameters
-
refresh | True if the signals should be refreshed |
- Returns
- SwerveModulePosition containing this module's state.
◆ GetSteerClosedLoopOutputType()
ClosedLoopOutputType ctre::phoenix6::swerve::impl::SwerveModuleImpl::GetSteerClosedLoopOutputType |
( |
| ) |
const |
|
inline |
Gets the closed-loop output type to use for the steer motor.
- Returns
- Steer motor closed-loop output type
◆ GetTargetState()
SwerveModuleState ctre::phoenix6::swerve::impl::SwerveModuleImpl::GetTargetState |
( |
| ) |
const |
|
inline |
Get the target state of the module.
This is typically used for telemetry.
- Returns
- Target state of the module
◆ ResetPosition()
void ctre::phoenix6::swerve::impl::SwerveModuleImpl::ResetPosition |
( |
| ) |
|
|
inline |
Resets this module's drive motor position to 0 rotations.
◆ SwerveDrivetrainImpl
The documentation for this class was generated from the following file: