Go to Post For what it's worth, while they may or may not be legal as safety glasses, Steampunk goggles are perfectly legal as forehead protectors. - Nuttyman54 [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 08-01-2017, 00:03
Darksainor Darksainor is offline
Registered User
FRC #4635
 
Join Date: Jan 2017
Location: México
Posts: 2
Darksainor is an unknown quantity at this point
Error while trying to setup NetworkTables on PC

Hello, my team and I are currently trying to implement vision processing on our robot, in order to do so we will have a PC perform all the work and send the data to the roboRio through a NetworkTable, the problem is that i cant seem to build the .cpp file for setting up the PC side of the program. Here are both the program and the output when I attempt to build it.

Program (This is just for testing and learning purposes):
#include <ntcore.h>
#include <networktables/NetworkTable.h>
using std::shared_ptr;

int main() {
NetworkTable::SetClientMode();
NetworkTable::SetIPAddress("10.46.35.2");
NetworkTable::Initialize();
shared_ptr<NetworkTable> myTable = NetworkTable::GetTable("SmartDashboard");
myTable->PutString("ExampleString", "Sample Text");
NetworkTable::Shutdown();
return 0;
}


Output:
https://drive.google.com/file/d/0By8...NIYnVTeEU/view

I see that the problem is related to something caller llvm, but I cant seem to find a way to fix this, please help :c
Reply With Quote
  #2   Spotlight this post!  
Unread 08-01-2017, 00:26
fsilberberg fsilberberg is offline
WPILib Developer
AKA: Fred Silberberg
FRC #0190
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Redmond
Posts: 148
fsilberberg has a spectacular aura aboutfsilberberg has a spectacular aura aboutfsilberberg has a spectacular aura about
Re: Error while trying to setup NetworkTables on PC

You'll want to link against libwpiutil.so as well, add
Code:
-lwpiutil
to your flags. We split out a lot of the functions we use across all of our C++ codebase into a separate library, that's where all those missing functions are defined.
Reply With Quote
  #3   Spotlight this post!  
Unread 08-01-2017, 12:40
Peter Johnson Peter Johnson is offline
WPILib Developer
FRC #0294 (Beach Cities Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Redondo Beach, CA
Posts: 265
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: Error while trying to setup NetworkTables on PC

Quote:
Originally Posted by Darksainor View Post

Program (This is just for testing and learning purposes):
Code:
#include <ntcore.h>
#include <networktables/NetworkTable.h>
using std::shared_ptr;

int main() {
	NetworkTable::SetClientMode();
	NetworkTable::SetIPAddress("10.46.35.2");
	NetworkTable::Initialize();
	shared_ptr<NetworkTable> myTable = NetworkTable::GetTable("SmartDashboard");
	myTable->PutString("ExampleString", "Sample Text");
	NetworkTable::Shutdown();
	return 0;
}
After you fix the build error, you'll find that this program won't actually set a value. All NetworkTables calls are non-blocking, so the program will exit before it has a chance to connect to the server. You'll need to put the PutString in a loop or add a few seconds delay at the end. Note you'll want a loop for image processing anyway.
__________________
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)
Reply With Quote
  #4   Spotlight this post!  
Unread 08-01-2017, 16:24
Darksainor Darksainor is offline
Registered User
FRC #4635
 
Join Date: Jan 2017
Location: México
Posts: 2
Darksainor is an unknown quantity at this point
Re: Error while trying to setup NetworkTables on PC

Yes, thanks, I was able to compile and test it
Reply With Quote
  #5   Spotlight this post!  
Unread 09-01-2017, 11:53
jreneew2's Avatar
jreneew2 jreneew2 is offline
Alumni of Team 2053 Tigertronics
AKA: Drew Williams
FRC #2053 (TigerTronics)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Vestal, NY
Posts: 212
jreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura about
Re: Error while trying to setup NetworkTables on PC

