12#include <units/length.h>
13#include <units/moment_of_inertia.h>
14#include <units/velocity.h>
223 units::moment_of_inertia::kilogram_square_meter_t
SteerInertia = 0.00001_kg_sq_m;
227 units::moment_of_inertia::kilogram_square_meter_t
DriveInertia = 0.001_kg_sq_m;
247 this->SteerMotorId = newSteerMotorId;
261 this->DriveMotorId = newDriveMotorId;
275 this->CANcoderId = newCANcoderId;
289 this->CANcoderOffset = newCANcoderOffset;
304 this->LocationX = newLocationX;
319 this->LocationY = newLocationY;
333 this->DriveMotorInverted = newDriveMotorInverted;
347 this->SteerMotorInverted = newSteerMotorInverted;
361 this->DriveMotorGearRatio = newDriveMotorGearRatio;
376 this->SteerMotorGearRatio = newSteerMotorGearRatio;
395 this->CouplingGearRatio = newCouplingGearRatio;
409 this->WheelRadius = newWheelRadius;
426 this->SteerMotorGains = newSteerMotorGains;
444 this->DriveMotorGains = newDriveMotorGains;
458 this->SteerMotorClosedLoopOutput = newSteerMotorClosedLoopOutput;
472 this->DriveMotorClosedLoopOutput = newDriveMotorClosedLoopOutput;
487 this->SlipCurrent = newSlipCurrent;
504 this->SpeedAt12Volts = newSpeedAt12Volts;
527 this->FeedbackSource = newFeedbackSource;
559 this->DriveMotorInitialConfigs = newDriveMotorInitialConfigs;
593 this->SteerMotorInitialConfigs = newSteerMotorInitialConfigs;
617 this->CANcoderInitialConfigs = newCANcoderInitialConfigs;
631 this->SteerInertia = newSteerInertia;
645 this->DriveInertia = newDriveInertia;
659 this->SteerFrictionVoltage = newSteerFrictionVoltage;
673 this->DriveFrictionVoltage = newDriveFrictionVoltage;
819 units::moment_of_inertia::kilogram_square_meter_t
SteerInertia = 0.00001_kg_sq_m;
823 units::moment_of_inertia::kilogram_square_meter_t
DriveInertia = 0.001_kg_sq_m;
843 this->DriveMotorGearRatio = newDriveMotorGearRatio;
858 this->SteerMotorGearRatio = newSteerMotorGearRatio;
877 this->CouplingGearRatio = newCouplingGearRatio;
891 this->WheelRadius = newWheelRadius;
908 this->SteerMotorGains = newSteerMotorGains;
926 this->DriveMotorGains = newDriveMotorGains;
940 this->SteerMotorClosedLoopOutput = newSteerMotorClosedLoopOutput;
954 this->DriveMotorClosedLoopOutput = newDriveMotorClosedLoopOutput;
969 this->SlipCurrent = newSlipCurrent;
986 this->SpeedAt12Volts = newSpeedAt12Volts;
1009 this->FeedbackSource = newFeedbackSource;
1041 this->DriveMotorInitialConfigs = newDriveMotorInitialConfigs;
1075 this->SteerMotorInitialConfigs = newSteerMotorInitialConfigs;
1099 this->CANcoderInitialConfigs = newCANcoderInitialConfigs;
1113 this->SteerInertia = newSteerInertia;
1127 this->DriveInertia = newDriveInertia;
1141 this->SteerFrictionVoltage = newSteerFrictionVoltage;
1155 this->DriveFrictionVoltage = newDriveFrictionVoltage;
1176 units::angle::turn_t cancoderOffset,
1177 units::length::meter_t locationX,
1178 units::length::meter_t locationY,
1179 bool driveMotorInverted,
1180 bool steerMotorInverted)
const
Class for CANcoder, a CAN based magnetic encoder that provides absolute and relative position along w...
Definition: CoreCANcoder.hpp:38
Gains for the specified slot.
Definition: Configs.hpp:3713
Class description for the Talon FX integrated motor controller.
Definition: CoreTalonFX.hpp:100
ClosedLoopOutputType
Supported closed-loop output types.
Definition: SwerveModuleConstants.hpp:23
@ TorqueCurrentFOC
Requires Pro.
SteerFeedbackType
Supported feedback sensors for the steer motors.
Definition: SwerveModuleConstants.hpp:32
@ FusedCANcoder
Requires Pro; Use signals::FeedbackSensorSourceValue::FusedCANcoder for the steer motor.
@ SyncCANcoder
Requires Pro; Use signals::FeedbackSensorSourceValue::SyncCANcoder for the steer motor.
@ RemoteCANcoder
Use signals::FeedbackSensorSourceValue::RemoteCANcoder for the steer motor.
Represents the state of one swerve module.
Definition: StatusCodes.h:18
Constants that are common across the swerve modules, used for creating instances of module-specific S...
Definition: SwerveModuleConstants.hpp:683
constexpr SwerveModuleConstantsFactory & WithDriveFrictionVoltage(units::voltage::volt_t newDriveFrictionVoltage)
Modifies the DriveFrictionVoltage parameter and returns itself.
Definition: SwerveModuleConstants.hpp:1153
units::length::meter_t WheelRadius
Radius of the driving wheel in meters.
Definition: SwerveModuleConstants.hpp:707
constexpr SwerveModuleConstantsFactory & WithSteerMotorGearRatio(units::dimensionless::scalar_t newSteerMotorGearRatio)
Modifies the SteerMotorGearRatio parameter and returns itself.
Definition: SwerveModuleConstants.hpp:856
SteerFeedbackType FeedbackSource
Choose how the feedback sensors should be configured.
Definition: SwerveModuleConstants.hpp:755
ClosedLoopOutputType SteerMotorClosedLoopOutput
The closed-loop output type to use for the steer motors.
Definition: SwerveModuleConstants.hpp:726
configs::TalonFXConfiguration SteerMotorInitialConfigs
The initial configs used to configure the steer motor of the swerve module.
Definition: SwerveModuleConstants.hpp:801
constexpr SwerveModuleConstantsFactory & WithSteerMotorClosedLoopOutput(ClosedLoopOutputType newSteerMotorClosedLoopOutput)
Modifies the SteerMotorClosedLoopOutput parameter and returns itself.
Definition: SwerveModuleConstants.hpp:938
configs::CANcoderConfiguration CANcoderInitialConfigs
The initial configs used to configure the CANcoder of the swerve module.
Definition: SwerveModuleConstants.hpp:815
constexpr SwerveModuleConstantsFactory & WithFeedbackSource(SteerFeedbackType newFeedbackSource)
Modifies the FeedbackSource parameter and returns itself.
Definition: SwerveModuleConstants.hpp:1007
units::moment_of_inertia::kilogram_square_meter_t DriveInertia
Simulated drive inertia.
Definition: SwerveModuleConstants.hpp:823
units::moment_of_inertia::kilogram_square_meter_t SteerInertia
Simulated azimuthal inertia.
Definition: SwerveModuleConstants.hpp:819
constexpr SwerveModuleConstantsFactory & WithDriveInertia(units::moment_of_inertia::kilogram_square_meter_t newDriveInertia)
Modifies the DriveInertia parameter and returns itself.
Definition: SwerveModuleConstants.hpp:1125
constexpr SwerveModuleConstantsFactory & WithSlipCurrent(units::current::ampere_t newSlipCurrent)
Modifies the SlipCurrent parameter and returns itself.
Definition: SwerveModuleConstants.hpp:967
constexpr SwerveModuleConstantsFactory & WithSteerMotorInitialConfigs(configs::TalonFXConfiguration newSteerMotorInitialConfigs)
Modifies the SteerMotorInitialConfigs parameter and returns itself.
Definition: SwerveModuleConstants.hpp:1073
constexpr SwerveModuleConstantsFactory & WithSteerFrictionVoltage(units::voltage::volt_t newSteerFrictionVoltage)
Modifies the SteerFrictionVoltage parameter and returns itself.
Definition: SwerveModuleConstants.hpp:1139
constexpr SwerveModuleConstantsFactory & WithDriveMotorGearRatio(units::dimensionless::scalar_t newDriveMotorGearRatio)
Modifies the DriveMotorGearRatio parameter and returns itself.
Definition: SwerveModuleConstants.hpp:841
configs::Slot0Configs DriveMotorGains
The drive motor closed-loop gains.
Definition: SwerveModuleConstants.hpp:722
configs::TalonFXConfiguration DriveMotorInitialConfigs
The initial configs used to configure the drive motor of the swerve module.
Definition: SwerveModuleConstants.hpp:777
ClosedLoopOutputType DriveMotorClosedLoopOutput
The closed-loop output type to use for the drive motors.
Definition: SwerveModuleConstants.hpp:730
constexpr SwerveModuleConstantsFactory & WithDriveMotorGains(configs::Slot0Configs newDriveMotorGains)
Modifies the DriveMotorGains parameter and returns itself.
Definition: SwerveModuleConstants.hpp:924
units::dimensionless::scalar_t DriveMotorGearRatio
Gear ratio between the drive motor and the wheel.
Definition: SwerveModuleConstants.hpp:689
constexpr SwerveModuleConstantsFactory & WithCANcoderInitialConfigs(configs::CANcoderConfiguration newCANcoderInitialConfigs)
Modifies the CANcoderInitialConfigs parameter and returns itself.
Definition: SwerveModuleConstants.hpp:1097
constexpr SwerveModuleConstantsFactory & WithDriveMotorClosedLoopOutput(ClosedLoopOutputType newDriveMotorClosedLoopOutput)
Modifies the DriveMotorClosedLoopOutput parameter and returns itself.
Definition: SwerveModuleConstants.hpp:952
units::voltage::volt_t SteerFrictionVoltage
Simulated steer voltage required to overcome friction.
Definition: SwerveModuleConstants.hpp:827
constexpr SwerveModuleConstantsFactory()=default
constexpr SwerveModuleConstantsFactory & WithWheelRadius(units::length::meter_t newWheelRadius)
Modifies the WheelRadius parameter and returns itself.
Definition: SwerveModuleConstants.hpp:889
constexpr SwerveModuleConstantsFactory & WithSteerInertia(units::moment_of_inertia::kilogram_square_meter_t newSteerInertia)
Modifies the SteerInertia parameter and returns itself.
Definition: SwerveModuleConstants.hpp:1111
configs::Slot0Configs SteerMotorGains
The steer motor closed-loop gains.
Definition: SwerveModuleConstants.hpp:714
constexpr SwerveModuleConstantsFactory & WithCouplingGearRatio(units::dimensionless::scalar_t newCouplingGearRatio)
Modifies the CouplingGearRatio parameter and returns itself.
Definition: SwerveModuleConstants.hpp:875
constexpr SwerveModuleConstantsFactory & WithSpeedAt12Volts(units::velocity::meters_per_second_t newSpeedAt12Volts)
Modifies the SpeedAt12Volts parameter and returns itself.
Definition: SwerveModuleConstants.hpp:984
units::voltage::volt_t DriveFrictionVoltage
Simulated drive voltage required to overcome friction.
Definition: SwerveModuleConstants.hpp:831
constexpr SwerveModuleConstants CreateModuleConstants(int steerMotorId, int driveMotorId, int cancoderId, units::angle::turn_t cancoderOffset, units::length::meter_t locationX, units::length::meter_t locationY, bool driveMotorInverted, bool steerMotorInverted) const
Creates the constants for a swerve module with the given properties.
Definition: SwerveModuleConstants.hpp:1172
units::velocity::meters_per_second_t SpeedAt12Volts
When using open-loop drive control, this specifies the speed at which the robot travels when driven w...
Definition: SwerveModuleConstants.hpp:742
units::current::ampere_t SlipCurrent
The maximum amount of stator current the drive motors can apply without slippage.
Definition: SwerveModuleConstants.hpp:735
constexpr SwerveModuleConstantsFactory & WithSteerMotorGains(configs::Slot0Configs newSteerMotorGains)
Modifies the SteerMotorGains parameter and returns itself.
Definition: SwerveModuleConstants.hpp:906
constexpr SwerveModuleConstantsFactory & WithDriveMotorInitialConfigs(configs::TalonFXConfiguration newDriveMotorInitialConfigs)
Modifies the DriveMotorInitialConfigs parameter and returns itself.
Definition: SwerveModuleConstants.hpp:1039
units::dimensionless::scalar_t SteerMotorGearRatio
Gear ratio between the steer motor and the CANcoder.
Definition: SwerveModuleConstants.hpp:694
units::dimensionless::scalar_t CouplingGearRatio
Coupled gear ratio between the CANcoder and the drive motor.
Definition: SwerveModuleConstants.hpp:703
All constants for a swerve module.
Definition: SwerveModuleConstants.hpp:53
int DriveMotorId
CAN ID of the drive motor.
Definition: SwerveModuleConstants.hpp:63
units::velocity::meters_per_second_t SpeedAt12Volts
When using open-loop drive control, this specifies the speed at which the robot travels when driven w...
Definition: SwerveModuleConstants.hpp:146
constexpr SwerveModuleConstants & WithWheelRadius(units::length::meter_t newWheelRadius)
Modifies the WheelRadius parameter and returns itself.
Definition: SwerveModuleConstants.hpp:407
constexpr SwerveModuleConstants & WithSteerInertia(units::moment_of_inertia::kilogram_square_meter_t newSteerInertia)
Modifies the SteerInertia parameter and returns itself.
Definition: SwerveModuleConstants.hpp:629
units::length::meter_t WheelRadius
Radius of the driving wheel in meters.
Definition: SwerveModuleConstants.hpp:111
constexpr SwerveModuleConstants & WithSteerFrictionVoltage(units::voltage::volt_t newSteerFrictionVoltage)
Modifies the SteerFrictionVoltage parameter and returns itself.
Definition: SwerveModuleConstants.hpp:657
constexpr SwerveModuleConstants & WithCouplingGearRatio(units::dimensionless::scalar_t newCouplingGearRatio)
Modifies the CouplingGearRatio parameter and returns itself.
Definition: SwerveModuleConstants.hpp:393
units::moment_of_inertia::kilogram_square_meter_t DriveInertia
Simulated drive inertia.
Definition: SwerveModuleConstants.hpp:227
constexpr SwerveModuleConstants()=default
int CANcoderId
CAN ID of the CANcoder used for azimuth.
Definition: SwerveModuleConstants.hpp:67
constexpr SwerveModuleConstants & WithFeedbackSource(SteerFeedbackType newFeedbackSource)
Modifies the FeedbackSource parameter and returns itself.
Definition: SwerveModuleConstants.hpp:525
units::dimensionless::scalar_t CouplingGearRatio
Coupled gear ratio between the CANcoder and the drive motor.
Definition: SwerveModuleConstants.hpp:107
constexpr SwerveModuleConstants & WithSteerMotorGearRatio(units::dimensionless::scalar_t newSteerMotorGearRatio)
Modifies the SteerMotorGearRatio parameter and returns itself.
Definition: SwerveModuleConstants.hpp:374
configs::Slot0Configs DriveMotorGains
The drive motor closed-loop gains.
Definition: SwerveModuleConstants.hpp:126
constexpr SwerveModuleConstants & WithSteerMotorInitialConfigs(const configs::TalonFXConfiguration &newSteerMotorInitialConfigs)
Modifies the SteerMotorInitialConfigs parameter and returns itself.
Definition: SwerveModuleConstants.hpp:591
constexpr SwerveModuleConstants & WithSteerMotorInverted(bool newSteerMotorInverted)
Modifies the SteerMotorInverted parameter and returns itself.
Definition: SwerveModuleConstants.hpp:345
configs::CANcoderConfiguration CANcoderInitialConfigs
The initial configs used to configure the CANcoder of the swerve module.
Definition: SwerveModuleConstants.hpp:219
constexpr SwerveModuleConstants & WithLocationX(units::length::meter_t newLocationX)
Modifies the LocationX parameter and returns itself.
Definition: SwerveModuleConstants.hpp:302
bool DriveMotorInverted
True if the drive motor is inverted.
Definition: SwerveModuleConstants.hpp:85
constexpr SwerveModuleConstants & WithDriveInertia(units::moment_of_inertia::kilogram_square_meter_t newDriveInertia)
Modifies the DriveInertia parameter and returns itself.
Definition: SwerveModuleConstants.hpp:643
constexpr SwerveModuleConstants & WithDriveMotorId(int newDriveMotorId)
Modifies the DriveMotorId parameter and returns itself.
Definition: SwerveModuleConstants.hpp:259
constexpr SwerveModuleConstants & WithDriveMotorInitialConfigs(const configs::TalonFXConfiguration &newDriveMotorInitialConfigs)
Modifies the DriveMotorInitialConfigs parameter and returns itself.
Definition: SwerveModuleConstants.hpp:557
constexpr SwerveModuleConstants & WithDriveMotorClosedLoopOutput(ClosedLoopOutputType newDriveMotorClosedLoopOutput)
Modifies the DriveMotorClosedLoopOutput parameter and returns itself.
Definition: SwerveModuleConstants.hpp:470
configs::TalonFXConfiguration DriveMotorInitialConfigs
The initial configs used to configure the drive motor of the swerve module.
Definition: SwerveModuleConstants.hpp:181
constexpr SwerveModuleConstants & WithSteerMotorId(int newSteerMotorId)
Modifies the SteerMotorId parameter and returns itself.
Definition: SwerveModuleConstants.hpp:245
constexpr SwerveModuleConstants & WithLocationY(units::length::meter_t newLocationY)
Modifies the LocationY parameter and returns itself.
Definition: SwerveModuleConstants.hpp:317
units::current::ampere_t SlipCurrent
The maximum amount of stator current the drive motors can apply without slippage.
Definition: SwerveModuleConstants.hpp:139
constexpr SwerveModuleConstants & WithSteerMotorGains(const configs::Slot0Configs &newSteerMotorGains)
Modifies the SteerMotorGains parameter and returns itself.
Definition: SwerveModuleConstants.hpp:424
constexpr SwerveModuleConstants & WithCANcoderId(int newCANcoderId)
Modifies the CANcoderId parameter and returns itself.
Definition: SwerveModuleConstants.hpp:273
units::voltage::volt_t DriveFrictionVoltage
Simulated drive voltage required to overcome friction.
Definition: SwerveModuleConstants.hpp:235
units::angle::turn_t CANcoderOffset
Offset of the CANcoder.
Definition: SwerveModuleConstants.hpp:71
units::dimensionless::scalar_t DriveMotorGearRatio
Gear ratio between the drive motor and the wheel.
Definition: SwerveModuleConstants.hpp:93
units::voltage::volt_t SteerFrictionVoltage
Simulated steer voltage required to overcome friction.
Definition: SwerveModuleConstants.hpp:231
bool SteerMotorInverted
True if the steer motor is inverted from the CANcoder.
Definition: SwerveModuleConstants.hpp:89
constexpr SwerveModuleConstants & WithSpeedAt12Volts(units::velocity::meters_per_second_t newSpeedAt12Volts)
Modifies the SpeedAt12Volts parameter and returns itself.
Definition: SwerveModuleConstants.hpp:502
constexpr SwerveModuleConstants & WithDriveMotorGearRatio(units::dimensionless::scalar_t newDriveMotorGearRatio)
Modifies the DriveMotorGearRatio parameter and returns itself.
Definition: SwerveModuleConstants.hpp:359
constexpr SwerveModuleConstants & WithSteerMotorClosedLoopOutput(ClosedLoopOutputType newSteerMotorClosedLoopOutput)
Modifies the SteerMotorClosedLoopOutput parameter and returns itself.
Definition: SwerveModuleConstants.hpp:456
ClosedLoopOutputType SteerMotorClosedLoopOutput
The closed-loop output type to use for the steer motors.
Definition: SwerveModuleConstants.hpp:130
units::moment_of_inertia::kilogram_square_meter_t SteerInertia
Simulated azimuthal inertia.
Definition: SwerveModuleConstants.hpp:223
units::length::meter_t LocationY
The location of this module's wheels relative to the physical center of the robot in meters along the...
Definition: SwerveModuleConstants.hpp:81
constexpr SwerveModuleConstants & WithCANcoderInitialConfigs(const configs::CANcoderConfiguration &newCANcoderInitialConfigs)
Modifies the CANcoderInitialConfigs parameter and returns itself.
Definition: SwerveModuleConstants.hpp:615
ClosedLoopOutputType DriveMotorClosedLoopOutput
The closed-loop output type to use for the drive motors.
Definition: SwerveModuleConstants.hpp:134
units::length::meter_t LocationX
The location of this module's wheels relative to the physical center of the robot in meters along the...
Definition: SwerveModuleConstants.hpp:76
constexpr SwerveModuleConstants & WithSlipCurrent(units::current::ampere_t newSlipCurrent)
Modifies the SlipCurrent parameter and returns itself.
Definition: SwerveModuleConstants.hpp:485
constexpr SwerveModuleConstants & WithDriveMotorInverted(bool newDriveMotorInverted)
Modifies the DriveMotorInverted parameter and returns itself.
Definition: SwerveModuleConstants.hpp:331
SteerFeedbackType FeedbackSource
Choose how the feedback sensors should be configured.
Definition: SwerveModuleConstants.hpp:159
constexpr SwerveModuleConstants & WithDriveFrictionVoltage(units::voltage::volt_t newDriveFrictionVoltage)
Modifies the DriveFrictionVoltage parameter and returns itself.
Definition: SwerveModuleConstants.hpp:671
constexpr SwerveModuleConstants & WithDriveMotorGains(const configs::Slot0Configs &newDriveMotorGains)
Modifies the DriveMotorGains parameter and returns itself.
Definition: SwerveModuleConstants.hpp:442
configs::Slot0Configs SteerMotorGains
The steer motor closed-loop gains.
Definition: SwerveModuleConstants.hpp:118
constexpr SwerveModuleConstants & WithCANcoderOffset(units::angle::turn_t newCANcoderOffset)
Modifies the CANcoderOffset parameter and returns itself.
Definition: SwerveModuleConstants.hpp:287
configs::TalonFXConfiguration SteerMotorInitialConfigs
The initial configs used to configure the steer motor of the swerve module.
Definition: SwerveModuleConstants.hpp:205
int SteerMotorId
CAN ID of the steer motor.
Definition: SwerveModuleConstants.hpp:59
units::dimensionless::scalar_t SteerMotorGearRatio
Gear ratio between the steer motor and the CANcoder.
Definition: SwerveModuleConstants.hpp:98