|
Re: Send data from raspberry pi to roboRIO using c++
Quote:
Originally Posted by jreneew2
I am a bit of a newbie when it comes to linux, compilers, and stuff like that. I don't really know what to include in program. Right now I have
#include <ntcore/ntcore_cpp.h>
but it says it cannot find it. Also, when I am compiling the code I use this command
g++ -std=c++0x -lntcore vision2.cpp -o vision2 'pkg-config --cflags --libs opencv'
It does not work because it cannot file the include.
Also, I cant seem to find any documentation on how to use NetworkTables to send information from the server side. I have looked through the source code but that doesn't help me that much.
|
You need to add -I<path to ntcore/include directory> to the g++ command line, and the include line should just be #include <ntcore.h> (which will bring in both ntcore_c.h and ntcore_cpp.h).
Even better, if you #include <networktables/NetworkTable.h>, you'll get the same classes/functions you use on the robot program, so e.g. you can call NetworkTable::GetTable() et al. The only difference between this and your robot program is you'll need to run NetworkTables as a client rather than as the server, so first call NetworkTable::SetTeam() and then NetworkTable::SetClientMode() prior to calling NetworkTable::GetTable().
__________________
Author of cscore - WPILib CameraServer for 2017+
Author of ntcore - WPILib NetworkTables for 2016+
Creator of RobotPy - Python for FRC
2010 FRC World Champions ( 294, 67, 177)
2007 FTC World Champions (30, 74, 23)
2001 FRC National Champions (71, 294, 125, 365, 279)
|