Go to Post Cash is always better, remember that when fund raising. - LordDumpling [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 26-01-2012, 23:16
Hjelstrom's Avatar
Hjelstrom Hjelstrom is offline
Mentor
FRC #0987 (High Rollers)
Team Role: Mentor
 
Join Date: Mar 2008
Rookie Year: 2005
Location: Las Vegas
Posts: 148
Hjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond repute
Data sent from the SmartDashboard to the cRio

We have written a custom 'StaticWidget' extension for the smart dashboard which is attempting to send some data from the dashboard to the robot. We're trying to use some code like this in our widget:

// Plug our values right into the robot's network table
NetworkTable table = Robot.getTable();
table.putInt("987IntValue", integer_value);
table.putDouble("987DoubleValue",double_value);

I see other controls doing this such as 'CheckBox', etc. Our widget seems to be working in the dashboard.

My question is, what C++ API can we use to read those values on the cRio side? I was expecting something like SmartDashboard::Get... But I don't see anything like that.
  #2   Spotlight this post!  
Unread 27-01-2012, 10:00
dkearle's Avatar
dkearle dkearle is offline
Dianne
FRC #1280 (Ragin' C-Biscuits)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2011
Location: San Ramon, CA
Posts: 14
dkearle is an unknown quantity at this point
Re: Data sent from the SmartDashboard to the cRio

Quote:
Originally Posted by Hjelstrom View Post
My question is, what C++ API can we use to read those values on the cRio side? I was expecting something like SmartDashboard::Get... But I don't see anything like that.
I'm not sure if this will be helpful since we are not specifically getting data from the NetworkTable (yet), but we are using SmartDashboard::GetData() in an attempt to get the PID control constants from the SmartDashboard using the SendablePIDController object and corresponding SmartDashboard widget. To use GetData() we did have to downcast the return from SmartDashboard::GetData() from the base class SmartDashboardData to the subclass SendablePIDController. We used dynamic_class < SendablePIDController * > to downcast the returned object.

We are testing this to confirm it works as expected, but ran into a separate problem of disabling our robot when we hit [ENTER] after typing the new value we wanted for the P constant on the SmartDashboard. We'd love to know how to enter data into the SmartDashboard widgets without actually hitting the [ENTER] key on the driver station!
  #3   Spotlight this post!  
Unread 27-01-2012, 10:51
Hjelstrom's Avatar
Hjelstrom Hjelstrom is offline
Mentor
FRC #0987 (High Rollers)
Team Role: Mentor
 
Join Date: Mar 2008
Rookie Year: 2005
Location: Las Vegas
Posts: 148
Hjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond repute
Re: Data sent from the SmartDashboard to the cRio

Thats strange, I'm looking at the WPILib C++ source in FirstForge and I don't see a GetData function call anywhere in SmartDashboard or its parent classes.
  #4   Spotlight this post!  
Unread 27-01-2012, 11:10
dkearle's Avatar
dkearle dkearle is offline
Dianne
FRC #1280 (Ragin' C-Biscuits)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2011
Location: San Ramon, CA
Posts: 14
dkearle is an unknown quantity at this point
Re: Data sent from the SmartDashboard to the cRio

Quote:
Originally Posted by Hjelstrom View Post
Thats strange, I'm looking at the WPILib C++ source in FirstForge and I don't see a GetData function call anywhere in SmartDashboard or its parent classes.
For documentation I've been using the "C++ HTML Help file reference document" available on FirstForge. This has been incredibly useful. If you haven't already, I highly encourage you to download it - http://firstforge.wpi.edu/sf/go/doc1198?nav=1

After you download, open this help file, select "Contents", "Class List" and then scroll down to the SmartDashboard class. Select this and then scroll down the documentation on the SmartDashboard to the list of "Public Member Functions". GetData() is the third function listed.

I just looked in the SmartDashboard.h file on my computer. It is what was provided when I reinstalled the development environment this year. Here is what it contains: "SmartDashboardData* GetData(const char *keyName);"
  #5   Spotlight this post!  
Unread 27-01-2012, 11:20
Hjelstrom's Avatar
Hjelstrom Hjelstrom is offline
Mentor
FRC #0987 (High Rollers)
Team Role: Mentor
 
Join Date: Mar 2008
Rookie Year: 2005
Location: Las Vegas
Posts: 148
Hjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond repute
Re: Data sent from the SmartDashboard to the cRio

Oh, there is a lot of stuff in there that I don't see in the code I downloaded from FirstForge. Yes it looks like everything we need is there. Thanks!

I was trying to do some research from home where I don't have the development environment. I thought the code in FirstForge would be the latest but it apparently isn't.

Here is where I was looking:
http://firstforge.wpi.edu/sf/scm/do/...cts.wpilib/scm
  #6   Spotlight this post!  
Unread 27-01-2012, 11:25
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,586
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Last I looked, the source in firstforge svn wasn't updated this year. Look at the source installed on your computer.
  #7   Spotlight this post!  
Unread 27-01-2012, 11:33
dkearle's Avatar
dkearle dkearle is offline
Dianne
FRC #1280 (Ragin' C-Biscuits)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2011
Location: San Ramon, CA
Posts: 14
dkearle is an unknown quantity at this point
Re: Data sent from the SmartDashboard to the cRio

Joe Ross is correct. I just confirmed again that the repository you were looking in hasn't been updated in over 12 months. The HTML help file I mentioned does seem up-to-date and I found it to be very helpful.
  #8   Spotlight this post!  
Unread 27-01-2012, 12:45
Hjelstrom's Avatar
Hjelstrom Hjelstrom is offline
Mentor
FRC #0987 (High Rollers)
Team Role: Mentor
 
Join Date: Mar 2008
Rookie Year: 2005
Location: Las Vegas
Posts: 148
Hjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond repute
Re: Data sent from the SmartDashboard to the cRio

Yes, it all makes sense now :-)

Thanks!
  #9   Spotlight this post!  
Unread 10-02-2012, 22:43
dkearle's Avatar
dkearle dkearle is offline
Dianne
FRC #1280 (Ragin' C-Biscuits)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2011
Location: San Ramon, CA
Posts: 14
dkearle is an unknown quantity at this point
Re: Data sent from the SmartDashboard to the cRio

Quote:
Originally Posted by dkearle View Post
We used dynamic_class < SendablePIDController * > to downcast the returned object.
I just realized I had a typo here. This should have read dynamic_cast < SendablePIDController * > to downcast the returned object.
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 18:48.

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