View Single Post
  #3   Spotlight this post!  
Unread Today, 12:23
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,109
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: Creating a custom NetworkTable?

Quote:
Originally Posted by jcbaker4050 View Post
Like a number of other teams, Team 4050 is getting into vision processing this year for the first time. Our processing is pretty rudimentary but so far seems really reliable in picking out the gear lift.

Again, like others, we're looking to run our vision code on a Raspberry Pi. (We were originally planning to use a Jetson, but that introduced more hurdles.) However, the issue that we have run into is our complete inexperience with NetworkTables. We want to create a custom NetworkTable that contains the data that the RPi needs to communicate to the roboRIO so that it knows how to control the robot (e.g., turn left, go forward at 50% speed, etc.) Our lead programmer and I have spent a bunch of time researching NetworkTables; however, in every example that we've found, it assumes that the NT already exists.

We feel we understand the client side of things. What we need to know is how to create the NetworkTable so that it's there for the client to update.

Any suggestions, advice, or examples would be greatly appreciated.
Do you already have the connection started? If not, use the following code on the client side to start up a connection. I'm going to assume your RPi is in Java for now, but these are all very similar in any other language.

Code:
NetworkTable.setClientMode();
NetworkTable.setTeam(xxxx);
NetworkTable.initialize();
(Replace xxxx with your team number).

From that point, you can call
Code:
NetworkTable table = NetworkTable.getTable("Table_Name_Here");
to get access to any table. You can call this function on both the robot side and the client side, and each will get a reference to the specified table, and you can use the newly created table variable to pass data between the two.

Note that on the robot, NetworkTables is already set up, so you only need to call the getTable function.
__________________
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