Package trclib.sensor

Class TrcMotorLimitSwitch

java.lang.Object
trclib.sensor.TrcDigitalInput
trclib.sensor.TrcMotorLimitSwitch

public class TrcMotorLimitSwitch extends TrcDigitalInput
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 Details

    • motor

      private final TrcMotor motor
    • upperLimitSwitch

      private boolean upperLimitSwitch
  • Constructor Details

    • TrcMotorLimitSwitch

      public TrcMotorLimitSwitch(String instanceName, TrcMotor motor, boolean upperLimitSwitch)
      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 class TrcDigitalInput
      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 class TrcDigitalInput
      Parameters:
      inverted - specifies true to invert and false otherwise.