Watchdog Function Not Functioning


We’re with Team 74 C.H.A.O.S., and this year we have decided to switch from using LabVIEW to Python. It’s been a little bit bumpy, but for the most part, all is well.
We’re having an issue whenever we enable teleop, and both the Driver Station and our Simulator is saying the following:
“Output not updated often enough.”
We did some research, and discovered the idea of a “Watchdog” function. However, we couldn’t find this function anywhere in the wpilib. The closest thing that we found was the “feed” function, along with the setEnableSafety and the setExpiration function. At first, we tried using setExpiration in conjunction with the feed function, but we continued to have the “Output not updated often enough.” issue.
In the end, we gave up, and tried to disable this option by doing the following:
“self.lfmotor.setEnableSafety(False)”, where lfmotor is one of our respective motors.
AND STIll, we had the updating issue.

Any help would be greatly appreciated!


Team 74 C.H.A.O.S.

Can you post your code?

Hey Will,

WPILib has the motor safety stuff built in and enabled for RobotDrive to make it harder for the robot to do something like go into an infinite loop and have all of the motors going at full blast.

Basically, if you don’t tell the motors to do something within 100ms or so, then this error will occur. You can solve it by ensuring that you do something with robot drive each time teleopPeriodic is called.

You can run the following code in the simulator to demonstrate the problem and its solution:

import wpilib

class MyRobot(wpilib.IterativeRobot):

    def robotInit(self):
        self.joystick = wpilib.Joystick(0)
        self.robot_drive = wpilib.RobotDrive(1,2)

    def teleopPeriodic(self):
        if not self.joystick.getTrigger():

if __name__ == '__main__':

If you run this code and stick it in teleop, then all is well, as robot drive is getting called on each loop. However, if you enable the trigger button on the first joystick, then the annoying robot safety output messages will start appearing – because you’re no longer calling robot drive.

Does that make sense?