C++ Network Tables to LabVIEW

Our team is experimenting with an off season robot and wants to send a camera image from a co-processor to the LabVIEW Driver station. No one on the team is familiar with the ntcore or the NetworkTable libraries in C++.

We know that the libraries and the .dll is installed correctly and is working from testing.


#include <opencv2\videoio.hpp>
#include <opencv2\highgui.hpp>
#include <opencv2\opencv.hpp>
#include <ntcore.h>
#include <networktables/NetworkTable.h>

using namespace cv;
using namespace std;
using std::shared_ptr;

void main()
{

        NetworkTable::SetServerMode();
	NetworkTable::SetIPAddress("10.74.32.11");  //ip address of co-processor
	NetworkTable::Initialize();
	shared_ptr<NetworkTable> myTable = NetworkTable::GetTable("SmartDashboard");

... //code for grabbing image and manipulating it 

	cv::Size size = dst.size();

	int total = size.width * size.height * dst.channels();
	std::vector<uchar> data(dst.ptr(), dst.ptr() + total);
	std::string s(data.begin(), data.end());
	myTable->PutString("Eagle_Eye", s);
}

Our question is what is the proper way to set up the network tables with a LabVIEW dashboard to send the compressed string s to the network tables.

RoboRio IP 10.74.32.2
Co-Processor IP 10.74.32.11
Driver Station IP 10.74.32.5

7432 NOS

NetworkTables is for sending small bits of data between different devices on the network. Image frames are not small.

If the camera you’re using is a USB webcam or IP camera, I strongly recommend plugging it into the roboRIO and have the roboRIO handle it; you can follow these instructions

Otherwise, you should write a small CameraServer app to run on the co-processor, since it’s designed exactly for this usecase.


As a side note, the NetworkTables guide you seem to be following is several years out of date. You should read through the current NetworkTables guides on screensteps