Honey, will you tether your soul to mine?
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 06-02-2017, 22:14
BertTurtle BertTurtle is offline
Registered User
FRC #5940
 
Join Date: Apr 2016
Location: Burlingame, CA
Posts: 9
BertTurtle will become famous soon enough
Issues with retrieving NetworkTables

When we try to retrieve NetworkTables our driver station code crashes with the error:
Code:
Unhandled exception: java.lang.IllegalStateException: Network tables has already been initialized
The code on the coprocessor is:
Code:
NetworkTable.setIPAddress("59.40");
NetworkTable table = NetworkTable.getTable("Vision");
table.putNumber("Test Value", 8);
Then the code on the driver station is:
Code:
NetworkTable.setClientMode();
NetworkTable.setIPAddress("59.40");
table = NetworkTable.getTable("Vision");
SmartDashboard.putNumber("Test Value", table.getNumber("Test Value", 0));
We think it has something to do with NetworkTable.setClientMode() because when we remove that line it doesn't crash but we are not able to retrieve the number.
Reply With Quote
  #2   Spotlight this post!  
Unread 06-02-2017, 22:17
EmileH's Avatar
EmileH EmileH is online now
#dontbelarge
AKA: Emile Hamwey
FRC #1058 (The PVC Pirates) & SLFF (NE Way You Want It)
Team Role: Programmer
 
Join Date: Dec 2014
Rookie Year: 2011
Location: New England
Posts: 551
EmileH has a brilliant futureEmileH has a brilliant futureEmileH has a brilliant futureEmileH has a brilliant futureEmileH has a brilliant futureEmileH has a brilliant futureEmileH has a brilliant futureEmileH has a brilliant futureEmileH has a brilliant futureEmileH has a brilliant futureEmileH has a brilliant future
Re: Issues with retrieving NetworkTables

Remove the setIPAddress line on the robot, and make sure on the client you set the IP address to the mDNS address of the robot - roborio-5940-FRC.local.
__________________
2016-present: High School Student, FRC 1058 PVC Pirates

Reply With Quote
  #3   Spotlight this post!  
Unread 06-02-2017, 22:27
BertTurtle BertTurtle is offline
Registered User
FRC #5940
 
Join Date: Apr 2016
Location: Burlingame, CA
Posts: 9
BertTurtle will become famous soon enough
Re: Issues with retrieving NetworkTables

I made the suggested changes and it still has the same error.
Reply With Quote
  #4   Spotlight this post!  
Unread 06-02-2017, 22:34
EmileH's Avatar
EmileH EmileH is online now
#dontbelarge
AKA: Emile Hamwey
FRC #1058 (The PVC Pirates) & SLFF (NE Way You Want It)
Team Role: Programmer
 
Join Date: Dec 2014
Rookie Year: 2011
Location: New England
Posts: 551
EmileH has a brilliant futureEmileH has a brilliant futureEmileH has a brilliant futureEmileH has a brilliant futureEmileH has a brilliant futureEmileH has a brilliant futureEmileH has a brilliant futureEmileH has a brilliant futureEmileH has a brilliant futureEmileH has a brilliant futureEmileH has a brilliant future
Re: Issues with retrieving NetworkTables

Are you calling the setClientMode/setIPAddress/getTable calls repeatedly? They should only be called once on robot initialization.
__________________
2016-present: High School Student, FRC 1058 PVC Pirates

Reply With Quote
  #5   Spotlight this post!  
Unread 08-02-2017, 19:55
BertTurtle BertTurtle is offline
Registered User
FRC #5940
 
Join Date: Apr 2016
Location: Burlingame, CA
Posts: 9
BertTurtle will become famous soon enough
Re: Issues with retrieving NetworkTables

When we delete all of the lines of the robot code except for NetworkTables.setClientMode() it still crashes.

I am sure we are not calling it twice.
Reply With Quote
  #6   Spotlight this post!  
Unread 08-02-2017, 22:17
BertTurtle BertTurtle is offline
Registered User
FRC #5940
 
Join Date: Apr 2016
Location: Burlingame, CA
Posts: 9
BertTurtle will become famous soon enough
Re: Issues with retrieving NetworkTables

Just a quick update. On the coprocessor, I ran table.isConnected(), and it returned false.
Reply With Quote
  #7   Spotlight this post!  
Unread 09-02-2017, 22:53
BertTurtle BertTurtle is offline
Registered User
FRC #5940
 
Join Date: Apr 2016
Location: Burlingame, CA
Posts: 9
BertTurtle will become famous soon enough
Re: Issues with retrieving NetworkTables

I was able to fix the problem. NetworkTable.setServerMode() is automatically done in the robot code which causes the code to crash if you call NetworkTable.setClientMode().

I removed NetwokTable.setClientMode() from the robot code and put it on the coprocessor instead. I also moved NetworkTable.setIpAddress() to the coprocessor.
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 15: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