Log in

View Full Version : GRIP with kangaroo


1024Programming
13-02-2016, 12:19
We are trying to use grip with a Kangaroo. We have followed the screensteps documentation but it doesn't have a lot of information about running grip on startup. We are using this code to try and send values from the kangaroo network tables to the rio network tables:

import edu.wpi.first.wpilibj.networktables.NetworkTable;

public class main {
public static void main(String[] args){
NetworkTable localTable;
NetworkTable rioTable;
while(true){
NetworkTable.setClientMode();
localTable = NetworkTable.getTable("localhost");
rioTable = NetworkTable.getTable("10.10.24.62");
double[] centerx =localTable.getNumberArray("centerX", new double[0]);
double[] centery =localTable.getNumberArray("centerY", new double[0]);
double[] area =localTable.getNumberArray("area", new double[0]);
double[] height =localTable.getNumberArray("height", new double[0]);
double[] width =localTable.getNumberArray("width", new double[0]);
double[] solidity =localTable.getNumberArray("solidity", new double[0]);
for (int i = 0; i < centerx.length; i++) {
rioTable.putNumber("CenterX", centerx[i]);
}
for (int i = 0; i < centery.length; i++) {
rioTable.putNumber("CenterY", centery[i]);
}
for (int i = 0; i < area.length; i++) {
rioTable.putNumber("Area", area[i]);
}
for (int i = 0; i < height.length; i++) {
rioTable.putNumber("Height", height[i]);
}
for (int i = 0; i < width.length; i++) {
rioTable.putNumber("Width", width[i]);
}
for (int i = 0; i < solidity.length; i++) {
rioTable.putNumber("Solidity", solidity[i]);
}
}
}
}

we get this error when compiling:

platform: /Windows/amd64/
Exception in thread "main" java.lang.UnsatisfiedLinkError: no ntcore in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at edu.wpi.first.wpilibj.networktables.NetworkTablesJ NI.<clinit>(NetworkTablesJNI.java:57)
at edu.wpi.first.wpilibj.networktables.NetworkTable.i nitialize(NetworkTable.java:42)
at edu.wpi.first.wpilibj.networktables.NetworkTable.g etTable(NetworkTable.java:176)
at main.main(main.java:9)

If someone knows a way to do this or a solution to our code, please let us know.

Peter Johnson
13-02-2016, 13:28
You're likely using a NetworkTables jar file for the roboRio instead of for Windows. You should grab the latest -desktop.jar file from http://first.wpi.edu/FRC/roborio/maven/release/edu/wpi/first/wpilib/networktables/java/NetworkTables/3.0.0-SNAPSHOT/

Also, I'm not sure what you're trying to accomplish with the lines localTable = NetworkTable.getTable("localhost"); rioTable = NetworkTable.getTable("10.10.24.62");. The roboRio is the server, so you just need to set the server address, upon connection, all tables will be communicated/synchronized between all clients connected to that server.