12#include <units/length.h>
13#include <units/moment_of_inertia.h>
14#include <units/velocity.h>
235 units::moment_of_inertia::kilogram_square_meter_t
SteerInertia = 0.00001_kg_sq_m;
239 units::moment_of_inertia::kilogram_square_meter_t
DriveInertia = 0.001_kg_sq_m;
259 this->SteerMotorId = newSteerMotorId;
273 this->DriveMotorId = newDriveMotorId;
287 this->CANcoderId = newCANcoderId;
301 this->CANcoderOffset = newCANcoderOffset;
316 this->LocationX = newLocationX;
331 this->LocationY = newLocationY;
345 this->DriveMotorInverted = newDriveMotorInverted;
361 this->SteerMotorInverted = newSteerMotorInverted;
377 this->CANcoderInverted = newCANcoderInverted;
391 this->DriveMotorGearRatio = newDriveMotorGearRatio;
406 this->SteerMotorGearRatio = newSteerMotorGearRatio;
425 this->CouplingGearRatio = newCouplingGearRatio;
439 this->WheelRadius = newWheelRadius;
457 this->SteerMotorGains = newSteerMotorGains;
476 this->DriveMotorGains = newDriveMotorGains;
490 this->SteerMotorClosedLoopOutput = newSteerMotorClosedLoopOutput;
504 this->DriveMotorClosedLoopOutput = newDriveMotorClosedLoopOutput;
519 this->SlipCurrent = newSlipCurrent;
536 this->SpeedAt12Volts = newSpeedAt12Volts;
559 this->FeedbackSource = newFeedbackSource;
591 this->DriveMotorInitialConfigs = newDriveMotorInitialConfigs;
625 this->SteerMotorInitialConfigs = newSteerMotorInitialConfigs;
651 this->CANcoderInitialConfigs = newCANcoderInitialConfigs;
665 this->SteerInertia = newSteerInertia;
679 this->DriveInertia = newDriveInertia;
693 this->SteerFrictionVoltage = newSteerFrictionVoltage;
707 this->DriveFrictionVoltage = newDriveFrictionVoltage;
857 units::moment_of_inertia::kilogram_square_meter_t
SteerInertia = 0.00001_kg_sq_m;
861 units::moment_of_inertia::kilogram_square_meter_t
DriveInertia = 0.001_kg_sq_m;
881 this->DriveMotorGearRatio = newDriveMotorGearRatio;
896 this->SteerMotorGearRatio = newSteerMotorGearRatio;
915 this->CouplingGearRatio = newCouplingGearRatio;
929 this->WheelRadius = newWheelRadius;
947 this->SteerMotorGains = newSteerMotorGains;
966 this->DriveMotorGains = newDriveMotorGains;
980 this->SteerMotorClosedLoopOutput = newSteerMotorClosedLoopOutput;
994 this->DriveMotorClosedLoopOutput = newDriveMotorClosedLoopOutput;
1009 this->SlipCurrent = newSlipCurrent;
1026 this->SpeedAt12Volts = newSpeedAt12Volts;
1049 this->FeedbackSource = newFeedbackSource;
1081 this->DriveMotorInitialConfigs = newDriveMotorInitialConfigs;
1115 this->SteerMotorInitialConfigs = newSteerMotorInitialConfigs;
1141 this->CANcoderInitialConfigs = newCANcoderInitialConfigs;
1155 this->SteerInertia = newSteerInertia;
1169 this->DriveInertia = newDriveInertia;
1183 this->SteerFrictionVoltage = newSteerFrictionVoltage;
1197 this->DriveFrictionVoltage = newDriveFrictionVoltage;
1219 units::angle::turn_t cancoderOffset,
1220 units::length::meter_t locationX,
1221 units::length::meter_t locationY,
1222 bool driveMotorInverted,
1223 bool steerMotorInverted,
1224 bool cancoderInverted)
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:4279
Class description for the Talon FX integrated motor controller.
Definition CoreTalonFX.hpp:102
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.
Definition StatusCodes.h:18
Constants that are common across the swerve modules, used for creating instances of module-specific S...
Definition SwerveModuleConstants.hpp:717
constexpr SwerveModuleConstantsFactory & WithDriveFrictionVoltage(units::voltage::volt_t newDriveFrictionVoltage)
Modifies the DriveFrictionVoltage parameter and returns itself.
Definition SwerveModuleConstants.hpp:1195
units::length::meter_t WheelRadius
Radius of the driving wheel in meters.
Definition SwerveModuleConstants.hpp:741
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, bool cancoderInverted) const
Creates the constants for a swerve module with the given properties.
Definition SwerveModuleConstants.hpp:1215
constexpr SwerveModuleConstantsFactory & WithSteerMotorGearRatio(units::dimensionless::scalar_t newSteerMotorGearRatio)
Modifies the SteerMotorGearRatio parameter and returns itself.
Definition SwerveModuleConstants.hpp:894
SteerFeedbackType FeedbackSource
Choose how the feedback sensors should be configured.
Definition SwerveModuleConstants.hpp:791
ClosedLoopOutputType SteerMotorClosedLoopOutput
The closed-loop output type to use for the steer motors.
Definition SwerveModuleConstants.hpp:762
configs::TalonFXConfiguration SteerMotorInitialConfigs
The initial configs used to configure the steer motor of the swerve module.
Definition SwerveModuleConstants.hpp:837
constexpr SwerveModuleConstantsFactory & WithSteerMotorClosedLoopOutput(ClosedLoopOutputType newSteerMotorClosedLoopOutput)
Modifies the SteerMotorClosedLoopOutput parameter and returns itself.
Definition SwerveModuleConstants.hpp:978
configs::CANcoderConfiguration CANcoderInitialConfigs
The initial configs used to configure the CANcoder of the swerve module.
Definition SwerveModuleConstants.hpp:853
constexpr SwerveModuleConstantsFactory & WithFeedbackSource(SteerFeedbackType newFeedbackSource)
Modifies the FeedbackSource parameter and returns itself.
Definition SwerveModuleConstants.hpp:1047
units::moment_of_inertia::kilogram_square_meter_t DriveInertia
Simulated drive inertia.
Definition SwerveModuleConstants.hpp:861
units::moment_of_inertia::kilogram_square_meter_t SteerInertia
Simulated azimuthal inertia.
Definition SwerveModuleConstants.hpp:857
constexpr SwerveModuleConstantsFactory & WithDriveInertia(units::moment_of_inertia::kilogram_square_meter_t newDriveInertia)
Modifies the DriveInertia parameter and returns itself.
Definition SwerveModuleConstants.hpp:1167
constexpr SwerveModuleConstantsFactory & WithSlipCurrent(units::current::ampere_t newSlipCurrent)
Modifies the SlipCurrent parameter and returns itself.
Definition SwerveModuleConstants.hpp:1007
constexpr SwerveModuleConstantsFactory & WithSteerMotorInitialConfigs(configs::TalonFXConfiguration newSteerMotorInitialConfigs)
Modifies the SteerMotorInitialConfigs parameter and returns itself.
Definition SwerveModuleConstants.hpp:1113
constexpr SwerveModuleConstantsFactory & WithSteerFrictionVoltage(units::voltage::volt_t newSteerFrictionVoltage)
Modifies the SteerFrictionVoltage parameter and returns itself.
Definition SwerveModuleConstants.hpp:1181
constexpr SwerveModuleConstantsFactory & WithDriveMotorGearRatio(units::dimensionless::scalar_t newDriveMotorGearRatio)
Modifies the DriveMotorGearRatio parameter and returns itself.
Definition SwerveModuleConstants.hpp:879
configs::Slot0Configs DriveMotorGains
The drive motor closed-loop gains.
Definition SwerveModuleConstants.hpp:758
configs::TalonFXConfiguration DriveMotorInitialConfigs
The initial configs used to configure the drive motor of the swerve module.
Definition SwerveModuleConstants.hpp:813
ClosedLoopOutputType DriveMotorClosedLoopOutput
The closed-loop output type to use for the drive motors.
Definition SwerveModuleConstants.hpp:766
constexpr SwerveModuleConstantsFactory & WithDriveMotorGains(configs::Slot0Configs newDriveMotorGains)
Modifies the DriveMotorGains parameter and returns itself.
Definition SwerveModuleConstants.hpp:964
units::dimensionless::scalar_t DriveMotorGearRatio
Gear ratio between the drive motor and the wheel.
Definition SwerveModuleConstants.hpp:723
constexpr SwerveModuleConstantsFactory & WithCANcoderInitialConfigs(configs::CANcoderConfiguration newCANcoderInitialConfigs)
Modifies the CANcoderInitialConfigs parameter and returns itself.
Definition SwerveModuleConstants.hpp:1139
constexpr SwerveModuleConstantsFactory & WithDriveMotorClosedLoopOutput(ClosedLoopOutputType newDriveMotorClosedLoopOutput)
Modifies the DriveMotorClosedLoopOutput parameter and returns itself.
Definition SwerveModuleConstants.hpp:992
units::voltage::volt_t SteerFrictionVoltage
Simulated steer voltage required to overcome friction.
Definition SwerveModuleConstants.hpp:865
constexpr SwerveModuleConstantsFactory()=default
constexpr SwerveModuleConstantsFactory & WithWheelRadius(units::length::meter_t newWheelRadius)
Modifies the WheelRadius parameter and returns itself.
Definition SwerveModuleConstants.hpp:927
constexpr SwerveModuleConstantsFactory & WithSteerInertia(units::moment_of_inertia::kilogram_square_meter_t newSteerInertia)
Modifies the SteerInertia parameter and returns itself.
Definition SwerveModuleConstants.hpp:1153
configs::Slot0Configs SteerMotorGains
The steer motor closed-loop gains.
Definition SwerveModuleConstants.hpp:749
constexpr SwerveModuleConstantsFactory & WithCouplingGearRatio(units::dimensionless::scalar_t newCouplingGearRatio)
Modifies the CouplingGearRatio parameter and returns itself.
Definition SwerveModuleConstants.hpp:913
constexpr SwerveModuleConstantsFactory & WithSpeedAt12Volts(units::velocity::meters_per_second_t newSpeedAt12Volts)
Modifies the SpeedAt12Volts parameter and returns itself.
Definition SwerveModuleConstants.hpp:1024
units::voltage::volt_t DriveFrictionVoltage
Simulated drive voltage required to overcome friction.
Definition SwerveModuleConstants.hpp:869
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:778
units::current::ampere_t SlipCurrent
The maximum amount of stator current the drive motors can apply without slippage.
Definition SwerveModuleConstants.hpp:771
constexpr SwerveModuleConstantsFactory & WithSteerMotorGains(configs::Slot0Configs newSteerMotorGains)
Modifies the SteerMotorGains parameter and returns itself.
Definition SwerveModuleConstants.hpp:945
constexpr SwerveModuleConstantsFactory & WithDriveMotorInitialConfigs(configs::TalonFXConfiguration newDriveMotorInitialConfigs)
Modifies the DriveMotorInitialConfigs parameter and returns itself.
Definition SwerveModuleConstants.hpp:1079
units::dimensionless::scalar_t SteerMotorGearRatio
Gear ratio between the steer motor and the CANcoder.
Definition SwerveModuleConstants.hpp:728
units::dimensionless::scalar_t CouplingGearRatio
Coupled gear ratio between the CANcoder and the drive motor.
Definition SwerveModuleConstants.hpp:737
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:156
constexpr SwerveModuleConstants & WithWheelRadius(units::length::meter_t newWheelRadius)
Modifies the WheelRadius parameter and returns itself.
Definition SwerveModuleConstants.hpp:437
constexpr SwerveModuleConstants & WithSteerInertia(units::moment_of_inertia::kilogram_square_meter_t newSteerInertia)
Modifies the SteerInertia parameter and returns itself.
Definition SwerveModuleConstants.hpp:663
units::length::meter_t WheelRadius
Radius of the driving wheel in meters.
Definition SwerveModuleConstants.hpp:119
constexpr SwerveModuleConstants & WithSteerFrictionVoltage(units::voltage::volt_t newSteerFrictionVoltage)
Modifies the SteerFrictionVoltage parameter and returns itself.
Definition SwerveModuleConstants.hpp:691
constexpr SwerveModuleConstants & WithCouplingGearRatio(units::dimensionless::scalar_t newCouplingGearRatio)
Modifies the CouplingGearRatio parameter and returns itself.
Definition SwerveModuleConstants.hpp:423
units::moment_of_inertia::kilogram_square_meter_t DriveInertia
Simulated drive inertia.
Definition SwerveModuleConstants.hpp:239
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:557
units::dimensionless::scalar_t CouplingGearRatio
Coupled gear ratio between the CANcoder and the drive motor.
Definition SwerveModuleConstants.hpp:115
constexpr SwerveModuleConstants & WithSteerMotorGearRatio(units::dimensionless::scalar_t newSteerMotorGearRatio)
Modifies the SteerMotorGearRatio parameter and returns itself.
Definition SwerveModuleConstants.hpp:404
configs::Slot0Configs DriveMotorGains
The drive motor closed-loop gains.
Definition SwerveModuleConstants.hpp:136
constexpr SwerveModuleConstants & WithSteerMotorInitialConfigs(const configs::TalonFXConfiguration &newSteerMotorInitialConfigs)
Modifies the SteerMotorInitialConfigs parameter and returns itself.
Definition SwerveModuleConstants.hpp:623
constexpr SwerveModuleConstants & WithSteerMotorInverted(bool newSteerMotorInverted)
Modifies the SteerMotorInverted parameter and returns itself.
Definition SwerveModuleConstants.hpp:359
configs::CANcoderConfiguration CANcoderInitialConfigs
The initial configs used to configure the CANcoder of the swerve module.
Definition SwerveModuleConstants.hpp:231
constexpr SwerveModuleConstants & WithLocationX(units::length::meter_t newLocationX)
Modifies the LocationX parameter and returns itself.
Definition SwerveModuleConstants.hpp:314
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:677
constexpr SwerveModuleConstants & WithDriveMotorId(int newDriveMotorId)
Modifies the DriveMotorId parameter and returns itself.
Definition SwerveModuleConstants.hpp:271
constexpr SwerveModuleConstants & WithDriveMotorInitialConfigs(const configs::TalonFXConfiguration &newDriveMotorInitialConfigs)
Modifies the DriveMotorInitialConfigs parameter and returns itself.
Definition SwerveModuleConstants.hpp:589
constexpr SwerveModuleConstants & WithDriveMotorClosedLoopOutput(ClosedLoopOutputType newDriveMotorClosedLoopOutput)
Modifies the DriveMotorClosedLoopOutput parameter and returns itself.
Definition SwerveModuleConstants.hpp:502
configs::TalonFXConfiguration DriveMotorInitialConfigs
The initial configs used to configure the drive motor of the swerve module.
Definition SwerveModuleConstants.hpp:191
bool CANcoderInverted
True if the CANcoder is inverted from the azimuth.
Definition SwerveModuleConstants.hpp:97
constexpr SwerveModuleConstants & WithSteerMotorId(int newSteerMotorId)
Modifies the SteerMotorId parameter and returns itself.
Definition SwerveModuleConstants.hpp:257
constexpr SwerveModuleConstants & WithLocationY(units::length::meter_t newLocationY)
Modifies the LocationY parameter and returns itself.
Definition SwerveModuleConstants.hpp:329
units::current::ampere_t SlipCurrent
The maximum amount of stator current the drive motors can apply without slippage.
Definition SwerveModuleConstants.hpp:149
constexpr SwerveModuleConstants & WithSteerMotorGains(const configs::Slot0Configs &newSteerMotorGains)
Modifies the SteerMotorGains parameter and returns itself.
Definition SwerveModuleConstants.hpp:455
constexpr SwerveModuleConstants & WithCANcoderId(int newCANcoderId)
Modifies the CANcoderId parameter and returns itself.
Definition SwerveModuleConstants.hpp:285
units::voltage::volt_t DriveFrictionVoltage
Simulated drive voltage required to overcome friction.
Definition SwerveModuleConstants.hpp:247
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:101
units::voltage::volt_t SteerFrictionVoltage
Simulated steer voltage required to overcome friction.
Definition SwerveModuleConstants.hpp:243
bool SteerMotorInverted
True if the steer motor is inverted from the azimuth.
Definition SwerveModuleConstants.hpp:91
constexpr SwerveModuleConstants & WithSpeedAt12Volts(units::velocity::meters_per_second_t newSpeedAt12Volts)
Modifies the SpeedAt12Volts parameter and returns itself.
Definition SwerveModuleConstants.hpp:534
constexpr SwerveModuleConstants & WithDriveMotorGearRatio(units::dimensionless::scalar_t newDriveMotorGearRatio)
Modifies the DriveMotorGearRatio parameter and returns itself.
Definition SwerveModuleConstants.hpp:389
constexpr SwerveModuleConstants & WithSteerMotorClosedLoopOutput(ClosedLoopOutputType newSteerMotorClosedLoopOutput)
Modifies the SteerMotorClosedLoopOutput parameter and returns itself.
Definition SwerveModuleConstants.hpp:488
ClosedLoopOutputType SteerMotorClosedLoopOutput
The closed-loop output type to use for the steer motors.
Definition SwerveModuleConstants.hpp:140
units::moment_of_inertia::kilogram_square_meter_t SteerInertia
Simulated azimuthal inertia.
Definition SwerveModuleConstants.hpp:235
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:649
ClosedLoopOutputType DriveMotorClosedLoopOutput
The closed-loop output type to use for the drive motors.
Definition SwerveModuleConstants.hpp:144
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:517
constexpr SwerveModuleConstants & WithDriveMotorInverted(bool newDriveMotorInverted)
Modifies the DriveMotorInverted parameter and returns itself.
Definition SwerveModuleConstants.hpp:343
SteerFeedbackType FeedbackSource
Choose how the feedback sensors should be configured.
Definition SwerveModuleConstants.hpp:169
constexpr SwerveModuleConstants & WithDriveFrictionVoltage(units::voltage::volt_t newDriveFrictionVoltage)
Modifies the DriveFrictionVoltage parameter and returns itself.
Definition SwerveModuleConstants.hpp:705
constexpr SwerveModuleConstants & WithDriveMotorGains(const configs::Slot0Configs &newDriveMotorGains)
Modifies the DriveMotorGains parameter and returns itself.
Definition SwerveModuleConstants.hpp:474
configs::Slot0Configs SteerMotorGains
The steer motor closed-loop gains.
Definition SwerveModuleConstants.hpp:127
constexpr SwerveModuleConstants & WithCANcoderOffset(units::angle::turn_t newCANcoderOffset)
Modifies the CANcoderOffset parameter and returns itself.
Definition SwerveModuleConstants.hpp:299
configs::TalonFXConfiguration SteerMotorInitialConfigs
The initial configs used to configure the steer motor of the swerve module.
Definition SwerveModuleConstants.hpp:215
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:106
constexpr SwerveModuleConstants & WithCANcoderInverted(bool newCANcoderInverted)
Modifies the CANcoderInverted parameter and returns itself.
Definition SwerveModuleConstants.hpp:375