phoenix6.swerve.swerve_module_constants
¶
Module Contents¶
Attributes¶
- class phoenix6.swerve.swerve_module_constants.ClosedLoopOutputType(*args, **kwds)¶
Bases:
enum.Enum
Supported closed-loop output types.
- VOLTAGE = 0¶
- TORQUE_CURRENT_FOC = 1¶
Requires Pro
- class phoenix6.swerve.swerve_module_constants.SteerFeedbackType(*args, **kwds)¶
Bases:
enum.Enum
Supported feedback sensors for the steer motors.
- FUSED_CANCODER = 0¶
Requires Pro; Use FeedbackSensorSourceValue.FUSED_CANCODER for the steer motor.
- SYNC_CANCODER = 1¶
Requires Pro; Use FeedbackSensorSourceValue.SYNC_CANCODER for the steer motor.
- REMOTE_CANCODER = 2¶
Use FeedbackSensorSourceValue.REMOTE_CANCODER for the steer motor.
- FUSED_CANDI_PWM1 = 3¶
Requires Pro; Use FeedbackSensorSourceValue.FUSED_CANDI_PWM1 for the steer motor.
- FUSED_CANDI_PWM2 = 4¶
Requires Pro; Use FeedbackSensorSourceValue.FUSED_CANDI_PWM2 for the steer motor.
- SYNC_CANDI_PWM1 = 5¶
Requires Pro; Use FeedbackSensorSourceValue.SYNC_CANDI_PWM1 for the steer motor.
- SYNC_CANDI_PWM2 = 6¶
Requires Pro; Use FeedbackSensorSourceValue.SYNC_CANDI_PWM2 for the steer motor.
- REMOTE_CANDI_PWM1 = 7¶
Use FeedbackSensorSourceValue.REMOTE_CANDI_PWM1 for the steer motor.
- REMOTE_CANDI_PWM2 = 8¶
Use FeedbackSensorSourceValue.REMOTE_CANDI_PWM2 for the steer motor.
- TALON_FXS_PULSE_WIDTH = 9¶
Use ExternalFeedbackSensorSourceValue.PULSE_WIDTH for the steer motor. This requires Talon FXS.
- class phoenix6.swerve.swerve_module_constants.DriveMotorArrangement(*args, **kwds)¶
Bases:
enum.Enum
Supported motor arrangements for the drive motors.
- TALON_FX_INTEGRATED = 0¶
Talon FX integrated brushless motor.
- TALON_FXS_NEO_JST = 1¶
Third party NEO brushless motor connected to a Talon FXS over JST.
- TALON_FXS_VORTEX_JST = 2¶
Third party VORTEX brushless motor connected to a Talon FXS over JST.
- class phoenix6.swerve.swerve_module_constants.SteerMotorArrangement(*args, **kwds)¶
Bases:
enum.Enum
Supported motor arrangements for the steer motors.
- TALON_FX_INTEGRATED = 0¶
Talon FX integrated brushless motor.
- TALON_FXS_MINION_JST = 1¶
CTR Electronics Minion® brushless motor connected to a Talon FXS over JST.
- TALON_FXS_NEO_JST = 2¶
Third party NEO brushless motor connected to a Talon FXS over JST.
- TALON_FXS_VORTEX_JST = 3¶
Third party VORTEX brushless motor connected to a Talon FXS over JST.
- TALON_FXS_NEO550_JST = 4¶
Third party NEO550 brushless motor connected to a Talon FXS over JST.
- TALON_FXS_BRUSHED_AB = 5¶
Brushed motor connected to a Talon FXS on terminals A and B.
- TALON_FXS_BRUSHED_AC = 6¶
Brushed motor connected to a Talon FXS on terminals A and C.
- TALON_FXS_BRUSHED_BC = 7¶
Brushed motor connected to a Talon FXS on terminals B and C.
- phoenix6.swerve.swerve_module_constants.DriveMotorConfigsT¶
- phoenix6.swerve.swerve_module_constants.SteerMotorConfigsT¶
- phoenix6.swerve.swerve_module_constants.EncoderConfigsT¶
- class phoenix6.swerve.swerve_module_constants.SwerveModuleConstants¶
Bases:
Generic
[DriveMotorConfigsT
,SteerMotorConfigsT
,EncoderConfigsT
]All constants for a swerve module.
- steer_motor_id: int = 0¶
CAN ID of the steer motor.
- drive_motor_id: int = 0¶
CAN ID of the drive motor.
- encoder_id: int = 0¶
CAN ID of the absolute encoder used for azimuth.
- encoder_offset: phoenix6.units.rotation = 0¶
Offset of the azimuth encoder.
- location_x: phoenix6.units.meter = 0¶
The location of this module’s wheels relative to the physical center of the robot in meters along the X axis of the robot.
- location_y: phoenix6.units.meter = 0¶
The location of this module’s wheels relative to the physical center of the robot in meters along the Y axis of the robot.
- drive_motor_inverted: bool = False¶
True if the drive motor is inverted.
- steer_motor_inverted: bool = False¶
True if the steer motor is inverted from the azimuth. The azimuth should rotate counter-clockwise (as seen from the top of the robot) for a positive motor output.
- encoder_inverted: bool = False¶
True if the azimuth encoder is inverted from the azimuth. The encoder should report a positive velocity when the azimuth rotates counter-clockwise (as seen from the top of the robot).
- drive_motor_gear_ratio: float = 0¶
Gear ratio between the drive motor and the wheel.
- steer_motor_gear_ratio: float = 0¶
Gear ratio between the steer motor and the azimuth encoder. For example, the SDS Mk4 has a steering ratio of 12.8.
- coupling_gear_ratio: float = 0¶
Coupled gear ratio between the azimuth encoder and the drive motor.
For a typical swerve module, the azimuth turn motor also drives the wheel a nontrivial amount, which affects the accuracy of odometry and control. This ratio represents the number of rotations of the drive motor caused by a rotation of the azimuth.
- wheel_radius: phoenix6.units.meter = 0¶
Radius of the driving wheel in meters.
- steer_motor_gains: phoenix6.configs.Slot0Configs¶
The steer motor closed-loop gains.
The steer motor uses the control ouput type specified by SteerMotorClosedLoopOutput and any SwerveModule.SteerRequestType. These gains operate on azimuth rotations (after the gear ratio).
- drive_motor_gains: phoenix6.configs.Slot0Configs¶
The drive motor closed-loop gains.
When using closed-loop control, the drive motor uses the control output type specified by DriveMotorClosedLoopOutput and any closed-loop SwerveModule.DriveRequestType. These gains operate on motor rotor rotations (before the gear ratio).
- steer_motor_closed_loop_output: ClosedLoopOutputType¶
The closed-loop output type to use for the steer motors.
- drive_motor_closed_loop_output: ClosedLoopOutputType¶
The closed-loop output type to use for the drive motors.
- slip_current: phoenix6.units.ampere = 120¶
The maximum amount of stator current the drive motors can apply without slippage.
- speed_at12_volts: phoenix6.units.meters_per_second = 0¶
When using open-loop drive control, this specifies the speed at which the robot travels when driven with 12 volts. This is used to approximate the output for a desired velocity. If using closed loop control, this value is ignored.
- drive_motor_type: DriveMotorArrangement¶
Choose the motor used for the drive motor.
If using a Talon FX, this should be set to TalonFX_Integrated. If using a Talon FXS, this should be set to the motor attached to the Talon FXS.
- steer_motor_type: SteerMotorArrangement¶
Choose the motor used for the steer motor.
If using a Talon FX, this should be set to TalonFX_Integrated. If using a Talon FXS, this should be set to the motor attached to the Talon FXS.
- feedback_source: SteerFeedbackType¶
Choose how the feedback sensors should be configured.
If the robot does not support Pro, then this should be set to RemoteCANcoder. Otherwise, users have the option to use either FusedCANcoder or SyncCANcoder depending on if there is a risk that the CANcoder can fail in a way to provide “good” data.
If this is set to FusedCANcoder or SyncCANcoder when the steer motor is not Pro-licensed, the device will automatically fall back to RemoteCANcoder and report a UsingProFeatureOnUnlicensedDevice status code.
- drive_motor_initial_configs: DriveMotorConfigsT¶
The initial configs used to configure the drive motor of the swerve module. The default value is the factory-default.
Users may change the initial configuration as they need. Any config that’s not referenced in the SwerveModuleConstants class is available to be changed.
The list of configs that will be overwritten is as follows:
MotorOutputConfigs.NeutralMode (Brake mode, overwritten with SwerveDrivetrain.config_neutral_mode)
MotorOutputConfigs.Inverted (SwerveModuleConstants.DriveMotorInverted)
Slot0Configs (SwerveModuleConstants.DriveMotorGains)
CurrentLimitsConfigs.StatorCurrentLimit / TorqueCurrentConfigs.PeakForwardTorqueCurrent / TorqueCurrentConfigs.PeakReverseTorqueCurrent (SwerveModuleConstants.SlipCurrent)
CurrentLimitsConfigs.StatorCurrentLimitEnable (Enabled)
- steer_motor_initial_configs: SteerMotorConfigsT¶
The initial configs used to configure the steer motor of the swerve module. The default value is the factory-default.
Users may change the initial configuration as they need. Any config that’s not referenced in the SwerveModuleConstants class is available to be changed.
The list of configs that will be overwritten is as follows:
MotorOutputConfigs.NeutralMode (Brake mode)
MotorOutputConfigs.Inverted (SwerveModuleConstants.SteerMotorInverted)
Slot0Configs (SwerveModuleConstants.SteerMotorGains)
FeedbackConfigs.FeedbackRemoteSensorID (SwerveModuleConstants.EncoderId)
FeedbackConfigs.FeedbackSensorSource (SwerveModuleConstants.FeedbackSource)
FeedbackConfigs.RotorToSensorRatio (SwerveModuleConstants.SteerMotorGearRatio)
MotionMagicConfigs.MotionMagicExpo_kV / MotionMagicConfigs.MotionMagicExpo_kA (Calculated from gear ratios)
ClosedLoopGeneralConfigs.ContinuousWrap (true)
- encoder_initial_configs: EncoderConfigsT¶
The initial configs used to configure the azimuth encoder of the swerve module. The default value is the factory-default.
Users may change the initial configuration as they need. Any config that’s not referenced in the SwerveModuleConstants class is available to be changed.
For CANcoder, the list of configs that will be overwritten is as follows:
MagnetSensorConfigs.MagnetOffset (SwerveModuleConstants.EncoderOffset)
MagnetSensorConfigs.SensorDirection (SwerveModuleConstants.EncoderInverted)
- steer_inertia: phoenix6.units.kilogram_square_meter = 1e-05¶
Simulated azimuthal inertia.
- drive_inertia: phoenix6.units.kilogram_square_meter = 0.001¶
Simulated drive inertia.
- steer_friction_voltage: phoenix6.units.volt = 0.25¶
Simulated steer voltage required to overcome friction.
- drive_friction_voltage: phoenix6.units.volt = 0.25¶
Simulated drive voltage required to overcome friction.
- with_steer_motor_id(new_steer_motor_id: int) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the steer_motor_id parameter and returns itself.
CAN ID of the steer motor.
- Parameters:
new_steer_motor_id (int) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_drive_motor_id(new_drive_motor_id: int) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the drive_motor_id parameter and returns itself.
CAN ID of the drive motor.
- Parameters:
new_drive_motor_id (int) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_encoder_id(new_encoder_id: int) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the encoder_id parameter and returns itself.
CAN ID of the absolute encoder used for azimuth.
- Parameters:
new_encoder_id (int) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_encoder_offset(new_encoder_offset: phoenix6.units.rotation) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the encoder_offset parameter and returns itself.
Offset of the azimuth encoder.
- Parameters:
new_encoder_offset (rotation) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_location_x(new_location_x: phoenix6.units.meter) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the location_x parameter and returns itself.
The location of this module’s wheels relative to the physical center of the robot in meters along the X axis of the robot.
- Parameters:
new_location_x (meter) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_location_y(new_location_y: phoenix6.units.meter) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the location_y parameter and returns itself.
The location of this module’s wheels relative to the physical center of the robot in meters along the Y axis of the robot.
- Parameters:
new_location_y (meter) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_drive_motor_inverted(new_drive_motor_inverted: bool) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the drive_motor_inverted parameter and returns itself.
True if the drive motor is inverted.
- Parameters:
new_drive_motor_inverted (bool) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_steer_motor_inverted(new_steer_motor_inverted: bool) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the steer_motor_inverted parameter and returns itself.
True if the steer motor is inverted from the azimuth. The azimuth should rotate counter-clockwise (as seen from the top of the robot) for a positive motor output.
- Parameters:
new_steer_motor_inverted (bool) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_encoder_inverted(new_encoder_inverted: bool) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the encoder_inverted parameter and returns itself.
True if the azimuth encoder is inverted from the azimuth. The encoder should report a positive velocity when the azimuth rotates counter-clockwise (as seen from the top of the robot).
- Parameters:
new_encoder_inverted (bool) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_drive_motor_gear_ratio(new_drive_motor_gear_ratio: float) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the drive_motor_gear_ratio parameter and returns itself.
Gear ratio between the drive motor and the wheel.
- Parameters:
new_drive_motor_gear_ratio (float) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_steer_motor_gear_ratio(new_steer_motor_gear_ratio: float) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the steer_motor_gear_ratio parameter and returns itself.
Gear ratio between the steer motor and the azimuth encoder. For example, the SDS Mk4 has a steering ratio of 12.8.
- Parameters:
new_steer_motor_gear_ratio (float) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_coupling_gear_ratio(new_coupling_gear_ratio: float) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the coupling_gear_ratio parameter and returns itself.
Coupled gear ratio between the azimuth encoder and the drive motor.
For a typical swerve module, the azimuth turn motor also drives the wheel a nontrivial amount, which affects the accuracy of odometry and control. This ratio represents the number of rotations of the drive motor caused by a rotation of the azimuth.
- Parameters:
new_coupling_gear_ratio (float) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_wheel_radius(new_wheel_radius: phoenix6.units.meter) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the wheel_radius parameter and returns itself.
Radius of the driving wheel in meters.
- Parameters:
new_wheel_radius (meter) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_steer_motor_gains(new_steer_motor_gains: phoenix6.configs.Slot0Configs) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the steer_motor_gains parameter and returns itself.
The steer motor closed-loop gains.
The steer motor uses the control ouput type specified by SteerMotorClosedLoopOutput and any SwerveModule.SteerRequestType. These gains operate on azimuth rotations (after the gear ratio).
- Parameters:
new_steer_motor_gains (Slot0Configs) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_drive_motor_gains(new_drive_motor_gains: phoenix6.configs.Slot0Configs) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the drive_motor_gains parameter and returns itself.
The drive motor closed-loop gains.
When using closed-loop control, the drive motor uses the control output type specified by DriveMotorClosedLoopOutput and any closed-loop SwerveModule.DriveRequestType. These gains operate on motor rotor rotations (before the gear ratio).
- Parameters:
new_drive_motor_gains (Slot0Configs) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_steer_motor_closed_loop_output(new_steer_motor_closed_loop_output: ClosedLoopOutputType) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the steer_motor_closed_loop_output parameter and returns itself.
The closed-loop output type to use for the steer motors.
- Parameters:
new_steer_motor_closed_loop_output (ClosedLoopOutputType) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_drive_motor_closed_loop_output(new_drive_motor_closed_loop_output: ClosedLoopOutputType) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the drive_motor_closed_loop_output parameter and returns itself.
The closed-loop output type to use for the drive motors.
- Parameters:
new_drive_motor_closed_loop_output (ClosedLoopOutputType) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_slip_current(new_slip_current: phoenix6.units.ampere) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the slip_current parameter and returns itself.
The maximum amount of stator current the drive motors can apply without slippage.
- Parameters:
new_slip_current (ampere) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_speed_at12_volts(new_speed_at12_volts: phoenix6.units.meters_per_second) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the speed_at12_volts parameter and returns itself.
When using open-loop drive control, this specifies the speed at which the robot travels when driven with 12 volts. This is used to approximate the output for a desired velocity. If using closed loop control, this value is ignored.
- Parameters:
new_speed_at12_volts (meters_per_second) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_drive_motor_type(new_drive_motor_type: DriveMotorArrangement) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the drive_motor_type parameter and returns itself.
Choose the motor used for the drive motor.
If using a Talon FX, this should be set to TalonFX_Integrated. If using a Talon FXS, this should be set to the motor attached to the Talon FXS.
- Parameters:
new_drive_motor_type (DriveMotorArrangement) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_steer_motor_type(new_steer_motor_type: SteerMotorArrangement) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the steer_motor_type parameter and returns itself.
Choose the motor used for the steer motor.
If using a Talon FX, this should be set to TalonFX_Integrated. If using a Talon FXS, this should be set to the motor attached to the Talon FXS.
- Parameters:
new_steer_motor_type (SteerMotorArrangement) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_feedback_source(new_feedback_source: SteerFeedbackType) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the feedback_source parameter and returns itself.
Choose how the feedback sensors should be configured.
If the robot does not support Pro, then this should be set to RemoteCANcoder. Otherwise, users have the option to use either FusedCANcoder or SyncCANcoder depending on if there is a risk that the CANcoder can fail in a way to provide “good” data.
If this is set to FusedCANcoder or SyncCANcoder when the steer motor is not Pro-licensed, the device will automatically fall back to RemoteCANcoder and report a UsingProFeatureOnUnlicensedDevice status code.
- Parameters:
new_feedback_source (SteerFeedbackType) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_drive_motor_initial_configs(new_drive_motor_initial_configs: DriveMotorConfigsT) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the drive_motor_initial_configs parameter and returns itself.
The initial configs used to configure the drive motor of the swerve module. The default value is the factory-default.
Users may change the initial configuration as they need. Any config that’s not referenced in the SwerveModuleConstants class is available to be changed.
The list of configs that will be overwritten is as follows:
MotorOutputConfigs.NeutralMode (Brake mode, overwritten with SwerveDrivetrain.config_neutral_mode)
MotorOutputConfigs.Inverted (SwerveModuleConstants.DriveMotorInverted)
Slot0Configs (SwerveModuleConstants.DriveMotorGains)
CurrentLimitsConfigs.StatorCurrentLimit / TorqueCurrentConfigs.PeakForwardTorqueCurrent / TorqueCurrentConfigs.PeakReverseTorqueCurrent (SwerveModuleConstants.SlipCurrent)
CurrentLimitsConfigs.StatorCurrentLimitEnable (Enabled)
- Parameters:
new_drive_motor_initial_configs (DriveMotorConfigsT) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_steer_motor_initial_configs(new_steer_motor_initial_configs: SteerMotorConfigsT) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the steer_motor_initial_configs parameter and returns itself.
The initial configs used to configure the steer motor of the swerve module. The default value is the factory-default.
Users may change the initial configuration as they need. Any config that’s not referenced in the SwerveModuleConstants class is available to be changed.
The list of configs that will be overwritten is as follows:
MotorOutputConfigs.NeutralMode (Brake mode)
MotorOutputConfigs.Inverted (SwerveModuleConstants.SteerMotorInverted)
Slot0Configs (SwerveModuleConstants.SteerMotorGains)
FeedbackConfigs.FeedbackRemoteSensorID (SwerveModuleConstants.EncoderId)
FeedbackConfigs.FeedbackSensorSource (SwerveModuleConstants.FeedbackSource)
FeedbackConfigs.RotorToSensorRatio (SwerveModuleConstants.SteerMotorGearRatio)
MotionMagicConfigs.MotionMagicExpo_kV / MotionMagicConfigs.MotionMagicExpo_kA (Calculated from gear ratios)
ClosedLoopGeneralConfigs.ContinuousWrap (true)
- Parameters:
new_steer_motor_initial_configs (SteerMotorConfigsT) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_encoder_initial_configs(new_encoder_initial_configs: EncoderConfigsT) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the encoder_initial_configs parameter and returns itself.
The initial configs used to configure the azimuth encoder of the swerve module. The default value is the factory-default.
Users may change the initial configuration as they need. Any config that’s not referenced in the SwerveModuleConstants class is available to be changed.
For CANcoder, the list of configs that will be overwritten is as follows:
MagnetSensorConfigs.MagnetOffset (SwerveModuleConstants.EncoderOffset)
MagnetSensorConfigs.SensorDirection (SwerveModuleConstants.EncoderInverted)
- Parameters:
new_encoder_initial_configs (EncoderConfigsT) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_steer_inertia(new_steer_inertia: phoenix6.units.kilogram_square_meter) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the steer_inertia parameter and returns itself.
Simulated azimuthal inertia.
- Parameters:
new_steer_inertia (kilogram_square_meter) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_drive_inertia(new_drive_inertia: phoenix6.units.kilogram_square_meter) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the drive_inertia parameter and returns itself.
Simulated drive inertia.
- Parameters:
new_drive_inertia (kilogram_square_meter) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_steer_friction_voltage(new_steer_friction_voltage: phoenix6.units.volt) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the steer_friction_voltage parameter and returns itself.
Simulated steer voltage required to overcome friction.
- Parameters:
new_steer_friction_voltage (volt) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_drive_friction_voltage(new_drive_friction_voltage: phoenix6.units.volt) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the drive_friction_voltage parameter and returns itself.
Simulated drive voltage required to overcome friction.
- Parameters:
new_drive_friction_voltage (volt) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- class phoenix6.swerve.swerve_module_constants.SwerveModuleConstantsFactory¶
Bases:
Generic
[DriveMotorConfigsT
,SteerMotorConfigsT
,EncoderConfigsT
]Constants that are common across the swerve modules, used for creating instances of module-specific SwerveModuleConstants.
- drive_motor_gear_ratio: float = 0¶
Gear ratio between the drive motor and the wheel.
- steer_motor_gear_ratio: float = 0¶
Gear ratio between the steer motor and the azimuth encoder. For example, the SDS Mk4 has a steering ratio of 12.8.
- coupling_gear_ratio: float = 0¶
Coupled gear ratio between the azimuth encoder and the drive motor.
For a typical swerve module, the azimuth turn motor also drives the wheel a nontrivial amount, which affects the accuracy of odometry and control. This ratio represents the number of rotations of the drive motor caused by a rotation of the azimuth.
- wheel_radius: phoenix6.units.meter = 0¶
Radius of the driving wheel in meters.
- steer_motor_gains: phoenix6.configs.Slot0Configs¶
The steer motor closed-loop gains.
The steer motor uses the control ouput type specified by SteerMotorClosedLoopOutput and any SwerveModule.SteerRequestType. These gains operate on azimuth rotations (after the gear ratio).
- drive_motor_gains: phoenix6.configs.Slot0Configs¶
The drive motor closed-loop gains.
When using closed-loop control, the drive motor uses the control output type specified by DriveMotorClosedLoopOutput and any closed-loop SwerveModule.DriveRequestType. These gains operate on motor rotor rotations (before the gear ratio).
- steer_motor_closed_loop_output: ClosedLoopOutputType¶
The closed-loop output type to use for the steer motors.
- drive_motor_closed_loop_output: ClosedLoopOutputType¶
The closed-loop output type to use for the drive motors.
- slip_current: phoenix6.units.ampere = 120¶
The maximum amount of stator current the drive motors can apply without slippage.
- speed_at12_volts: phoenix6.units.meters_per_second = 0¶
When using open-loop drive control, this specifies the speed at which the robot travels when driven with 12 volts. This is used to approximate the output for a desired velocity. If using closed loop control, this value is ignored.
- drive_motor_type: DriveMotorArrangement¶
Choose the motor used for the drive motor.
If using a Talon FX, this should be set to TalonFX_Integrated. If using a Talon FXS, this should be set to the motor attached to the Talon FXS.
- steer_motor_type: SteerMotorArrangement¶
Choose the motor used for the steer motor.
If using a Talon FX, this should be set to TalonFX_Integrated. If using a Talon FXS, this should be set to the motor attached to the Talon FXS.
- feedback_source: SteerFeedbackType¶
Choose how the feedback sensors should be configured.
If the robot does not support Pro, then this should be set to RemoteCANcoder. Otherwise, users have the option to use either FusedCANcoder or SyncCANcoder depending on if there is a risk that the CANcoder can fail in a way to provide “good” data.
If this is set to FusedCANcoder or SyncCANcoder when the steer motor is not Pro-licensed, the device will automatically fall back to RemoteCANcoder and report a UsingProFeatureOnUnlicensedDevice status code.
- drive_motor_initial_configs: DriveMotorConfigsT¶
The initial configs used to configure the drive motor of the swerve module. The default value is the factory-default.
Users may change the initial configuration as they need. Any config that’s not referenced in the SwerveModuleConstants class is available to be changed.
The list of configs that will be overwritten is as follows:
MotorOutputConfigs.NeutralMode (Brake mode, overwritten with SwerveDrivetrain.config_neutral_mode)
MotorOutputConfigs.Inverted (SwerveModuleConstants.DriveMotorInverted)
Slot0Configs (SwerveModuleConstants.DriveMotorGains)
CurrentLimitsConfigs.StatorCurrentLimit / TorqueCurrentConfigs.PeakForwardTorqueCurrent / TorqueCurrentConfigs.PeakReverseTorqueCurrent (SwerveModuleConstants.SlipCurrent)
CurrentLimitsConfigs.StatorCurrentLimitEnable (Enabled)
- steer_motor_initial_configs: SteerMotorConfigsT¶
The initial configs used to configure the steer motor of the swerve module. The default value is the factory-default.
Users may change the initial configuration as they need. Any config that’s not referenced in the SwerveModuleConstants class is available to be changed.
The list of configs that will be overwritten is as follows:
MotorOutputConfigs.NeutralMode (Brake mode)
MotorOutputConfigs.Inverted (SwerveModuleConstants.SteerMotorInverted)
Slot0Configs (SwerveModuleConstants.SteerMotorGains)
FeedbackConfigs.FeedbackRemoteSensorID (SwerveModuleConstants.EncoderId)
FeedbackConfigs.FeedbackSensorSource (SwerveModuleConstants.FeedbackSource)
FeedbackConfigs.RotorToSensorRatio (SwerveModuleConstants.SteerMotorGearRatio)
MotionMagicConfigs.MotionMagicExpo_kV / MotionMagicConfigs.MotionMagicExpo_kA (Calculated from gear ratios)
ClosedLoopGeneralConfigs.ContinuousWrap (true)
- encoder_initial_configs: EncoderConfigsT¶
The initial configs used to configure the azimuth encoder of the swerve module. The default value is the factory-default.
Users may change the initial configuration as they need. Any config that’s not referenced in the SwerveModuleConstants class is available to be changed.
For CANcoder, the list of configs that will be overwritten is as follows:
MagnetSensorConfigs.MagnetOffset (SwerveModuleConstants.EncoderOffset)
MagnetSensorConfigs.SensorDirection (SwerveModuleConstants.EncoderInverted)
- steer_inertia: phoenix6.units.kilogram_square_meter = 1e-05¶
Simulated azimuthal inertia.
- drive_inertia: phoenix6.units.kilogram_square_meter = 0.001¶
Simulated drive inertia.
- steer_friction_voltage: phoenix6.units.volt = 0.25¶
Simulated steer voltage required to overcome friction.
- drive_friction_voltage: phoenix6.units.volt = 0.25¶
Simulated drive voltage required to overcome friction.
- with_drive_motor_gear_ratio(new_drive_motor_gear_ratio: float) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the drive_motor_gear_ratio parameter and returns itself.
Gear ratio between the drive motor and the wheel.
- Parameters:
new_drive_motor_gear_ratio (float) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_steer_motor_gear_ratio(new_steer_motor_gear_ratio: float) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the steer_motor_gear_ratio parameter and returns itself.
Gear ratio between the steer motor and the azimuth encoder. For example, the SDS Mk4 has a steering ratio of 12.8.
- Parameters:
new_steer_motor_gear_ratio (float) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_coupling_gear_ratio(new_coupling_gear_ratio: float) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the coupling_gear_ratio parameter and returns itself.
Coupled gear ratio between the azimuth encoder and the drive motor.
For a typical swerve module, the azimuth turn motor also drives the wheel a nontrivial amount, which affects the accuracy of odometry and control. This ratio represents the number of rotations of the drive motor caused by a rotation of the azimuth.
- Parameters:
new_coupling_gear_ratio (float) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_wheel_radius(new_wheel_radius: phoenix6.units.meter) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the wheel_radius parameter and returns itself.
Radius of the driving wheel in meters.
- Parameters:
new_wheel_radius (meter) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_steer_motor_gains(new_steer_motor_gains: phoenix6.configs.Slot0Configs) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the steer_motor_gains parameter and returns itself.
The steer motor closed-loop gains.
The steer motor uses the control ouput type specified by SteerMotorClosedLoopOutput and any SwerveModule.SteerRequestType. These gains operate on azimuth rotations (after the gear ratio).
- Parameters:
new_steer_motor_gains (Slot0Configs) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_drive_motor_gains(new_drive_motor_gains: phoenix6.configs.Slot0Configs) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the drive_motor_gains parameter and returns itself.
The drive motor closed-loop gains.
When using closed-loop control, the drive motor uses the control output type specified by DriveMotorClosedLoopOutput and any closed-loop SwerveModule.DriveRequestType. These gains operate on motor rotor rotations (before the gear ratio).
- Parameters:
new_drive_motor_gains (Slot0Configs) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_steer_motor_closed_loop_output(new_steer_motor_closed_loop_output: ClosedLoopOutputType) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the steer_motor_closed_loop_output parameter and returns itself.
The closed-loop output type to use for the steer motors.
- Parameters:
new_steer_motor_closed_loop_output (ClosedLoopOutputType) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_drive_motor_closed_loop_output(new_drive_motor_closed_loop_output: ClosedLoopOutputType) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the drive_motor_closed_loop_output parameter and returns itself.
The closed-loop output type to use for the drive motors.
- Parameters:
new_drive_motor_closed_loop_output (ClosedLoopOutputType) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_slip_current(new_slip_current: phoenix6.units.ampere) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the slip_current parameter and returns itself.
The maximum amount of stator current the drive motors can apply without slippage.
- Parameters:
new_slip_current (ampere) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_speed_at12_volts(new_speed_at12_volts: phoenix6.units.meters_per_second) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the speed_at12_volts parameter and returns itself.
When using open-loop drive control, this specifies the speed at which the robot travels when driven with 12 volts. This is used to approximate the output for a desired velocity. If using closed loop control, this value is ignored.
- Parameters:
new_speed_at12_volts (meters_per_second) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_drive_motor_type(new_drive_motor_type: DriveMotorArrangement) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the drive_motor_type parameter and returns itself.
Choose the motor used for the drive motor.
If using a Talon FX, this should be set to TalonFX_Integrated. If using a Talon FXS, this should be set to the motor attached to the Talon FXS.
- Parameters:
new_drive_motor_type (DriveMotorArrangement) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_steer_motor_type(new_steer_motor_type: SteerMotorArrangement) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the steer_motor_type parameter and returns itself.
Choose the motor used for the steer motor.
If using a Talon FX, this should be set to TalonFX_Integrated. If using a Talon FXS, this should be set to the motor attached to the Talon FXS.
- Parameters:
new_steer_motor_type (SteerMotorArrangement) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_feedback_source(new_feedback_source: SteerFeedbackType) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the feedback_source parameter and returns itself.
Choose how the feedback sensors should be configured.
If the robot does not support Pro, then this should be set to RemoteCANcoder. Otherwise, users have the option to use either FusedCANcoder or SyncCANcoder depending on if there is a risk that the CANcoder can fail in a way to provide “good” data.
If this is set to FusedCANcoder or SyncCANcoder when the steer motor is not Pro-licensed, the device will automatically fall back to RemoteCANcoder and report a UsingProFeatureOnUnlicensedDevice status code.
- Parameters:
new_feedback_source (SteerFeedbackType) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_drive_motor_initial_configs(new_drive_motor_initial_configs: DriveMotorConfigsT) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the drive_motor_initial_configs parameter and returns itself.
The initial configs used to configure the drive motor of the swerve module. The default value is the factory-default.
Users may change the initial configuration as they need. Any config that’s not referenced in the SwerveModuleConstants class is available to be changed.
The list of configs that will be overwritten is as follows:
MotorOutputConfigs.NeutralMode (Brake mode, overwritten with SwerveDrivetrain.config_neutral_mode)
MotorOutputConfigs.Inverted (SwerveModuleConstants.DriveMotorInverted)
Slot0Configs (SwerveModuleConstants.DriveMotorGains)
CurrentLimitsConfigs.StatorCurrentLimit / TorqueCurrentConfigs.PeakForwardTorqueCurrent / TorqueCurrentConfigs.PeakReverseTorqueCurrent (SwerveModuleConstants.SlipCurrent)
CurrentLimitsConfigs.StatorCurrentLimitEnable (Enabled)
- Parameters:
new_drive_motor_initial_configs (DriveMotorConfigsT) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_steer_motor_initial_configs(new_steer_motor_initial_configs: SteerMotorConfigsT) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the steer_motor_initial_configs parameter and returns itself.
The initial configs used to configure the steer motor of the swerve module. The default value is the factory-default.
Users may change the initial configuration as they need. Any config that’s not referenced in the SwerveModuleConstants class is available to be changed.
The list of configs that will be overwritten is as follows:
MotorOutputConfigs.NeutralMode (Brake mode)
MotorOutputConfigs.Inverted (SwerveModuleConstants.SteerMotorInverted)
Slot0Configs (SwerveModuleConstants.SteerMotorGains)
FeedbackConfigs.FeedbackRemoteSensorID (SwerveModuleConstants.EncoderId)
FeedbackConfigs.FeedbackSensorSource (SwerveModuleConstants.FeedbackSource)
FeedbackConfigs.RotorToSensorRatio (SwerveModuleConstants.SteerMotorGearRatio)
MotionMagicConfigs.MotionMagicExpo_kV / MotionMagicConfigs.MotionMagicExpo_kA (Calculated from gear ratios)
ClosedLoopGeneralConfigs.ContinuousWrap (true)
- Parameters:
new_steer_motor_initial_configs (SteerMotorConfigsT) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_encoder_initial_configs(new_encoder_initial_configs: EncoderConfigsT) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the encoder_initial_configs parameter and returns itself.
The initial configs used to configure the azimuth encoder of the swerve module. The default value is the factory-default.
Users may change the initial configuration as they need. Any config that’s not referenced in the SwerveModuleConstants class is available to be changed.
For CANcoder, the list of configs that will be overwritten is as follows:
MagnetSensorConfigs.MagnetOffset (SwerveModuleConstants.EncoderOffset)
MagnetSensorConfigs.SensorDirection (SwerveModuleConstants.EncoderInverted)
- Parameters:
new_encoder_initial_configs (EncoderConfigsT) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_steer_inertia(new_steer_inertia: phoenix6.units.kilogram_square_meter) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the steer_inertia parameter and returns itself.
Simulated azimuthal inertia.
- Parameters:
new_steer_inertia (kilogram_square_meter) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_drive_inertia(new_drive_inertia: phoenix6.units.kilogram_square_meter) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the drive_inertia parameter and returns itself.
Simulated drive inertia.
- Parameters:
new_drive_inertia (kilogram_square_meter) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_steer_friction_voltage(new_steer_friction_voltage: phoenix6.units.volt) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the steer_friction_voltage parameter and returns itself.
Simulated steer voltage required to overcome friction.
- Parameters:
new_steer_friction_voltage (volt) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- with_drive_friction_voltage(new_drive_friction_voltage: phoenix6.units.volt) SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Modifies the drive_friction_voltage parameter and returns itself.
Simulated drive voltage required to overcome friction.
- Parameters:
new_drive_friction_voltage (volt) – Parameter to modify
- Returns:
this object
- Return type:
SwerveModuleConstantsFactory[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]
- create_module_constants(steer_motor_id: int, drive_motor_id: int, encoder_id: int, encoder_offset: phoenix6.units.rotation, location_x: phoenix6.units.meter, location_y: phoenix6.units.meter, drive_motor_inverted: bool, steer_motor_inverted: bool, encoder_inverted: bool) SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT] ¶
Creates the constants for a swerve module with the given properties.
- Parameters:
steer_motor_id (int) – CAN ID of the steer motor.
drive_motor_id (int) – CAN ID of the drive motor.
encoder_id (int) – CAN ID of the absolute encoder used for azimuth.
encoder_offset (rotation) – Offset of the azimuth encoder.
location_x (meter) – The location of this module’s wheels relative to the physical center of the robot in meters along the X axis of the robot.
location_y (meter) – The location of this module’s wheels relative to the physical center of the robot in meters along the Y axis of the robot.
drive_motor_inverted (bool) – True if the drive motor is inverted.
steer_motor_inverted (bool) – True if the steer motor is inverted from the azimuth. The azimuth should rotate counter-clockwise (as seen from the top of the robot) for a positive motor output.
encoder_inverted (bool) – True if the azimuth encoder is inverted from the azimuth. The encoder should report a positive velocity when the azimuth rotates counter-clockwise (as seen from the top of the robot).
- Returns:
Constants for the swerve module
- Return type:
SwerveModuleConstants[DriveMotorConfigsT, SteerMotorConfigsT, EncoderConfigsT]