Class SwerveDrive.SwerveModuleConfig<DriveMotorType extends edu.wpi.first.wpilibj.motorcontrol.MotorController,SteeringMotorType extends edu.wpi.first.wpilibj.motorcontrol.MotorController,AbsoluteEncoder extends com.ctre.phoenix.sensors.CANCoder>
- java.lang.Object
-
- frc.robot.subsystems.swervedrive.swerve.SwerveDrive.SwerveModuleConfig<DriveMotorType,SteeringMotorType,AbsoluteEncoder>
-
- Type Parameters:
DriveMotorType- The motor type for the drive motor on the swerve moduule.SteeringMotorType- The motor type for the steering motor on the module.AbsoluteEncoder- The absolute encoder type.
- Enclosing class:
- SwerveDrive
public static class SwerveDrive.SwerveModuleConfig<DriveMotorType extends edu.wpi.first.wpilibj.motorcontrol.MotorController,SteeringMotorType extends edu.wpi.first.wpilibj.motorcontrol.MotorController,AbsoluteEncoder extends com.ctre.phoenix.sensors.CANCoder> extends java.lang.ObjectHelper class for easier swerve module creation
-
-
Field Summary
Fields Modifier and Type Field Description doubleangleOffsetDriveMotorTypedriveAbsoluteEncoderencoderSwerveModule.SwerveModuleLocationlocSteeringMotorTypesteering
-
Constructor Summary
Constructors Constructor Description SwerveModuleConfig(DriveMotorType driveMotor, SteeringMotorType steerMotor, AbsoluteEncoder encoderSteering, double offset, SwerveModule.SwerveModuleLocation location)Swerve Module configuration class to define the motor CAN IDs and absolute encoder offset of a swerve module.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SwerveModule<DriveMotorType,SteeringMotorType,AbsoluteEncoder>createModule(double driveGearRatio, double steerGearRatio, double wheelDiameterMeters, double wheelBaseMeters, double driveTrainWidthMeters, double steeringMotorFreeSpeedRPM, double maxSpeedMPS, double maxDriveAcceleration, boolean steeringInverted, boolean drivingInverted)Create the swerve module from the configuration.
-
-
-
Field Detail
-
drive
public DriveMotorType extends edu.wpi.first.wpilibj.motorcontrol.MotorController drive
-
steering
public SteeringMotorType extends edu.wpi.first.wpilibj.motorcontrol.MotorController steering
-
encoder
public AbsoluteEncoder extends com.ctre.phoenix.sensors.CANCoder encoder
-
angleOffset
public double angleOffset
-
loc
public SwerveModule.SwerveModuleLocation loc
-
-
Constructor Detail
-
SwerveModuleConfig
public SwerveModuleConfig(DriveMotorType driveMotor, SteeringMotorType steerMotor, AbsoluteEncoder encoderSteering, double offset, SwerveModule.SwerveModuleLocation location)
Swerve Module configuration class to define the motor CAN IDs and absolute encoder offset of a swerve module.- Parameters:
driveMotor- Drive motor for the swerve module.steerMotor- Steer motor for the swerve module.encoderSteering- CANCoder for the steering motor on the swerve module.offset- Absolute encoder offset.location- Swerve Moduule location on the chassis.
-
-
Method Detail
-
createModule
public SwerveModule<DriveMotorType,SteeringMotorType,AbsoluteEncoder> createModule(double driveGearRatio, double steerGearRatio, double wheelDiameterMeters, double wheelBaseMeters, double driveTrainWidthMeters, double steeringMotorFreeSpeedRPM, double maxSpeedMPS, double maxDriveAcceleration, boolean steeringInverted, boolean drivingInverted)
Create the swerve module from the configuration.- Parameters:
driveGearRatio- Drive gear ratio in form of (rotation:1 AKA rotations/1) to get the encoder ticks per rotation.steerGearRatio- Steering motor gear ratio (usually 12.8:1 for MK4 in form of rotations:1 or rotations/1), only applied if using Neo's.wheelDiameterMeters- The wheel diameter of the swerve drive module in meters.wheelBaseMeters- The Distance between front and back wheels of the robot in meters.driveTrainWidthMeters- The Distance between centers of right and left wheels in meters.steeringMotorFreeSpeedRPM- The RPM free speed of the steering motor.maxSpeedMPS- The maximum drive speed in meters per second.maxDriveAcceleration- The maximum drive acceleration in meters^2 per second.steeringInverted- The steering motor is inverted.drivingInverted- The driving motor is inverted.- Returns:
- The Swerve Module.
-
-