Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   GRIP example code compile error (http://www.chiefdelphi.com/forums/showthread.php?t=153642)

randy_pham 14-01-2017 12:53

GRIP example code compile error
 
Code:

@Override
        public void robotInit() {
                UsbCamera camera = CameraServer.getInstance().startAutomaticCapture();
            camera.setResolution(IMG_WIDTH, IMG_HEIGHT);
           
           
            visionThread = new VisionThread(camera, new Pipeline(),  pipeline -> {
                if (!pipeline.filterContoursOutput().isEmpty()) {
                    Rect r = Imgproc.boundingRect(pipeline.filterContoursOutput().get(0));
                    synchronized (imgLock) {
                        centerX = r.x + (r.width / 2);
                    }
                }
            });
            visionThread.start();
               
        }

We are getting this error: The constructor VisionThread(UsbCamera, Pipeline, (<no type> pipeline) -> {}) is undefined.

We have included Pipeline.java in our package. The errors seems to be withing the listener lambda. We are using java 1.8 in eclipse.

SamCarlberg 14-01-2017 12:59

Re: GRIP example code compile error
 
Does the Pipeline class implement the VisionPipeline interface? eg

Code:

public class Pipeline implements VisionPipeline {
...
}


randy_pham 14-01-2017 13:49

Re: GRIP example code compile error
 
Thank you, that fixed our problem! :0)

SamCarlberg 14-01-2017 14:00

Re: GRIP example code compile error
 
Glad to hear! Next time, make sure to tick the "Implement WPILib VisionPipeline" button in the code generation settings ;)


All times are GMT -5. The time now is 12:34.

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