View Single Post
  #2   Spotlight this post!  
Unread 26-01-2017, 22:26
Thad House Thad House is offline
Volunteer, WPILib Contributor
no team (Waiting for 2021)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Thousand Oaks, California
Posts: 1,107
Thad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond repute
Re: Basic NetworkTables Assistance Requested

Quote:
Originally Posted by legts View Post
Hello! My team is trying to do vision code for the first time, and I'm attempting to set up NetworkTables to be able to send information from a Raspberry Pi 3 to the driver's station. My eventual goal is to get an image from a camera connected to the Pi, do some image processing stuff on it, and send that feed back to the driver's station. My questions basically boil down to "how do I write code for NetworkTables so that I can get this to stream a camera feed back to the driver's station " but I'll ask some more specific stuff.

1. How do the devices transmit information? (Raspberry Pi talks to the roboRIO which talks to the driver's station?)

2. How do I set up the communication between the devices? Right now I've been trying to get the Pi to send data directly to the driver's station without involving the roboRIO, is that the best way to go about this?

3. Do I need to use GRIP in order to use NetworkTables? The only information I could find about it on screenstepslive involved using GRIP, and I'm not sure if GRIP is required to use NetworkTables.

4.What do I need to write on the Pi to get NetworkTables functioning?

Also, if anyone has any links to NetworkTables documentation or other information about it then that would be great as I'm pretty much flying blind here.

Thanks!
That build system you linked will actually automatically stream the image over the network. The stream it produces can be found by going to
Code:
http://raspberrypi.local:1185/
(note raspberrypi.local can be replaced with whatever the IP address of the pi is.) That system also automatically includes NetworkTables, and even includes the proper setup to have it connect to the roboRIO.

The right way for network tables to be set up is to have the roboRIO as the server, and everything else as a client. The build system is already set up as a client, and so do both SmartDashboard and the LV dashboard.

To get access to put things on the Dashboard, you need a NetworkTable object, pointing to the SmartDashboard table. To do this, use the following code.

Code:
NetworkTable sdTable = NetworkTable.getTable("SmartDashboard");
That will get you access to the table. From there, you can use the same methods you would use on the SmartDashboard class on the robot (putNumber, putString, getNumber, etc) on that object to send and receive data. This will be sent to the roboRIO, which will then send all data to all other clients, such as the dashboard.
__________________
All statements made are my own and not the feelings of any of my affiliated teams.
Teams 1510 and 2898 - Student 2010-2012
Team 4488 - Mentor 2013-2016
Co-developer of RobotDotNet, a .NET port of the WPILib.
Reply With Quote