Hello all, I have been trying to compile ntcore and cscore on a raspberry pi 3 and can not figure out the issue. Whenever I compile with

Code:
g++ -std=c++0x -I/home/pi/ntcore/include -lwpilibutil -lntcore test.cpp -o test `pkg-config --cflags --libs opencv`
The error I get is:

Code:
fatal error: llvm/ArrayRef.h: No such file or directory
I was able to successfully build the ntcore libs by doing

Code:
./gradlew :arm:build
All I have in the cpp file is #include<ntcore.h> and #include<networktables/NetworkTable.h>

Any help is appreciated
Reply With Quote
  #6   Spotlight this post!  
Unread 09-01-2017, 14:32
Thad House Thad House is online now
Volunteer, WPILib Contributor
no team (Waiting for 2021)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Thousand Oaks, California
Posts: 1,106
Thad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond repute
Re: Error while trying to setup NetworkTables on PC

Quote:
Originally Posted by jreneew2 View Post
Hello all, I have been trying to compile ntcore and cscore on a raspberry pi 3 and can not figure out the issue. Whenever I compile with

Code:
g++ -std=c++0x -I/home/pi/ntcore/include -lwpilibutil -lntcore test.cpp -o test `pkg-config --cflags --libs opencv`
The error I get is:

Code:
fatal error: llvm/ArrayRef.h: No such file or directory
I was able to successfully build the ntcore libs by doing

Code:
./gradlew :arm:build
All I have in the cpp file is #include<ntcore.h> and #include<networktables/NetworkTable.h>

Any help is appreciated
You need to add the wpiutil include path "wpiutil/include" to your build command as well. Also you need to be linking with wpiutil, not wpilibutil.

One thing to note is that roborio builds built with ./gradlew :arm:ntcore:build will NOT work with a raspberry pi. They are completely separate architectures. We provide some (untested) artifacts for pi and other hf devices on our maven repo. Our recommendation for Pi is to download the 3 artifacts (cscore, wpiutil and ntcore) from our maven repo, and build locally on the Pi using those artifacts. You can find more information here regarding which artifacts to use and how to find the right ones for your specific device.

If you do want to build your own builds, download the repositories and run "./gradlew :arm:ntcore:build -PcompilerPrefix=" on the pi itself with nothing specified after the compiler prefix. That will trick the build system into building the arm artifacts with the built in compiler.
__________________
All statements made are my own and not the feelings of any of my affiliated teams.
Teams 1510 and 2898 - Student 2010-2012
Team 4488 - Mentor 2013-2016
Co-developer of RobotDotNet, a .NET port of the WPILib.
Reply With Quote
  #7   Spotlight this post!  
Unread 09-01-2017, 15:12
jreneew2's Avatar
jreneew2 jreneew2 is offline
Alumni of Team 2053 Tigertronics
AKA: Drew Williams
FRC #2053 (TigerTronics)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Vestal, NY
Posts: 212
jreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura about
Re: Error while trying to setup NetworkTables on PC

Quote:
Originally Posted by Thad House View Post
You need to add the wpiutil include path "wpiutil/include" to your build command as well. Also you need to be linking with wpiutil, not wpilibutil.

One thing to note is that roborio builds built with ./gradlew :arm:ntcore:build will NOT work with a raspberry pi. They are completely separate architectures. We provide some (untested) artifacts for pi and other hf devices on our maven repo. Our recommendation for Pi is to download the 3 artifacts (cscore, wpiutil and ntcore) from our maven repo, and build locally on the Pi using those artifacts. You can find more information here regarding which artifacts to use and how to find the right ones for your specific device.

If you do want to build your own builds, download the repositories and run "./gradlew :arm:ntcore:build -PcompilerPrefix=" on the pi itself with nothing specified after the compiler prefix. That will trick the build system into building the arm artifacts with the built in compiler.
Thanks! I figured it out with your help!
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 13:33.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi