+ +
+ +

Class CanAndMagSwerve

+
+
java.lang.Object +
swervelib.encoders.SwerveAbsoluteEncoder +
swervelib.encoders.CanAndMagSwerve
+
+
+
+
+
public class CanAndMagSwerve +extends SwerveAbsoluteEncoder
+
HELIUM Canandmag from ReduxRobotics absolute encoder, attached through the CAN bus.
+
+
+ +
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      encoder

      +
      public com.reduxrobotics.sensors.canandmag.Canandmag encoder
      +
      The Canandmag representing the CANandMag on the CAN bus.
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      CanAndMagSwerve

      +
      public CanAndMagSwerve(int canid)
      +
      Create the Canandmag
      +
      +
      Parameters:
      +
      canid - The CAN ID whenever the CANandMag is operating on the CANBus.
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      factoryDefault

      +
      public void factoryDefault()
      +
      Reset the encoder to factory defaults. +

      + This will not clear the stored zero offset.

      +
      +
      Specified by:
      +
      factoryDefault in class SwerveAbsoluteEncoder
      +
      +
      +
    • +
    • +
      +

      clearStickyFaults

      +
      public void clearStickyFaults()
      +
      Clear sticky faults on the encoder.
      +
      +
      Specified by:
      +
      clearStickyFaults in class SwerveAbsoluteEncoder
      +
      +
      +
    • +
    • +
      +

      configure

      +
      public void configure(boolean inverted)
      +
      Configure the CANandMag to read from [0, 360) per second.
      +
      +
      Specified by:
      +
      configure in class SwerveAbsoluteEncoder
      +
      Parameters:
      +
      inverted - Whether the encoder is inverted.
      +
      +
      +
    • +
    • +
      +

      getAbsolutePosition

      +
      public double getAbsolutePosition()
      +
      Get the absolute position of the encoder.
      +
      +
      Specified by:
      +
      getAbsolutePosition in class SwerveAbsoluteEncoder
      +
      Returns:
      +
      Absolute position in degrees from [0, 360).
      +
      +
      +
    • +
    • +
      +

      getAbsoluteEncoder

      +
      public Object getAbsoluteEncoder()
      +
      Get the instantiated absolute encoder Object.
      +
      +
      Specified by:
      +
      getAbsoluteEncoder in class SwerveAbsoluteEncoder
      +
      Returns:
      +
      Absolute encoder object.
      +
      +
      +
    • +
    • +
      +

      setAbsoluteEncoderOffset

      +
      public boolean setAbsoluteEncoderOffset(double offset)
      +
      Cannot set the offset of the CANandMag.
      +
      +
      Specified by:
      +
      setAbsoluteEncoderOffset in class SwerveAbsoluteEncoder
      +
      Parameters:
      +
      offset - the offset the Absolute Encoder uses as the zero point.
      +
      Returns:
      +
      true if setting the zero point succeeded, false otherwise
      +
      +
      +
    • +
    • +
      +

      getVelocity

      +
      public double getVelocity()
      +
      Get the velocity in degrees/sec.
      +
      +
      Specified by:
      +
      getVelocity in class SwerveAbsoluteEncoder
      +
      Returns:
      +
      velocity in degrees/sec.
      +
      +
      +
    • +
    +
    +
  • +
+
+ +