![]() |
Send data from raspberry pi to roboRIO using c++
Hello, we are working on a raspberry pi and trying to get vision working on it. We already have c++ code that works, we just need to transfer the data from the raspberry pi to the roboRIO over networks tables. Ive seen the python network tables, however, we would prefer not porting our vision code to python because we do not have that much experience with python.
Any options? Drew |
Re: Send data from raspberry pi to roboRIO using c++
What you want is probably the network tables located here. You will need to make a teamforge account to do a git clone and download the source, but I believe this is exactly what you will need.
|
Re: Send data from raspberry pi to roboRIO using c++
Alright thanks!
|
Re: Send data from raspberry pi to roboRIO using c++
Near identical thread: http://www.chiefdelphi.com/forums/sh...d.php?t=144496
Essentially, the code is also on github (https://github.com/PeterJohnson/ntcore) and you should be able to use cmake and gcc 4.8+ to build it. |
Re: Send data from raspberry pi to roboRIO using c++
Hello, I have successfully built and installed the NetworkTables on the raspberry pi. However, I am having trouble getting it integrated with my vision program.
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. Any help is appreciated! -Drew |
Re: Send data from raspberry pi to roboRIO using c++
Quote:
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(). |
Re: Send data from raspberry pi to roboRIO using c++
Thanks! I'll try this when I get to robotics today!
|
Re: Send data from raspberry pi to roboRIO using c++
I tried adding the -I<ntcore/include> file but I am still getting an error:
Code:
/usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/crtl.o: In function `_start': /build/glibc-H706YU/glibc-2.19/csu/../ports/sysdeps/arm/start.S:119: undefined reference to main `main' collect2: error: ld returned 1 exit statusg++ -std=c++0x -I<ntcore/include> -lntcore vision.cpp -o test_colour `pkg-config --cflags --libs opencv` We think the reason is because it cannot find a main function even though we have a main function in vision.cpp EDIT: when we added the library path, we forgot to source it to make the program see the lib path. Thanks for your help! |
Re: Send data from raspberry pi to roboRIO using c++
Quote:
|
Re: Send data from raspberry pi to roboRIO using c++
Yep. Thank you for the help.
|
Re: Send data from raspberry pi to roboRIO using c++
Alright, I got the code to compile and I am trying to send the actual data now. However, I am not getting any values in the outline viewer. Here is my setup:
- Raspberry pi hooked up through ethernet to router which is also connected to roborio. - Here is my code on the robot side: Robot.cpp Code:
static std::shared_ptr<NetworkTable> table;Code:
distanceToCenter = Robot::table->GetNumber("center", 0.0);Code:
std::shared_ptr<NetworkTable> visionTable;- Drew |
Re: Send data from raspberry pi to roboRIO using c++
Quote:
Code:
NetworkTable::SetIPAddress("10.20.53.21"); |
Re: Send data from raspberry pi to roboRIO using c++
Alright, now I'm getting the error:
NT: ERROR: select() to roboRIO-2053-frc.local port 1735 error 111 - Connection refused (TCPConnector.cpp:157) |
Re: Send data from raspberry pi to roboRIO using c++
Quote:
|
Re: Send data from raspberry pi to roboRIO using c++
Yep. I removed them. All I have is:
std::shared_ptr<NetworkTable> visionTable; visionTable = NetworkTable::GetTable("vision"); |
| All times are GMT -5. The time now is 00:40. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi