Package frc.robot.subsystems.drive
Class DriveConstants
java.lang.Object
frc.robot.subsystems.drive.DriveConstants
Hardware and tuning constants for the drive subsystem.
Contains physical dimensions, CAN IDs, gear ratios, motor current limits, and PID tuning values for both real and simulated hardware.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresents the hardware configuration for a single swerve module. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleDerivative gain for rotational PID control.static final doubleProportional gain for rotational PID control.static final TimeLatency compensation for Canandgyro over CAN (seconds).static final doubleThe gain for correcting drift based on the secondary gyro.static final DistanceThe radius of the circle defined by the module locations.static final doubleConversion factor for drive position from motor rotations to meters.static final doubleConversion factor for drive velocity from motor RPM to meters per second.static final DCMotorThe gearbox model for the drive motor.static final booleanWhether the drive motor is inverted.static final doubleAcceleration feedforward gain for the drive motor.static final doubleDerivative gain for the drive motor PID controller.static final doubleProportional gain for the drive motor PID controller.static final doubleStatic friction feedforward gain for the drive motor.static final doubleVelocity feedforward gain for the drive motor.static final CurrentMaximum current limit for the drive motors.static final doubleThe gear reduction between the drive motor and the wheel.static final CurrentSecondary current limit for the drive motors.static final AngleThe threshold for angular error before correction is applied.static final doubleVoltage ramp rate in volts per second for feedforward characterization.static final TimeDelay in seconds before feedforward characterization starts ramping voltage.static final AngleMaximum heading error allowed when determining if the robot is aligned to shoot.static final intCAN ID for the IMU (gyroscope).static final doubleJoystick deadband for linear and rotational inputs.static final AngularAccelerationMaximum angular acceleration for the rotation motion profile in radians per second squared.static final AngularVelocityMaximum angular velocity for the rotation motion profile in radians per second.static final AngleThe maximum angular correction allowed per control frame.static final LinearAccelerationThe maximum achievable linear acceleration of the robot in meters per second squared.static final LinearVelocityThe maximum achievable linear velocity of the robot in meters per second.static final DriveConstants.SwerveModuleConfig[]Hardware configurations for all four swerve modules.static final Translation2d[]The locations of the modules relative to the center of the robot.static final TimeLatency compensation for NavX over USB (seconds).static final FrequencyThe frequency at which odometry calculations are updated.static final RobotConfigPathPlanner configuration object.static final MassTotal mass of the robot.static final MomentOfInertiaMoment of inertia of the robot in kilogram-square meters.static final DistanceThe distance between the left and right wheels.static final booleanWhether the turn encoder is inverted.static final doubleConversion factor for turn position from encoder rotations to radians.static final doubleConversion factor for turn velocity from encoder RPM to radians per second.static final DCMotorThe gearbox model for the turn motor.static final booleanWhether the turn motor is inverted.static final doubleDerivative gain for the turn motor PID controller.static final doubleProportional gain for the turn motor PID controller.static final CurrentMaximum current limit for the turn motors.static final doubleThe gear reduction between the turn motor and the module.static final CurrentSecondary current limit for the turn motors.static final doubleMaximum input range for turn PID (in radians).static final doubleMinimum input range for turn PID (in radians).static final AngularVelocityThe velocity threshold below which the robot is considered stationary.static final DistanceThe distance between the front and back wheels.static final doubleCoefficient of friction for the wheels.static final DistanceThe radius of the drive wheels.static final AngularVelocityMaximum angular velocity in radians per second for wheel radius characterization.static final AngularAccelerationAngular velocity ramp rate in radians per second squared for wheel radius characterization. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
MAX_LINEAR_VELOCITY
The maximum achievable linear velocity of the robot in meters per second. -
MAX_LINEAR_ACCELERATION
The maximum achievable linear acceleration of the robot in meters per second squared. -
ODOMETRY_FREQUENCY
The frequency at which odometry calculations are updated. -
TRACK_WIDTH
The distance between the left and right wheels. -
WHEEL_BASE
The distance between the front and back wheels. -
DRIVE_BASE_RADIUS
The radius of the circle defined by the module locations. -
HEADING_ALIGNMENT_TOLERANCE
Maximum heading error allowed when determining if the robot is aligned to shoot. -
MODULE_CONFIGS
Hardware configurations for all four swerve modules.Index Order: Front Left (0), Front Right (1), Back Left (2), Back Right (3)
-
MODULE_TRANSLATIONS
The locations of the modules relative to the center of the robot.Order: Front Left, Front Right, Back Left, Back Right
-
IMU_CAN_ID
public static final int IMU_CAN_IDCAN ID for the IMU (gyroscope).- See Also:
-
DRIFT_GAIN
public static final double DRIFT_GAINThe gain for correcting drift based on the secondary gyro.- See Also:
-
ERROR_THRESHOLD
The threshold for angular error before correction is applied. -
MAX_CORRECTION_PER_FRAME
The maximum angular correction allowed per control frame. -
VELOCITY_GATE
The velocity threshold below which the robot is considered stationary. -
NAVX_LATENCY_SEC
Latency compensation for NavX over USB (seconds). -
CANANDGYRO_LATENCY_SEC
Latency compensation for Canandgyro over CAN (seconds). -
DRIVE_INVERTED
public static final boolean DRIVE_INVERTEDWhether the drive motor is inverted.- See Also:
-
DRIVE_MOTOR_CURRENT_LIMIT
Maximum current limit for the drive motors. -
DRIVE_MOTOR_SECONDARY_CURRENT_LIMIT
Secondary current limit for the drive motors. -
WHEEL_RADIUS
The radius of the drive wheels. -
DRIVE_MOTOR_REDUCTION
public static final double DRIVE_MOTOR_REDUCTIONThe gear reduction between the drive motor and the wheel.- See Also:
-
DRIVE_GEARBOX
The gearbox model for the drive motor. -
DRIVE_ENCODER_POSITION_FACTOR
public static final double DRIVE_ENCODER_POSITION_FACTORConversion factor for drive position from motor rotations to meters.- See Also:
-
DRIVE_ENCODER_VELOCITY_FACTOR
public static final double DRIVE_ENCODER_VELOCITY_FACTORConversion factor for drive velocity from motor RPM to meters per second.- See Also:
-
DRIVE_KP
public static final double DRIVE_KPProportional gain for the drive motor PID controller.- See Also:
-
DRIVE_KD
public static final double DRIVE_KDDerivative gain for the drive motor PID controller.- See Also:
-
DRIVE_KS
public static final double DRIVE_KSStatic friction feedforward gain for the drive motor.- See Also:
-
DRIVE_KV
public static final double DRIVE_KVVelocity feedforward gain for the drive motor.- See Also:
-
DRIVE_KA
public static final double DRIVE_KAAcceleration feedforward gain for the drive motor.- See Also:
-
TURN_INVERTED
public static final boolean TURN_INVERTEDWhether the turn motor is inverted.- See Also:
-
TURN_MOTOR_CURRENT_LIMIT
Maximum current limit for the turn motors. -
TURN_MOTOR_SECONDARY_CURRENT_LIMIT
Secondary current limit for the turn motors. -
TURN_MOTOR_REDUCTION
public static final double TURN_MOTOR_REDUCTIONThe gear reduction between the turn motor and the module.- See Also:
-
TURN_GEARBOX
The gearbox model for the turn motor. -
TURN_ENCODER_INVERTED
public static final boolean TURN_ENCODER_INVERTEDWhether the turn encoder is inverted.- See Also:
-
TURN_ENCODER_POSITION_FACTOR
public static final double TURN_ENCODER_POSITION_FACTORConversion factor for turn position from encoder rotations to radians.- See Also:
-
TURN_ENCODER_VELOCITY_FACTOR
public static final double TURN_ENCODER_VELOCITY_FACTORConversion factor for turn velocity from encoder RPM to radians per second.- See Also:
-
TURN_KP
public static final double TURN_KPProportional gain for the turn motor PID controller.- See Also:
-
TURN_KD
public static final double TURN_KDDerivative gain for the turn motor PID controller.- See Also:
-
TURN_PID_MIN_INPUT
public static final double TURN_PID_MIN_INPUTMinimum input range for turn PID (in radians).- See Also:
-
TURN_PID_MAX_INPUT
public static final double TURN_PID_MAX_INPUTMaximum input range for turn PID (in radians).- See Also:
-
ROBOT_MASS
Total mass of the robot. -
JOYSTICK_DEADBAND
public static final double JOYSTICK_DEADBANDJoystick deadband for linear and rotational inputs.- See Also:
-
ANGLE_KP
public static final double ANGLE_KPProportional gain for rotational PID control.- See Also:
-
ANGLE_KD
public static final double ANGLE_KDDerivative gain for rotational PID control.- See Also:
-
MAX_ANGULAR_VELOCITY
Maximum angular velocity for the rotation motion profile in radians per second. -
MAX_ANGULAR_ACCELERATION
Maximum angular acceleration for the rotation motion profile in radians per second squared. -
FF_START_DELAY
Delay in seconds before feedforward characterization starts ramping voltage. -
FF_RAMP_RATE
public static final double FF_RAMP_RATEVoltage ramp rate in volts per second for feedforward characterization.- See Also:
-
WHEEL_RADIUS_MAX_VELOCITY
Maximum angular velocity in radians per second for wheel radius characterization. -
WHEEL_RADIUS_RAMP_RATE
Angular velocity ramp rate in radians per second squared for wheel radius characterization. -
ROBOT_MOI
Moment of inertia of the robot in kilogram-square meters. -
WHEEL_COF
public static final double WHEEL_COFCoefficient of friction for the wheels.- See Also:
-
PP_CONFIG
PathPlanner configuration object.
-
-
Constructor Details
-
DriveConstants
public DriveConstants()
-