Go to Post Yeah, yeah...those who aren't spotlit, spotlight.... - Jessica Boucher [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 03-02-2017, 21:32
Maxcr1's Avatar
Maxcr1 Maxcr1 is offline
Registered User
AKA: Max D
FRC #2169 (KING TeC)
Team Role: Programmer
 
Join Date: Nov 2016
Rookie Year: 2013
Location: Savage, MN
Posts: 9
Maxcr1 is an unknown quantity at this point
NetworkTables between Pi and Rio

Has anybody successfully created a commincation link between a RPi and a RoboRio with a radio in between? If so, could someone explain it or send old code?

Thanks,
-Max DeVos
KING TeC 2169
Reply With Quote
  #2   Spotlight this post!  
Unread 05-02-2017, 18:35
ajsmith's Avatar
ajsmith ajsmith is offline
Captain, Programming, Build
AKA: Andy Smith
FRC #5546 (A.R.T.)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2014
Location: Petersburg, VA
Posts: 10
ajsmith is a jewel in the roughajsmith is a jewel in the roughajsmith is a jewel in the rough
Re: NetworkTables between Pi and Rio

We are using Python on our Pi and Java on our RoboRIO.
After installing Python on the Pi, you can install pynetworktables using pip
Code:
pip install pynetworktables
Then, sampling the code from here,
Code:
NetworkTables.setClientMode()
NetworkTables.setIPAddress('roboRIO-2169-FRC.local')
NetworkTables.initialize()
Now you can send code to the robot by using something like
Code:
table = NetworkTables.getTable('/testnetworktable')
table.putNumber('test_key', number_you_want_to_send)
or get code from the robot
Code:
foo = table.getBoolean('foo', True)
And now if you go to the Outline Viewer in Eclipse, start a client connection to the same IP address as before (roboRIO-2169-FRC.local) and you should get the data.

You can also swap out roboRIO-2169-FRC.local for a static IP of your robot 10.21.69.2 (I actually think that is the preferred way to do it).

You can read up on pynetworktables here.
Reply With Quote
  #3   Spotlight this post!  
Unread 05-02-2017, 23:12
Maxcr1's Avatar
Maxcr1 Maxcr1 is offline
Registered User
AKA: Max D
FRC #2169 (KING TeC)
Team Role: Programmer
 
Join Date: Nov 2016
Rookie Year: 2013
Location: Savage, MN
Posts: 9
Maxcr1 is an unknown quantity at this point
Re: NetworkTables between Pi and Rio

Alright, that is extremely useful. Could you tell me what the Java side would look like?
Reply With Quote
  #4   Spotlight this post!  
Unread 05-02-2017, 23:24
ajsmith's Avatar
ajsmith ajsmith is offline
Captain, Programming, Build
AKA: Andy Smith
FRC #5546 (A.R.T.)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2014
Location: Petersburg, VA
Posts: 10
ajsmith is a jewel in the roughajsmith is a jewel in the roughajsmith is a jewel in the rough
That is pretty well documented here http://wpilib.screenstepslive.com/s/...-networktables.

After that it is up to you.
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 09:44.

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