Go to Post The object of the team is not to design, build and compete a robot, it is to design, build and compete students. If after four years we have opened a student's eyes to the infinite possibilities they have in their life, it is worth all the effort. - adunakin [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 15-02-2012, 16:26
BigJ BigJ is offline
Registered User
AKA: Josh P.
FRC #1675 (Ultimate Protection Squad)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Milwaukee, WI
Posts: 947
BigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond repute
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!

Last edited by BigJ : 15-02-2012 at 16:36.
  #2   Spotlight this post!  
Unread 15-02-2012, 22:27
Sunstroke Sunstroke is offline
Programmer
AKA: Joe Grinstead
FRC #3504 (Girls of Steel)
Team Role: Mentor
 
Join Date: Apr 2009
Rookie Year: 2009
Location: New England
Posts: 49
Sunstroke is an unknown quantity at this point
Re: Value refreshing on SmartDashboard

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...
  #3   Spotlight this post!  
Unread 15-02-2012, 23:13
BigJ BigJ is offline
Registered User
AKA: Josh P.
FRC #1675 (Ultimate Protection Squad)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Milwaukee, WI
Posts: 947
BigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond repute
Re: Value refreshing on SmartDashboard

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).
  #4   Spotlight this post!  
Unread 18-02-2012, 00:38
Ginto8's Avatar
Ginto8 Ginto8 is offline
Programming Lead
AKA: Joe Doyle
FRC #2729 (Storm)
Team Role: Programmer
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
Ginto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of light
Re: Value refreshing on SmartDashboard

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
  #5   Spotlight this post!  
Unread 20-02-2012, 11:14
BigJ BigJ is offline
Registered User
AKA: Josh P.
FRC #1675 (Ultimate Protection Squad)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Milwaukee, WI
Posts: 947
BigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond repute
Re: Value refreshing on SmartDashboard

Update -- changing the value that comes to the dashboard didn't seem to work.

Quote:
Originally Posted by Ginto8 View Post
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
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.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 01:34.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi