Package frc.spectrumLib.hardware
Class SpectrumCANcoderConfig
java.lang.Object
frc.spectrumLib.hardware.SpectrumCANcoderConfig
Configuration parameters for a
SpectrumCANcoder.-
Constructor Summary
ConstructorsConstructorDescriptionSpectrumCANcoderConfig(double rotorToSensorRatio, double sensorToMechanismRatio, double offset, boolean attached, boolean inverted) Creates a fully-specified CANcoder configuration. -
Method Summary
Modifier and TypeMethodDescriptionintCAN device ID of the CANcoder; may be set after construction.doubleMagnetic offset applied to the CANcoder reading, in rotations.doubleGear ratio between the motor rotor and the CANcoder shaft (rotor turns / sensor turn).doubleGear ratio between the CANcoder shaft and the mechanism output (sensor turns / mechanism turn).booleanWhether the CANcoder hardware is physically present on the robot.booleanWhether the CANcoder sensor direction is inverted (clockwise positive).voidsetCANcoderID(int CANcoderID) CAN device ID of the CANcoder; may be set after construction.
-
Constructor Details
-
SpectrumCANcoderConfig
public SpectrumCANcoderConfig(double rotorToSensorRatio, double sensorToMechanismRatio, double offset, boolean attached, boolean inverted) Creates a fully-specified CANcoder configuration.- Parameters:
rotorToSensorRatio- Gear ratio from motor rotor to CANcoder shaftsensorToMechanismRatio- Gear ratio from CANcoder shaft to mechanism outputoffset- Magnetic offset in rotationsattached-trueif the CANcoder is physically installedinverted-trueto make clockwise rotation positive
-
-
Method Details
-
getCANcoderID
public int getCANcoderID()CAN device ID of the CANcoder; may be set after construction. -
setCANcoderID
public void setCANcoderID(int CANcoderID) CAN device ID of the CANcoder; may be set after construction. -
getRotorToSensorRatio
public double getRotorToSensorRatio()Gear ratio between the motor rotor and the CANcoder shaft (rotor turns / sensor turn). -
getSensorToMechanismRatio
public double getSensorToMechanismRatio()Gear ratio between the CANcoder shaft and the mechanism output (sensor turns / mechanism turn). -
getOffset
public double getOffset()Magnetic offset applied to the CANcoder reading, in rotations. -
isAttached
public boolean isAttached()Whether the CANcoder hardware is physically present on the robot. -
isInverted
public boolean isInverted()Whether the CANcoder sensor direction is inverted (clockwise positive).
-