Package frc.robot.shared.config
Class VelocityMotionConfig
java.lang.Object
frc.robot.shared.config.AbstractConfig
frc.robot.shared.config.VelocityMotionConfig
Configuration bundle for velocity motion profile parameters used by velocity-controlled subsystems.
All RPM values represent mechanism (flywheel, roller, belt) speed after gear reduction, not motor shaft speed. The gear ratio is applied at the
motor encoder conversion layer in MotorConfig, so subsystem code never deals with motor-side rotations.
-
Nested Class Summary
Nested classes/interfaces inherited from class frc.robot.shared.config.AbstractConfig
AbstractConfig.ComponentPoseConfig -
Field Summary
FieldsModifier and TypeFieldDescriptiondoubleDefault idle velocity in RPM.doubleMaximum acceleration in RPM per second for the velocity ramp.doubleMaximum allowed mechanism velocity in RPM.doubleHow long the velocity must stay within tolerance before reporting ready, in seconds.doubleAcceptable velocity error when deciding if the mechanism is at its target, in RPM. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the default idle velocity in radians per second.doubleReturns the default idle velocity, tuned via SmartDashboard.doubleReturns the maximum acceleration in radians per second squared.doubleReturns the maximum acceleration for the velocity ramp, tuned via SmartDashboard.doubleReturns the maximum mechanism velocity in radians per second.doubleReturns the maximum mechanism velocity, tuned via SmartDashboard.doubleReturns how long the velocity must remain within tolerance before reporting ready.doubleReturns the acceptable velocity error in radians per second.static doublerpmToDegreesPerSecond(double rpm) Converts an RPM value to degrees per second.static doublerpmToRadiansPerSecond(double rpm) Converts an RPM value to radians per second.Methods inherited from class frc.robot.shared.config.AbstractConfig
getDashboardPrefix, initializeNestedDashboardPrefixes, readTunableBoolean, readTunableDegrees, readTunableDegreesAsRadians, readTunableNumber, readTunableString, setDashboardPrefix
-
Field Details
-
maximumVelocityRpm
public double maximumVelocityRpmMaximum allowed mechanism velocity in RPM. Targets above this value are clamped. -
maximumAccelerationRpmPerSecond
public double maximumAccelerationRpmPerSecondMaximum acceleration in RPM per second for the velocity ramp. Set to 0 to disable the trapezoidal ramp and use direct PID control. -
velocityToleranceRpm
public double velocityToleranceRpmAcceptable velocity error when deciding if the mechanism is at its target, in RPM. -
settleTimeSeconds
public double settleTimeSecondsHow long the velocity must stay within tolerance before reporting ready, in seconds. -
idleVelocityRpm
public double idleVelocityRpmDefault idle velocity in RPM. Set to 0 to stop the motor when idle.
-
-
Constructor Details
-
VelocityMotionConfig
public VelocityMotionConfig()
-
-
Method Details
-
rpmToRadiansPerSecond
public static double rpmToRadiansPerSecond(double rpm) Converts an RPM value to radians per second.- Parameters:
rpm- value in rotations per minute- Returns:
- equivalent value in radians per second
-
rpmToDegreesPerSecond
public static double rpmToDegreesPerSecond(double rpm) Converts an RPM value to degrees per second.Subsystems use this when building simulation motors that expect degrees-per-second suppliers.
- Parameters:
rpm- value in rotations per minute- Returns:
- equivalent value in degrees per second
-
getMaximumVelocityRpm
public double getMaximumVelocityRpm()Returns the maximum mechanism velocity, tuned via SmartDashboard.- Returns:
- max velocity in RPM
-
getMaximumVelocityRadiansPerSecond
public double getMaximumVelocityRadiansPerSecond()Returns the maximum mechanism velocity in radians per second.- Returns:
- max velocity in radians per second
-
getMaximumAccelerationRpmPerSecond
public double getMaximumAccelerationRpmPerSecond()Returns the maximum acceleration for the velocity ramp, tuned via SmartDashboard.When this returns 0, the subsystem uses direct PID control without a trapezoidal velocity ramp.
- Returns:
- max acceleration in RPM per second
-
getMaximumAccelerationRadiansPerSecondSquared
public double getMaximumAccelerationRadiansPerSecondSquared()Returns the maximum acceleration in radians per second squared.- Returns:
- max acceleration in radians per second squared
-
getVelocityToleranceRadiansPerSecond
public double getVelocityToleranceRadiansPerSecond()Returns the acceptable velocity error in radians per second.- Returns:
- velocity tolerance in radians per second
-
getSettleTimeSeconds
public double getSettleTimeSeconds()Returns how long the velocity must remain within tolerance before reporting ready.- Returns:
- settle time in seconds
-
getIdleVelocityRpm
public double getIdleVelocityRpm()Returns the default idle velocity, tuned via SmartDashboard.- Returns:
- idle velocity in RPM
-
getIdleVelocityRadiansPerSecond
public double getIdleVelocityRadiansPerSecond()Returns the default idle velocity in radians per second.- Returns:
- idle velocity in radians per second
-