Class VelocityMotionConfig

java.lang.Object
frc.robot.shared.config.AbstractConfig
frc.robot.shared.config.VelocityMotionConfig

public class VelocityMotionConfig extends AbstractConfig
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.

  • Field Details

    • maximumVelocityRpm

      public double maximumVelocityRpm
      Maximum allowed mechanism velocity in RPM. Targets above this value are clamped.
    • maximumAccelerationRpmPerSecond

      public double maximumAccelerationRpmPerSecond
      Maximum 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 velocityToleranceRpm
      Acceptable velocity error when deciding if the mechanism is at its target, in RPM.
    • settleTimeSeconds

      public double settleTimeSeconds
      How long the velocity must stay within tolerance before reporting ready, in seconds.
    • idleVelocityRpm

      public double idleVelocityRpm
      Default 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