VisionThread issues

So I’m new to programming in general and was following the WPILib Screensteps instructions on using generated GRIP code in a robot program when I ran into the issue: The method filterContoursOutput() is undefined for the type GripPipeline

I’d appreciate any advice on this issue

My code is:

package frc.robot;

import org.opencv.core.Rect;
import org.opencv.imgproc.Imgproc;

import edu.wpi.cscore.UsbCamera;
import frc.robot.GripPipeline;
import edu.wpi.first.wpilibj.CameraServer;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.vision.VisionPipeline;
import edu.wpi.first.vision.VisionThread;

public class Robot extends IterativeRobot {
private static final String kDefaultAuto = “Default”;
private static final String kCustomAuto = “My Auto”;
private String m_autoSelected;
private final static int IMG_WIDTH = 320;
private final static int IMG_HEIGHT = 240;
private VisionThread visionThread;
private final double centerX = 0.0;
private final Object imgLock = new Object();

@Override
public void robotInit() {
final UsbCamera camera = CameraServer.getInstance().startAutomaticCapture();
camera.setResolution(IMG_WIDTH, IMG_HEIGHT);

visionThread = new VisionThread(camera, new GripPipeline(), pipeline -> { if (!pipeline.filterContoursOutput().isEmpty()) {
  Rect r = Imgproc.boundingRect(pipeline.filterContoursOutput().get(0));
  synchronized (imgLock) {
      centerX = r.x + (r.width / 2);
  }

}});

Do you have a filter contours operation in the GRIP pipeline you exported? I would open up the pipeline file to see what outputs are available to use.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.