NetworkTables C++

This has been something I have always stumbled upon. This year, I am aiming to seamlessly integrate two systems together, one being the main robot code written in Java, and the other being the vision code running in C++. I am going to have my vision code run in Embedded Linux (ARM). I have not been able to find any good source for a library that will allow me to easily use NetworkTables.

Please point me to some resources. I wish to create a thread with a good answer so anyone else shot in the dark like me will have an easy time :wink:

Good Luck and Thanks!
Good Luck with your season and competitions! :slight_smile:

You can run pynetworktables on a pc, but that requires python.

Alternatively, you can use the source code that pynetworktables is compiled from to build a C++ version of the library (as it is C++ underneath).

Cross-platform files required: https://github.com/robotpy/pynetworktables/tree/master/src
Patched wpilib source that will compile on Windows and Linux: https://github.com/robotpy/wpilib

I did look at the pyNewtorkTables GitHub but I couldn’t understand what was really happening. Can I compile it and run include it in my OpenCV program?

Yes, you can extract the pieces that you need and compile them all together.

pynetworktables is a python program, and setup.py dictates what files are compiled and how they go together. However, if you use the source code that I linked to above, and compile it all together, you should end up with something that will be usable from C++. It may not be pretty, but currently nobody provides an easy way to build NetworkTables from C++.

I will try that during the offseason and probably make that available for everyone’s life easy :wink:

Why go through the hassel of using network tables. My experience with it is the bugs are not worth the trouble.

Create a simple TCP socket between the C++ code and the Java code.

Make the robot the server, and the c++ code the client and send ascii data between the two.

Make sure you run the read/write in their own threads so there is no i/o blocking.

You can control the communications, the ports, and the data being sent - no need for network tables really.

Use pthreads on the C++ side, and ServerSocketConnectionclass on the java (crio) side. Those classes are already apart of the codebases you are targeting and no need to have additional interpreters installed or rely on WPI library implementation.

Hope this helps,
Kevin

Yeah. I need to give that a try. First, however, I need to get our pretty ODROID up and running :smiley: :wink:
I realised that the ODROID that we recieved is twice as powerful as my new laptop and much more powerful than any of our team’s laptops!