Watchdog Not Fed - Motion Magic dropping - Java recommendations

Hello, we are using motion magic on an arm (called lift in the code) and wrist on our robot. A few times now we’ve gotten a Watchdog Not Fed error which causes the entire arm to come crashing down. It then hurriedly corrects itself and everyone spins towards the driver and says “What did you press??!!”.

I’m not sure if this is due to a brownout or if there’s enough inefficiency in our codebase that something is failing.

I’m the lead programming mentor on the team, but have only worked with Java for two years. I was hoping some more experienced programmers could take a minute or two and look at our code. We’ve coded this using a lot of assumptions on how Java works, but we’re sure there’s probably errors in how we’re doing things as our code gets more complex.

Any suggestions to improve this codebase or to squash whatever bug is causing this problem would be much appreciated:

Code: https://github.com/team6637/Robot2019/tree/master/src/main/java/frc/robot

Watchdog not fed is not a brownout condition, but an indication that you are not updating the throttle position on the motor with sufficient regularity. This is commonly caused by a while loop or other delay in a method somewhere.

I don’t see anything obvious in your code which would do this. As you’re using TimedRobot, I doubt that hiccups on the driver station computer would cause this. If you can’t find out what’s causing the delay, I can think of two ways to mitigate:

  1. Easier: Turn off motor safety for the lift motor.
  2. Better : provide a counter-spring or counterweight so that your motor doesn’t have to constantly provide major torque to hold the arm in place. This will also help your motor(s) run cooler. You will likely have to re-tune the arm, of course.

Where do you see the “watchdog not fed” message? In the DS main window or in the console log? How long is the outage for, 2-3 seconds? If you have the DS log file from when it happened, are there pinkish-purple dots from when it happened?

Hey, I think we might be encountering the same issue. We keep getting the same “Watchdog not fed for 0.2000 seconds” print and our elevator is having the same jerky behavior. We’ve been looking through our code and carefully commenting out and modifying the code in an attempt to avoid it, but we’ve had no success. It’s just quite puzzling. We’ve even boiled it down to just a 130 line test case and it still seems to be a problem. We still get the same warnings and issues when we use a different RoboRIO, and it seems like it happens more frequently after rebooting. Have you tried the same? It would be interesting to see if our issues are related.

1 Like

Hi Peter, I see it in the DS main window, in the center bottom beneath the joystick indicator.

Unfortunately, i don’t have my drive computer with me. I did notice on a secondary computer I was getting the following right after I init telop, but that doesn’t seem like much of a concern does it:

edu.wpi.first.wpilibj.IterativeRobotBase.printLoopOverrunMessage(IterativeRobotBase.java:273): Loop time of 0.02s overrun Warning 1 Loop time of 0.02s overrun

Hey MacAttack, are you using talons with motion magic or some kind of internal pid loop? I played with a few settings with the closed loop talon processes and didn’t notice a problem today.

Not sure if this was what fixed it, and I’m not too sure I understand exactly what to put since the docs don’t go into depth on how to use these, but this is what I ended up with for motion magic with a quadrature sensor:

motorMaster.setStatusFramePeriod(StatusFrame.Status_2_Feedback0, 5, RobotMap.timeoutMs);
motorMaster.setStatusFramePeriod(StatusFrame.Status_13_Base_PIDF0, 20, RobotMap.timeoutMs);
motorMaster.setStatusFramePeriod(StatusFrame.Status_10_Targets, 20, RobotMap.timeoutMs);

If you solve your issue, please share!

1 Like

We are using Talon SRXs, but we are not using motion magic. We’ll make sure to get back to you if/when we fix our issues.

Also, it would appear we get the same warning message that you do.

1 Like

@MacAttack The loop time overrun print message in the console is just a warning. It does not disable or do anything else to motors. If you see this warning it means that something in your code is running slower than it should, but if you’re seeing jerky motors, it’s not the cause.

@ericjanofski The “Watchdog Not Fed” error in the DS is different. It does disable motors. Definitely provide the DS log.

Team Update 14 announced a new RIO image to resolve this:
http://www.ni.com/download/first-robotics-software-2017/7904/en/

3 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.