xqms / rosmon

ROS node launcher & monitoring daemon
Other
180 stars 47 forks source link

rosmon_core: ui: UI DrawStatus optimized to only refresh on events. #121

Closed Cartoonman closed 4 years ago

Cartoonman commented 4 years ago

This was an important update to significantly reduce the 'idle' bandwidth on wireless low-bandwidth networks. This improves usability over ssh/mosh to remote nodes.

The way rosmon's update function seems to work is that it's called at a nominal rate of 10Hz, regardless of what's going on in the console screen. This was readily apparent when using mosh paired with Wireshark, where observing ~60 nodes all muted (so no new information is being printed), rosmon consumed ~50 kbps on average. All of this was from re-rendering the multitude of node status bars at a nominal rate of 10Hz.

So what this patch does is it gates the actual updating against a boolean that's set to true only on user key events and logging events. The same scenario described above with this patch effectively makes the 'idle' bandwidth 0 kbps. This patch still maintains the responsiveness of the original and, if you press a lot of keys, you will obviously trigger the draw function a lot. The goal of this patch is to only draw or update when something needs to be drawn.

xqms commented 4 years ago

Looks good! I just made the redraw trigger logic simpler (just redraw on every key press) to avoid bugs in the future. This way we can't forget to call scheduleUpdate() in some code path...