I’ve been puzzling why our C++ robot occasionally reports a loop time overrun along with information that is manifestly nonsense. For example:
Watchdog not fed within 0.010000s
Loop time of 0.010000s overrun
Default RobotPeriodic() method... Override me!
LiveWindow::UpdateValues(): 0.022000s
RobotPeriodic(): 0.128000s
SmartDashboard::UpdateValues(): 0.713000s
DisabledPeriodic(): 16.507000s
DisabledInit(): 7.383000s
Shuffleboard::Update(): 0.971000s
Notice the time for DisabledPeriodic is over 16 seconds. That’s clearly NOT what’s happening from the behavior of the robot!
The problem appears to be in the Watchdog::PrintEpochs
method where epoch.getValue().count()
is divided by 1.0e6
but epoch values are in nanoseconds according to the Watchdog.h
file.
I took a quick look at the Java version, but it is unclear to me whether the same problem exists there.
If you’re seeing these messages reporting time intervals in seconds, just treat them as milliseconds and they will make sense.
(Reported on github as allwpilib issue #2392.)