View Single Post
  #6   Spotlight this post!  
Unread 19-03-2016, 01:19
Peter Johnson Peter Johnson is online now
WPILib Developer
FRC #0294 (Beach Cities Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Redondo Beach, CA
Posts: 255
Peter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud of
Re: Send data from raspberry pi to roboRIO using c++

Quote:
Originally Posted by jreneew2 View Post
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)