Value refreshing on SmartDashboard

Hi all,

I’ve recently been working on a custom widget for SmartDashboard that is a running line graph of the last 200 values sent (or 4 seconds at 50Hz). I’m planning to release it later after a bit more polish and customization goes into it.

It works great, the only problem I’m having now is it doesn’t update when the values coming in aren’t changing.

My best guess is one of these 2:

  • the setValue(Object o) method of the Widget is only called when the value is different from the last (on dashboard side)
  • NetworkTable values are only sent to the SmartDashboard when they are different from the last (on robot side)

and I completely understand why this might be a design decision for performance.

Does anyone have any tips on where this goes on, or how to make it take in every value? I’m not shy about editing the SmartDashboard source and recompiling, but I’m a little more hesistant to muck around in WPILib (using Java, by the way.) I poked around a bit in the SmartDashboard source but didn’t find what I was looking for.

One potential solution we came up with was to alternate adding or subtracting a miniscule amount (all values are Doubles) to trigger a send, which wouldn’t be too bad as you don’t see the numbers - it’s just graphical. But if we can get it working without that it would be preferred.

Thanks!

It happens on the robot side. The NetworkTable does nothing unless a value changes.

Changing the value of the double a little bit would do what you want.

Also, although this is a mildly awful idea, you can have your widget change the value of the element in the field every time it reads in a value. That way, when the robot puts in a new value, it will be different. However, that will change the value in the table…

Thanks, I’ll try changing the value on dashboard side, and if it doesn’t work I’ll do the fidgeting double thing.

I’m not terribly worried about performance – this would be a tuning/testing tool and not something to use during a match (in my opinion).

If you want an indicator of when the NetworkTable is updated, you could have a boolean value that you invert every update, as a way of indicating the change. This would be a MUCH better idea than tweaking the double because it wouldn’t actually skew your data at all. Floating point is a little weird because changes that you think are easily reversible may not be after all, which means that tweaking a double is just generally a very bad idea :wink:

Update – changing the value that comes to the dashboard didn’t seem to work.

Yes, but then the double wouldn’t have changed and the value wouldn’t be updated. I’m not doing any calculations with the numbers other than graphics math on the dashboard, and I don’t care if the graph is 1 pixel off. Don’t worry, It would always be the last step before smartdashboard.