View Single Post
  #6   Spotlight this post!  
Unread 19-08-2012, 18:02
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: Getting values from SmartDashboard

Quote:
Originally Posted by Sunstroke View Post
I'm excited someone understands the SmartDashboard and stuff so well, but I would like to correct you on this point.

It is actually worse if you surround things with begin and end transactions. If all you care about is sending one value, don't use a transaction.

If you want two or more values to be linked together, that is when you want to use a transaction.
Thanks for the correction! I wasn't entirely sure how the whole transaction situation was handled when I wrote that post, but now I understand it a bit better.

However, I'd like to point out that, in most situations, the overhead of the beginTransaction/endTransaction cycle would be mostly negligible. Transactions have a few extra steps (and a few more synchronized() calls), but unless you're doing an insane amount of transactions, the performance difference should be minimal - the main difference is the use of a NetworkQueue, which is just a specialized linked list.

That said, don't use transactions unless you're trying to send more than one entry at a time!


Quote:
Originally Posted by F22Rapture View Post
I'm a bit of a newb at this, so if you don't mind me asking where do I need to put the code on the SmartDashboard end?
You would put the code wherever you want to send or receive a new value - for example, if you have an extension that retrieves the state of the robot's drive train, you could have a TimerTask which periodically refreshes it, and the data retrieval would go in there.

I'm pretty sure that there's also some way to have the data automatically refreshed when it changes, but I haven't figured out how to use it yet - though I'm guessing it's possible by implementing NetworkListener or NetworkAdditionListener.
Reply With Quote