SmartDashboard causing Watchdog errors

We are trying to use the SmartDashboard in our program to display some data related to the operation of our robot. The only data we are sending is doubles, yet whenever we try and use the SmartDashboard, it causes “Watchdog Not Fed” errors. Anyone know whats going on? For reference, we are using c++.

Since I don’t know anything about the structure of your code it is hard to guess what the problem is, but there is one possibility that you are sending the updates too frequently. We, for example, only update the SmartDashboard once every 10 loops (which are timed to be 0.02sec each). If you update too frequently it can cause a large delay which could cause a WatchDog error.

Are you deriving your robot class from SimpleRobot or IterativeRobot? How often are you updating the Dashboard?

We are using a customs robot class derived from IterativeRobot. The entire loop is updated every .02 seconds.

Can you confirm that when your SmartDashboard code is removed that your robot does not have WatchDog problems? Can you confirm that the causation of the problem is based on the presence of SmartDashboard calls?

The reason I ask is because there are many different ways to get that error. Should the problem be related to the SmartDashboard, my guess would be MamaSpoldi’s – that those calls are slowing down the loop too much for the WatchDog’s taste.

However, I have not seen that error before with regards to the SmartDashboard. At least, not on Java.

Yes, we ran the code with the SmartDashboard code running and it gave watchdog errors. We then commented out only the SmartDashboard lines and we got no errors.

It sounds like it could be possibly related to this issue that I filed at WPILib’s C++ Tracker.

Currently, the way the C++ NetworkTables is implemented, anytime you call Put*, it tries to obtain a lock – which is also the lock that the write thread is holding. The effect is if your robot is blocking when writing to the network (which is likely, particularly if you’re writing a lot of keys), then the robot will hang at Put* until the write completes. One way this can manifest itself also is in a complete hang of the robot if a NetworkTables client disconnects from the network, because the write thread blocks (practically) indefinitely.

I’ve implemented a fix for the performance issue (though it only partially solves the hang issue), and it’s available in the RobotPy fork of WPILib (see this commit).

I would suggest not updating the dashboard everytime through the loop. A person cannot possibly process the change in the values that quickly anyway.

Here is a snippet of code that we use to do this. It is simple and still gives a very prompt dashboard update.


    if (dashCounter == 10)
    {
        // these are the calls to our classes to update the dashboard
        thor->UpdateDash();
        loki->UpdateDash();
        valkyrie->UpdateDash();
       
        dashCounter = 0;
        ds->UpdateLCD();        
    }
    else
    {
        dashCounter++;
    }

Thanks, I’ll test this out.