MotorSafety

class wpilib.MotorSafety

Bases: pybind11_object

The Motor Safety feature acts as a watchdog timer for an individual motor. It operates by maintaining a timer that tracks how long it has been since the feed() method has been called for that actuator. Code in the Driver Station class initiates a comparison of these timers to the timeout values for any actuator with safety enabled every 5 received packets (100ms nominal).

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

check() None

Check if this motor has exceeded its timeout.

This method is called periodically to determine if this motor has exceeded its timeout value. If it has, the stop method is called, and the motor is shut down until its value is updated again.

static checkMotors() None

Check the motors to see if any have timed out.

This static method is called periodically to poll all the motors and stop any that have timed out.

feed() None

Feed the motor safety object.

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

getDescription() str

The return value from this method is printed out when an error occurs

This method must not throw!

getExpiration() seconds

Retrieve the timeout value for the corresponding motor safety object.

Returns:

the timeout value.

isAlive() bool

Determine if the motor is still operating or has timed out.

Returns:

true if the motor is still operating normally and hasn’t timed out.

isSafetyEnabled() bool

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.

setExpiration(expirationTime: seconds) None

Set the expiration time for the corresponding motor safety object.

Parameters:

expirationTime – The timeout value.

setSafetyEnabled(enabled: bool) None

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.

stopMotor() None