# DiagnosedPublisher window size seems wrong. [closed]

I'm not sure what's going on here. I have a DiagnosedPublisher (on Groovy) created like this:

diagnosticPub_ = new diagnostic_updater::DiagnosedPublisher<sensor_msgs::LaserScan>(pub_, diagnostics_,
// frequency should be target +- 10%.
diagnostic_updater::FrequencyStatusParam(&expectedFrequency_, &expectedFrequency_, 0.1, 10),
// timestamp delta can be from 0.0 to 1.3x what it ideally is.
diagnostic_updater::TimeStampStatusParam(-1, 1.3 * 1.0/expectedFrequency_));


Here, expectedFrequency_ is 15.0. When I check the diagnostics in rqt_robot_monitor I get the following:

Events in window: 153
Events since startup: 5945
Duration of window (s): 10.200392
Actual frequency (Hz): 14.999424
Target frequency (Hz): 15.000000
Minimum acceptable frequency (Hz): 13.500000
Maximum acceptable frequency (Hz): 16.500000
Earliest timestamp delay:: 0.051229
Latest timestamp delay:: 0.051298
Earliest acceptable timestamp delay:: -1.000000
Latest acceptable timestamp delay:: 0.086667
Late diagnostic update count:: 0
Early diagnostic update count:: 0
Zero seen diagnostic update count:: 0

According to the documentation (and actually also from what I can see in the code that is linked there) the last parameter to FrequencyStatusParam should be the window size in number of events. So with 15Hz frequency, I'd expect roughly a window length of 0.66s with 10 events. However, I'm getting a duration of the window of 10s and 10 * 15Hz = 150 events in a window.

I can't really explain what's going on here. Am I setting this up somewhere wrongly or is this functioning as intended? The behavior seems to match those observations. If I change the window size to e.g. 7, I get a 7s window. When I unplug and re-plug the device it also takes about that long until diagnostics goes back to green.

edit retag reopen merge delete