Class CANCoderSwerve

    • Field Detail

      • encoder

        public com.ctre.phoenix.sensors.WPI_CANCoder encoder
        CANCoder with WPILib sendable and support.
    • Constructor Detail

      • CANCoderSwerve

        public CANCoderSwerve​(int id)
        Initialize the CANCoder on the standard CANBus.
        Parameters:
        id - CAN ID.
      • CANCoderSwerve

        public CANCoderSwerve​(int id,
                              String canbus)
        Initialize the CANCoder on the CANivore.
        Parameters:
        id - CAN ID.
        canbus - CAN bus to initialize it on.
    • Method Detail

      • configure

        public void configure​(boolean inverted)
        Configure the absolute encoder 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).