Class RollerConfig

java.lang.Object
frc.spectrumLib.sim.RollerConfig
All Implemented Interfaces:
Mountable.MountedConfig

public class RollerConfig extends Object implements Mountable.MountedConfig
Physical properties, display colors, canvas position, and the optional parent mount for a RollerSim.
  • Constructor Details

    • RollerConfig

      public RollerConfig(double diameterInches)
  • Method Details

    • isMounted

      public boolean isMounted()
    • setReversedLinkage

      public RollerConfig setReversedLinkage(boolean reversedLinkage)
      Mirrors the simulated motor so the sim's travel matches the motor's positive direction. See SimMotor.simState(com.ctre.phoenix6.hardware.TalonFX, boolean).
    • setGearRatio

      public RollerConfig setGearRatio(double ratio)
    • setSimMOI

      public RollerConfig setSimMOI(double moi)
    • setPosition

      public RollerConfig setPosition(double x, double y)
    • setMount

      public RollerConfig setMount(LinearSim sim)
      Attaches this roller to a LinearSim so its axle follows that stage.
      Parameters:
      sim - the stage to follow, or null to leave this roller unmounted
    • setMount

      public RollerConfig setMount(ArmSim sim)
      Attaches this roller to an ArmSim so its axle follows the arm tip.
      Parameters:
      sim - the arm to follow, or null to leave this roller unmounted
    • getRollerDiameterInches

      public double getRollerDiameterInches()
      Roller diameter in inches, used for both the physics model and the drawing.
    • getBackgroundLines

      public int getBackgroundLines()
    • getGearRatio

      public double getGearRatio()
      Motor rotations per roller revolution.
    • getSimMOI

      public double getSimMOI()
      Roller moment of inertia in kg·m², fed to the flywheel sim.
    • getOffColor

      public Color8Bit getOffColor()
      Color below the spin threshold the sim treats as stationary.
    • getFwdColor

      public Color8Bit getFwdColor()
      Color while the roller spins in the forward direction.
    • getRevColor

      public Color8Bit getRevColor()
      Color while the roller spins in the reverse direction.
    • getInitialX

      public double getInitialX()
      Initial axle X on the Mechanism2d canvas, in metres.
      Specified by:
      getInitialX in interface Mountable.MountedConfig
    • getInitialY

      public double getInitialY()
      Initial axle Y on the Mechanism2d canvas, in metres.
      Specified by:
      getInitialY in interface Mountable.MountedConfig
    • getMount

      public Mount getMount()
      The parent mount this roller is attached to, or null if not mounted.
      Specified by:
      getMount in interface Mountable.MountedConfig
    • getInitMountX

      public double getInitMountX()
      X position of the mount at simulation start (metres).
      Specified by:
      getInitMountX in interface Mountable.MountedConfig
    • getInitMountY

      public double getInitMountY()
      Y position of the mount at simulation start (metres).
      Specified by:
      getInitMountY in interface Mountable.MountedConfig
    • getInitMountAngle

      public double getInitMountAngle()
      Angle of the mount at simulation start (radians).
      Specified by:
      getInitMountAngle in interface Mountable.MountedConfig
    • isReversedLinkage

      public boolean isReversedLinkage()
      True when the sim geometry travels opposite the motor's positive direction.