Class RollerConfig

java.lang.Object
frc.spectrumLib.sim.RollerConfig

public class RollerConfig extends Object
Configuration data for a roller mechanism simulation. Stores physical properties, display colors, canvas position, and optional mount attachment used by RollerSim.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RollerConfig(double diameterInches)
    Creates a RollerConfig for a roller with the given diameter.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Number of radial lines used to draw the roller circle in the Mechanism2d canvas.
    Color displayed when the roller is spinning in the forward direction.
    double
    Gear ratio between the motor and the roller output shaft.
    double
    Initial X position of the roller axle in the Mechanism2d canvas (metres).
    double
    Initial Y position of the roller axle in the Mechanism2d canvas (metres).
    double
    Angle of the mount at simulation start (radians).
    double
    X position of the mount at simulation start (metres).
    double
    Y position of the mount at simulation start (metres).
    The parent mount this roller is attached to, or null if not mounted.
    Color displayed when the roller is stationary or below the velocity threshold.
    Color displayed when the roller is spinning in the reverse direction.
    double
    Outer diameter of the roller in inches, used for physics and visual scaling.
    double
    Moment of inertia of the roller used by the flywheel physics simulation (kg·m²).
    boolean
    Whether this roller is attached to a parent Mount.
    setGearRatio(double ratio)
    Sets the gear ratio between the motor and the roller output shaft.
    Attaches this roller to an ArmSim mount so its axle tracks the arm tip's position.
    Attaches this roller to a LinearSim mount so its axle tracks the linear stage's position.
    setPosition(double x, double y)
    Sets the initial position of the roller axle in the Mechanism2d canvas.
    setSimMOI(double moi)
    Sets the moment of inertia used by the flywheel physics simulation.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RollerConfig

      public RollerConfig(double diameterInches)
      Creates a RollerConfig for a roller with the given diameter.
      Parameters:
      diameterInches - outer diameter of the roller in inches
  • Method Details

    • setGearRatio

      public RollerConfig setGearRatio(double ratio)
      Sets the gear ratio between the motor and the roller output shaft.
      Parameters:
      ratio - gear ratio (motor rotations per roller rotation)
      Returns:
      this config for chaining
    • setSimMOI

      public RollerConfig setSimMOI(double moi)
      Sets the moment of inertia used by the flywheel physics simulation.
      Parameters:
      moi - moment of inertia in kg·m²
      Returns:
      this config for chaining
    • setPosition

      public RollerConfig setPosition(double x, double y)
      Sets the initial position of the roller axle in the Mechanism2d canvas.
      Parameters:
      x - initial X position in metres
      y - initial Y position in metres
      Returns:
      this config for chaining
    • setMount

      public RollerConfig setMount(LinearSim sim)
      Attaches this roller to a LinearSim mount so its axle tracks the linear stage's position.
      Parameters:
      sim - the linear stage to mount onto, or null to leave unmounted
      Returns:
      this config for chaining
    • setMount

      public RollerConfig setMount(ArmSim sim)
      Attaches this roller to an ArmSim mount so its axle tracks the arm tip's position.
      Parameters:
      sim - the parent arm to mount onto, or null to leave unmounted
      Returns:
      this config for chaining
    • getRollerDiameterInches

      public double getRollerDiameterInches()
      Outer diameter of the roller in inches, used for physics and visual scaling.
    • getBackgroundLines

      public int getBackgroundLines()
      Number of radial lines used to draw the roller circle in the Mechanism2d canvas.
    • getGearRatio

      public double getGearRatio()
      Gear ratio between the motor and the roller output shaft.
    • getSimMOI

      public double getSimMOI()
      Moment of inertia of the roller used by the flywheel physics simulation (kg·m²).
    • getOffColor

      public Color8Bit getOffColor()
      Color displayed when the roller is stationary or below the velocity threshold.
    • getFwdColor

      public Color8Bit getFwdColor()
      Color displayed when the roller is spinning in the forward direction.
    • getRevColor

      public Color8Bit getRevColor()
      Color displayed when the roller is spinning in the reverse direction.
    • getInitialX

      public double getInitialX()
      Initial X position of the roller axle in the Mechanism2d canvas (metres).
    • getInitialY

      public double getInitialY()
      Initial Y position of the roller axle in the Mechanism2d canvas (metres).
    • isMounted

      public boolean isMounted()
      Whether this roller is attached to a parent Mount.
    • getMount

      public Mount getMount()
      The parent mount this roller is attached to, or null if not mounted.
    • getInitMountX

      public double getInitMountX()
      X position of the mount at simulation start (metres).
    • getInitMountY

      public double getInitMountY()
      Y position of the mount at simulation start (metres).
    • getInitMountAngle

      public double getInitMountAngle()
      Angle of the mount at simulation start (radians).