Package frc.spectrumLib.sim
Class RollerConfig
java.lang.Object
frc.spectrumLib.sim.RollerConfig
- All Implemented Interfaces:
Mountable.MountedConfig
Physical properties, display colors, canvas position, and the optional parent mount for a
RollerSim.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintColor while the roller spins in the forward direction.doubleMotor rotations per roller revolution.doubleInitial axle X on the Mechanism2d canvas, in metres.doubleInitial axle Y on the Mechanism2d canvas, in metres.doubleAngle of the mount at simulation start (radians).doubleX position of the mount at simulation start (metres).doubleY position of the mount at simulation start (metres).getMount()The parent mount this roller is attached to, ornullif not mounted.Color below the spin threshold the sim treats as stationary.Color while the roller spins in the reverse direction.doubleRoller diameter in inches, used for both the physics model and the drawing.doubleRoller moment of inertia in kg·m², fed to the flywheel sim.booleanbooleanTrue when the sim geometry travels opposite the motor's positive direction.setGearRatio(double ratio) Attaches this roller to anArmSimso its axle follows the arm tip.Attaches this roller to aLinearSimso its axle follows that stage.setPosition(double x, double y) setReversedLinkage(boolean reversedLinkage) Mirrors the simulated motor so the sim's travel matches the motor's positive direction.setSimMOI(double moi)
-
Constructor Details
-
RollerConfig
public RollerConfig(double diameterInches)
-
-
Method Details
-
isMounted
public boolean isMounted() -
setReversedLinkage
Mirrors the simulated motor so the sim's travel matches the motor's positive direction. SeeSimMotor.simState(com.ctre.phoenix6.hardware.TalonFX, boolean). -
setGearRatio
-
setSimMOI
-
setPosition
-
setMount
Attaches this roller to aLinearSimso its axle follows that stage.- Parameters:
sim- the stage to follow, or null to leave this roller unmounted
-
setMount
Attaches this roller to anArmSimso 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
Color below the spin threshold the sim treats as stationary. -
getFwdColor
Color while the roller spins in the forward direction. -
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:
getInitialXin interfaceMountable.MountedConfig
-
getInitialY
public double getInitialY()Initial axle Y on the Mechanism2d canvas, in metres.- Specified by:
getInitialYin interfaceMountable.MountedConfig
-
getMount
The parent mount this roller is attached to, ornullif not mounted.- Specified by:
getMountin interfaceMountable.MountedConfig
-
getInitMountX
public double getInitMountX()X position of the mount at simulation start (metres).- Specified by:
getInitMountXin interfaceMountable.MountedConfig
-
getInitMountY
public double getInitMountY()Y position of the mount at simulation start (metres).- Specified by:
getInitMountYin interfaceMountable.MountedConfig
-
getInitMountAngle
public double getInitMountAngle()Angle of the mount at simulation start (radians).- Specified by:
getInitMountAnglein interfaceMountable.MountedConfig
-
isReversedLinkage
public boolean isReversedLinkage()True when the sim geometry travels opposite the motor's positive direction.
-