Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Need NetworkTables to update??(Grip) (http://www.chiefdelphi.com/forums/showthread.php?t=154222)

MarlyM64 25-01-2017 08:02

Need NetworkTables to update??(Grip)
 
How do I get the NetworkTables to update when the camera is plugged into the roboRio? (Grip related issue)

When the camera USB is plugged into the computer our networkTables update fine, and the GripPipeline code that Grip generated works fine, but we cannot get grip to publish networkTables that update when the camera is connected to the robot.

SamCarlberg 25-01-2017 10:32

Re: Need NetworkTables to update??(Grip)
 
GRIP only generates the vision processing code. You have to write the NetworkTables part.

If you take a look at this screensteps page, you can publish to NetworkTables inside the callback in the second code block. Something like

Code:

visionThread = new VisionThread(camera, new Pipeline(), pipeline -> {
  ...
  centerX = ...
  centerY = ...
  NetworkTables.getTable("vision").putNumber("centerX", centerX);
  NetworkTables.getTable("vision").putNumber("centerY", centerY);
});

We should also have an example for sending results to the SmartDashboard up in the next few days.

MarlyM64 25-01-2017 14:14

Re: Need NetworkTables to update??(Grip)
 
yes i have code similar to i, but it still won't work ._.



visionThread = new VisionThread(camera, new GripPipeline(), pipeline -> {
if (!pipeline.filterContoursOutput().isEmpty()) {

System.out.println(pipeline.filterContoursOutput() .get(0));
//SmartDashboard.putNumber("opencv",pipeline.filterC ontoursOutput().get(0));
table = NetworkTable.getTable("GRIP/marly");

double[] def = new double[0];
double[] areas = table.getNumberArray("width", def);
System.out.println(areas[0]);
}
});
visionThread.start();

SamCarlberg 25-01-2017 14:24

Re: Need NetworkTables to update??(Grip)
 
You're doing vision processing, but not using the results. You need to be putting values into the table.

wlogeais 25-01-2017 16:44

Re: Need NetworkTables to update??(Grip)
 
Quote:

Originally Posted by MarlyM64 (Post 1636182)
yes i have code similar to i, but it still won't work ._.


if (!pipeline.filterContoursOutput().isEmpty()) {

System.out.println(pipeline.filterContoursOutput() .get(0));
//SmartDashboard.putNumber("opencv",pipeline.filterC ontoursOutput().get(0));

Seems to me your goal is really how to 'get' and display?

if (!pipeline.filterContoursOutput().isEmpty()) {
Rect r = Imgproc.boundingRect(pipeline.filterContoursOutput ().get(0));
SmartDashboard.putString("opencv", "at (" + r.x + ',' + r.y + ')' );


All times are GMT -5. The time now is 21:52.

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