Class LinearConfig

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

public class LinearConfig extends Object implements Mountable.MountedConfig
Physical properties, Mechanism2d display settings, and the optional parent mount for a LinearSim.
  • Constructor Details

    • LinearConfig

      public LinearConfig(double x, double y, double gearing, double drumRadius)
  • Method Details

    • isMounted

      public boolean isMounted()
    • setReversedLinkage

      public LinearConfig 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).
    • setNumMotors

      public LinearConfig setNumMotors(int numMotors)
    • setCarriageMass

      public LinearConfig setCarriageMass(double carriageMassKg)
    • setAngle

      public LinearConfig setAngle(double angle)
    • setColor

      public LinearConfig setColor(Color8Bit color)
    • setLineWidth

      public LinearConfig setLineWidth(double lineWidth)
    • setStaticLength

      public LinearConfig setStaticLength(double lengthInches)
      Sets the static ligament's visual length. Takes inches and stores metres.
    • setMovingLength

      public LinearConfig setMovingLength(double lengthInches)
      Sets the moving ligament's visual length. Takes inches and stores metres.
    • setMaxHeight

      public LinearConfig setMaxHeight(double lengthInches)
      Sets the top of the travel range. Takes inches and stores metres.
    • setMount

      public LinearConfig setMount(LinearSim sim)
      Attaches this stage to a parent LinearSim so its root follows that stage.
      Parameters:
      sim - the stage to follow, or null to leave this one unmounted
    • setMount

      public LinearConfig setMount(ArmSim sim)
      Attaches this stage to a parent ArmSim so its root follows the arm tip.
      Parameters:
      sim - the arm to follow, or null to leave this stage unmounted
    • getNumMotors

      public int getNumMotors()
      Number of Kraken X60 motors driving the linear stage.
    • getElevatorGearing

      public double getElevatorGearing()
      Gear ratio between the motor and the elevator drum.
    • getCarriageMassKg

      public double getCarriageMassKg()
      Mass of the moving carriage in kilograms, fed to the physics sim.
    • getDrumRadius

      public double getDrumRadius()
      Drum radius in metres, which converts motor rotations into carriage travel.
    • getMinHeight

      public double getMinHeight()
      Minimum travel height of the mechanism in metres.
    • getMaxHeight

      public double getMaxHeight()
      Maximum travel height of the mechanism in metres.
    • getAngle

      public double getAngle()
      Angle of the linear stage on the Mechanism2d canvas, in degrees, where 0 is horizontal, 90 is vertical, and positive is counter-clockwise.
    • getColor

      public Color8Bit getColor()
    • getLineWidth

      public double getLineWidth()
      Stroke width of the stage ligaments, in pixels.
    • getInitialX

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

      public double getInitialY()
      Initial Y of the static root on the canvas, in metres.
      Specified by:
      getInitialY in interface Mountable.MountedConfig
    • getStaticRootX

      public double getStaticRootX()
      Current X of the static root in metres, moved every tick while mounted.
    • setStaticRootX

      public void setStaticRootX(double staticRootX)
      Current X of the static root in metres, moved every tick while mounted.
    • getStaticRootY

      public double getStaticRootY()
      Current Y of the static root in metres, moved every tick while mounted.
    • setStaticRootY

      public void setStaticRootY(double staticRootY)
      Current Y of the static root in metres, moved every tick while mounted.
    • getStaticLength

      public double getStaticLength()
      Visual length of the non-moving stage ligament, in metres.
    • getMovingLength

      public double getMovingLength()
      Visual length of the moving stage ligament, in metres.
    • getMount

      public Mount getMount()
      The parent mount this linear stage 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.