Class MotorSafety

  • Direct Known Subclasses:
    NidecBrushless, PWM, Relay, RobotDrive, RobotDriveBase

    public abstract class MotorSafety
    extends Object
    This base class runs a watchdog timer and calls the subclass's StopMotor() function if the timeout expires.

    The subclass should call feed() whenever the motor value is updated.

    • Constructor Detail

      • MotorSafety

        public MotorSafety()
    • Method Detail

      • feed

        public void feed()
        Feed the motor safety object.

        Resets the timer on this object that is used to do the timeouts.

      • setExpiration

        public void setExpiration​(double expirationTime)
        Set the expiration time for the corresponding motor safety object.
        Parameters:
        expirationTime - The timeout value in seconds.
      • getExpiration

        public double getExpiration()
        Retrieve the timeout value for the corresponding motor safety object.
        Returns:
        the timeout value in seconds.
      • isAlive

        public boolean isAlive()
        Determine of the motor is still operating or has timed out.
        Returns:
        a true value if the motor is still operating normally and hasn't timed out.
      • setSafetyEnabled

        public void setSafetyEnabled​(boolean enabled)
        Enable/disable motor safety for this device.

        Turn on and off the motor safety option for this PWM object.

        Parameters:
        enabled - True if motor safety is enforced for this object
      • isSafetyEnabled

        public boolean isSafetyEnabled()
        Return the state of the motor safety enabled flag.

        Return if the motor safety is currently enabled for this device.

        Returns:
        True if motor safety is enforced for this device
      • stopMotor

        public abstract void stopMotor()
      • getDescription

        public abstract String getDescription()