RobotPy Watchdog Not Fed

I keep getting the error, “Watchdog not fed after 0.020000s” with this code.

    #!/usr/bin/env python3

    import wpilib
    from wpilib.drive import DifferentialDrive
    import ctre


    class MyRobot(wpilib.IterativeRobot):
        def robotInit(self):

            self.left = ctre.WPI_TalonSRX(0)
            self.right = ctre.WPI_TalonSRX(1)

            self.myRobot = DifferentialDrive(self.left, self.right)

            self.stick = wpilib.Joystick(0)

        def autonomousInit(self):
            pass

        def autonomousPeriodic(self):
            pass

        def teleopPeriodic(self):
            self.myRobot.setSafetyEnabled(False)
            self.myRobot.setExpiration(0.1)
            self.myRobot.arcadeDrive(self.stick, True)

        def testPeriodic(self):
            pass


    if __name__ == "__main__":
        wpilib.run(MyRobot)

Does it stop if you use TimedRobot instead of IterativeRobot?

self.myRobot.setSafetyEnabled(False) 
self.myRobot.setExpiration(0.1)

Why are you messing with MotorSafety at all?

1 Like

The Watchdog is enabled when the user’s functions start executing and disabled after they finish, so only user code is measured and network packet arrival jitter shouldn’t affect measurement (in other words, IterativeRobot and TimedRobot should behave the same). Try timing parts of the code yourself, or maybe just empty functions, to see where the slowdown is coming from.

Watchdog should have also printed a breakdown of the overrun per-function. What did it say, if anything?

1 Like

Note that even if you did want to mess with the watchdog settings (which is questionable), you should not be doing it in teleopPeriodic, it should be in a teleopInit function, or in robotInit.

It also printed this
TypeError: ‘>’ not supported between instances of ‘Joystick’ and ‘float’

Locals at innermost frame:

{‘value’: <wpilib.joystick.Joystick object at 0x06940410>}

Even without messing with the motor safety it still doesn’t work. The setSafetyEnabled(False) fixes the motors not being updated enough.

That’s relevant! Missed that. You’re not using arcadeDrive correctly. It expects three arguments: forward/backward, turn, and whether to square the inputs or not. Use stick.getY and stick.getX to do that.

Honestly why do we even have setSafetyEnabled(False)… It is not a fix for broken code. I have never seen anyone use it for something that wasn’t band-aid.

1 Like

Team Update 14 announced a new RIO image to resolve this:

  • Control System:A requiredNIUpdate Suite (2019.2.0) with a new roboRIO image (FRC_roboRIO_2019_v14) has been released. This image fixes a bug where robots randomly enter the Watchdog Not Fed state (disabling outputs) for ~2.5s when they should be enabled. To use this image, C++\Java teams must have the previously released 2019.3.2 update installed.

This is a different issue.

1 Like