CTRE Phoenix 6 C++ 25.3.1
|
Contains everything the swerve module needs to apply a request. More...
#include <ctre/phoenix6/swerve/impl/SwerveModuleImpl.hpp>
Public Member Functions | |
ModuleRequest & | WithState (SwerveModuleState newState) |
Modifies the State parameter and returns itself. | |
ModuleRequest & | WithWheelForceFeedforwardX (units::newton_t newWheelForceFeedforwardX) |
Modifies the WheelForceFeedforwardX parameter and returns itself. | |
ModuleRequest & | WithWheelForceFeedforwardY (units::newton_t newWheelForceFeedforwardY) |
Modifies the WheelForceFeedforwardY parameter and returns itself. | |
ModuleRequest & | WithDriveRequest (DriveRequestType newDriveRequest) |
Modifies the DriveRequest parameter and returns itself. | |
ModuleRequest & | WithSteerRequest (SteerRequestType newSteerRequest) |
Modifies the SteerRequest parameter and returns itself. | |
ModuleRequest & | WithUpdatePeriod (units::second_t newUpdatePeriod) |
Modifies the UpdatePeriod parameter and returns itself. | |
ModuleRequest & | WithEnableFOC (bool newEnableFOC) |
Modifies the EnableFOC parameter and returns itself. | |
Public Attributes | |
SwerveModuleState | State {} |
Unoptimized speed and direction the module should target. | |
units::newton_t | WheelForceFeedforwardX = 0_N |
Robot-centric wheel force feedforward to apply in the X direction. | |
units::newton_t | WheelForceFeedforwardY = 0_N |
Robot-centric wheel force feedforward to apply in the Y direction. | |
DriveRequestType | DriveRequest = DriveRequestType::OpenLoopVoltage |
The type of control request to use for the drive motor. | |
SteerRequestType | SteerRequest = SteerRequestType::Position |
The type of control request to use for the steer motor. | |
units::second_t | UpdatePeriod = 0_s |
The update period of the module request. | |
bool | EnableFOC = true |
When using Voltage-based control, set to true (default) to use FOC commutation (requires Phoenix Pro), which increases peak power by ~15%. | |
Contains everything the swerve module needs to apply a request.
|
inline |
Modifies the DriveRequest parameter and returns itself.
The type of control request to use for the drive motor.
newDriveRequest | Parameter to modify |
|
inline |
Modifies the EnableFOC parameter and returns itself.
When using Voltage-based control, set to true (default) to use FOC commutation (requires Phoenix Pro), which increases peak power by ~15%. Set to false to use trapezoidal commutation. This is ignored when using Torque-based control, which always uses FOC.
FOC improves motor performance by leveraging torque (current) control. However, this may be inconvenient for applications that require specifying duty cycle or voltage. CTR-Electronics has developed a hybrid method that combines the performances gains of FOC while still allowing applications to provide duty cycle or voltage demand. This not to be confused with simple sinusoidal control or phase voltage control which lacks the performance gains.
newEnableFOC | Parameter to modify |
|
inline |
Modifies the State parameter and returns itself.
Unoptimized speed and direction the module should target.
newState | Parameter to modify |
|
inline |
Modifies the SteerRequest parameter and returns itself.
The type of control request to use for the steer motor.
newSteerRequest | Parameter to modify |
|
inline |
Modifies the UpdatePeriod parameter and returns itself.
The update period of the module request. Setting this to a non-zero value adds a velocity feedforward to the steer motor.
newUpdatePeriod | Parameter to modify |
|
inline |
Modifies the WheelForceFeedforwardX parameter and returns itself.
Robot-centric wheel force feedforward to apply in the X direction. X is defined as forward according to WPILib convention, so this determines the forward force to apply.
This force should include friction.
newWheelForceFeedforwardX | Parameter to modify |
|
inline |
Modifies the WheelForceFeedforwardY parameter and returns itself.
Robot-centric wheel force feedforward to apply in the Y direction. Y is defined as to the left according to WPILib convention, so this determines the force to apply to the left.
This force should include friction.
newWheelForceFeedforwardY | Parameter to modify |
DriveRequestType ctre::phoenix6::swerve::impl::SwerveModuleImpl::ModuleRequest::DriveRequest = DriveRequestType::OpenLoopVoltage |
The type of control request to use for the drive motor.
bool ctre::phoenix6::swerve::impl::SwerveModuleImpl::ModuleRequest::EnableFOC = true |
When using Voltage-based control, set to true (default) to use FOC commutation (requires Phoenix Pro), which increases peak power by ~15%.
Set to false to use trapezoidal commutation. This is ignored when using Torque-based control, which always uses FOC.
FOC improves motor performance by leveraging torque (current) control. However, this may be inconvenient for applications that require specifying duty cycle or voltage. CTR-Electronics has developed a hybrid method that combines the performances gains of FOC while still allowing applications to provide duty cycle or voltage demand. This not to be confused with simple sinusoidal control or phase voltage control which lacks the performance gains.
SwerveModuleState ctre::phoenix6::swerve::impl::SwerveModuleImpl::ModuleRequest::State {} |
Unoptimized speed and direction the module should target.
SteerRequestType ctre::phoenix6::swerve::impl::SwerveModuleImpl::ModuleRequest::SteerRequest = SteerRequestType::Position |
The type of control request to use for the steer motor.
units::second_t ctre::phoenix6::swerve::impl::SwerveModuleImpl::ModuleRequest::UpdatePeriod = 0_s |
The update period of the module request.
Setting this to a non-zero value adds a velocity feedforward to the steer motor.
units::newton_t ctre::phoenix6::swerve::impl::SwerveModuleImpl::ModuleRequest::WheelForceFeedforwardX = 0_N |
Robot-centric wheel force feedforward to apply in the X direction.
X is defined as forward according to WPILib convention, so this determines the forward force to apply.
This force should include friction applied to the ground.
units::newton_t ctre::phoenix6::swerve::impl::SwerveModuleImpl::ModuleRequest::WheelForceFeedforwardY = 0_N |
Robot-centric wheel force feedforward to apply in the Y direction.
Y is defined as to the left according to WPILib convention, so this determines the force to apply to the left.
This force should include friction applied to the ground.