Go to Post I think the winning robot will be the same as every other year, a robot that is excellent at ONE thing. - Kel D [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Spotlight this post!  
Unread 20-08-2012, 22:00
Djur's Avatar
Djur Djur is offline
WPILib
AKA: Sam Carlberg
no team
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2009
Location: Massachusetts
Posts: 182
Djur will become famous soon enough
Re: Getting values from SmartDashboard

To answer OP's question, you could call NetworkTable.putDouble() in a widget to send a number and then call NetworkTable.getDouble() in the robot's code to retrieve it.

Driver's side:
Code:
NetworkTable.getTable("SmartDashboard").putDouble("Pi", 3.14159);
Robot side:
Code:
double pi = NetworkTable.getTable("SmartDashboard").getDouble("Pi");
Slightly offtopic here; this is aimed towards Ginto8.
Quote:
Originally Posted by Ginto8 View Post
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.
Don't bother with using a TimerTask; the new NetworkTables will use listeners to update values when they change in the table.
__________________
WPILib dev (RobotBuilder, SmartDashboard, GRIP)
Reply With Quote
 


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 09:14.

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