Package com.revrobotics
Class CANSensor
- java.lang.Object
-
- com.revrobotics.CANSensor
-
- Direct Known Subclasses:
CANAnalog
,CANEncoder
public abstract class CANSensor extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
CANSensor.FeedbackSensorType
-
Field Summary
Fields Modifier and Type Field Description protected CANSparkMax
m_device
-
Constructor Summary
Constructors Constructor Description CANSensor(CANSparkMax device)
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description protected abstract int
getID()
Get the ID of the sensor that is connected to the SparkMax through the encoder port on the front of the controller (not the top port).abstract boolean
getInverted()
Get the phase of the CANSensor.abstract CANError
setInverted(boolean inverted)
Set the phase of the CANSensor so that it is set to be in phase with the motor itself.
-
-
-
Field Detail
-
m_device
protected final CANSparkMax m_device
-
-
Constructor Detail
-
CANSensor
public CANSensor(CANSparkMax device)
-
-
Method Detail
-
getID
protected abstract int getID()
Get the ID of the sensor that is connected to the SparkMax through the encoder port on the front of the controller (not the top port).- Returns:
- The ID of the sensor
-
setInverted
public abstract CANError setInverted(boolean inverted)
Set the phase of the CANSensor so that it is set to be in phase with the motor itself. This only works for quadrature encoders and analog sensors. This will throw an error if the user tries to set the inversion of the hall effect.- Parameters:
inverted
- The phase of the sensor- Returns:
- CANError.kOK if successful
-
getInverted
public abstract boolean getInverted()
Get the phase of the CANSensor. This will just return false if the user tries to get the inversion of the hall effect.- Returns:
- The phase of the sensor
-
-