Class SpectrumCANcoderConfig

java.lang.Object
frc.spectrumLib.hardware.SpectrumCANcoderConfig

public class SpectrumCANcoderConfig extends Object
Configuration parameters for a SpectrumCANcoder.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SpectrumCANcoderConfig(double rotorToSensorRatio, double sensorToMechanismRatio, double offset, boolean attached, boolean inverted)
    Creates a fully-specified CANcoder configuration.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    CAN device ID of the CANcoder; may be set after construction.
    double
    Magnetic offset applied to the CANcoder reading, in rotations.
    double
    Gear ratio between the motor rotor and the CANcoder shaft (rotor turns / sensor turn).
    double
    Gear ratio between the CANcoder shaft and the mechanism output (sensor turns / mechanism turn).
    boolean
    Whether the CANcoder hardware is physically present on the robot.
    boolean
    Whether the CANcoder sensor direction is inverted (clockwise positive).
    void
    setCANcoderID(int CANcoderID)
    CAN device ID of the CANcoder; may be set after construction.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 shaft
      sensorToMechanismRatio - Gear ratio from CANcoder shaft to mechanism output
      offset - Magnetic offset in rotations
      attached - true if the CANcoder is physically installed
      inverted - true to 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).