Package trclib.sensor
Class TrcMotorLimitSwitch
java.lang.Object
trclib.sensor.TrcDigitalInput
trclib.sensor.TrcMotorLimitSwitch
This class implements a platform independent digital input sensor extending TrcDigitalInput. It provides
implementation of the abstract methods in TrcDigitalInput. The digital input sensor in this case is one
of the motor limit switches. This allows the motor limit switch to be used as a Digital Trigger
for operations such as auto zero calibration and limit switch notification callback.
-
Field Summary
FieldsFields inherited from class trclib.sensor.TrcDigitalInput
getInputElapsedTimer, instanceName
-
Constructor Summary
ConstructorsConstructorDescriptionTrcMotorLimitSwitch
(String instanceName, TrcMotor motor, boolean upperLimitSwitch) Constructor: Creates an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionboolean
This method returns the state of the digital input sensor.void
setInverted
(boolean inverted) This method inverts the polarity of the limit switch by configuring it to be normally open (non-inverted) or normally close (inverted).Methods inherited from class trclib.sensor.TrcDigitalInput
isActive, printElapsedTime, setElapsedTimerEnabled, toString
-
Field Details
-
motor
-
upperLimitSwitch
private boolean upperLimitSwitch
-
-
Constructor Details
-
TrcMotorLimitSwitch
Constructor: Creates an instance of the object.- Parameters:
instanceName
- specifies the instance name.motor
- specifies the motor controller that hosted the limit switch.upperLimitSwitch
- specifies true for the upper limit switch, false for lower limit switch.
-
-
Method Details
-
getInputState
public boolean getInputState()This method returns the state of the digital input sensor.- Specified by:
getInputState
in classTrcDigitalInput
- Returns:
- true if the digital input sensor is active, false otherwise.
-
setInverted
public void setInverted(boolean inverted) This method inverts the polarity of the limit switch by configuring it to be normally open (non-inverted) or normally close (inverted).- Overrides:
setInverted
in classTrcDigitalInput
- Parameters:
inverted
- specifies true to invert and false otherwise.
-