Go to Post CD threads are supposed to be about something? - Tim Baird [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

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-02-2015, 11:10
Ozuru's Avatar
Ozuru Ozuru is offline
It's always the programmer's fault.
no team
 
Join Date: May 2013
Rookie Year: 2010
Location: Earth
Posts: 268
Ozuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to behold
NetworkTables Issues

Hello,

I'm currently having some issues with NetworkTables. I've created a standalone-application for vision processing and would like to send data to the RoboRIO. I keep getting an exception saying that the key is not defined/it can't access it -- I fear it is not being created and am unsure if I'm doing something wrong. Here's what I'm doing.

Vision Processing Application:
Code:
public static NetworkTable outputTable;

---
//main thread of program
public void run() {
NetworkTable.setClientMode();
NetworkTable.setIPAddress("10.25.59.2");
outputTable = NetworkTable.getTable("vision");
}
---
// semi-pseudocode, if it finds the tote it invokes that function with those parameters
if(foundTote) {
outputTable.putBoolean("found_tote", true);
}
Robot Code:
Code:
public static NetworkTable visionTable;

---
// robotInit in Robot.java
public void robotInit() {
visionTable = NetworkTable.getTable("vision");
}

---
// SmartDashboard syncer/setter function
public void sendSensorData() {
try{
SmartDashboard.putBoolean("Found Tote", visionTable.getBoolean("found_tote"));
} catch(Exception e) {System.out.println(e);}
}
I have a feeling that I may need to do something else but, due to the limited documentation, I cannot find out what I'm doing wrong. I'd love to hear your ideas.

Thanks.
Reply With Quote
  #2   Spotlight this post!  
Unread 10-02-2015, 14:22
amreuland's Avatar
amreuland amreuland is offline
Overworked Insomniac
AKA: Austin
FRC #2583 (Westwood Robotics)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Austin TX
Posts: 18
amreuland is on a distinguished road
Re: NetworkTables Issues

You should have a default value with that getBoolean. Also, if the rio starts up before your program, its going to get an error, because your client has not set the value yet.

Code:
getBoolean("found_tote", false);
Use that to keep from getting error, and make sure your client is actually connecting.
__________________
RoboLib - An enhanced FRC Library http://robolib.github.io/

Lone Star Match 85 - Arena and Robot Video https://www.youtube.com/watch?v=5tgJZ-s3dIQ
Reply With Quote
  #3   Spotlight this post!  
Unread 11-02-2015, 16:30
Ozuru's Avatar
Ozuru Ozuru is offline
It's always the programmer's fault.
no team
 
Join Date: May 2013
Rookie Year: 2010
Location: Earth
Posts: 268
Ozuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to behold
Re: NetworkTables Issues

Quote:
Originally Posted by amreuland View Post
You should have a default value with that getBoolean. Also, if the rio starts up before your program, its going to get an error, because your client has not set the value yet.

Code:
getBoolean("found_tote", false);
Use that to keep from getting error, and make sure your client is actually connecting.
Thank you. I've added that default case now and I'm still having this error -- they're simply not communicating. Any ideas?
Reply With Quote
Reply


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 08:37.

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