mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[wpilib] Deprecate getInstance() in favor of static functions (#3440)
Co-authored-by: Noam Zaks <imnoamzaks@gmail.com>
This commit is contained in:
@@ -28,14 +28,14 @@ public class Robot extends TimedRobot {
|
||||
new Thread(
|
||||
() -> {
|
||||
// Get the Axis camera from CameraServer
|
||||
AxisCamera camera = CameraServer.getInstance().addAxisCamera("axis-camera.local");
|
||||
AxisCamera camera = CameraServer.addAxisCamera("axis-camera.local");
|
||||
// Set the resolution
|
||||
camera.setResolution(640, 480);
|
||||
|
||||
// Get a CvSink. This will capture Mats from the camera
|
||||
CvSink cvSink = CameraServer.getInstance().getVideo();
|
||||
CvSink cvSink = CameraServer.getVideo();
|
||||
// Setup a CvSource. This will send images back to the Dashboard
|
||||
CvSource outputStream = CameraServer.getInstance().putVideo("Rectangle", 640, 480);
|
||||
CvSource outputStream = CameraServer.putVideo("Rectangle", 640, 480);
|
||||
|
||||
// Mats are very memory expensive. Lets reuse this Mat.
|
||||
Mat mat = new Mat();
|
||||
|
||||
@@ -28,14 +28,14 @@ public class Robot extends TimedRobot {
|
||||
new Thread(
|
||||
() -> {
|
||||
// Get the UsbCamera from CameraServer
|
||||
UsbCamera camera = CameraServer.getInstance().startAutomaticCapture();
|
||||
UsbCamera camera = CameraServer.startAutomaticCapture();
|
||||
// Set the resolution
|
||||
camera.setResolution(640, 480);
|
||||
|
||||
// Get a CvSink. This will capture Mats from the camera
|
||||
CvSink cvSink = CameraServer.getInstance().getVideo();
|
||||
CvSink cvSink = CameraServer.getVideo();
|
||||
// Setup a CvSource. This will send images back to the Dashboard
|
||||
CvSource outputStream = CameraServer.getInstance().putVideo("Rectangle", 640, 480);
|
||||
CvSource outputStream = CameraServer.putVideo("Rectangle", 640, 480);
|
||||
|
||||
// Mats are very memory expensive. Lets reuse this Mat.
|
||||
Mat mat = new Mat();
|
||||
|
||||
@@ -15,6 +15,6 @@ import edu.wpi.first.wpilibj.TimedRobot;
|
||||
public class Robot extends TimedRobot {
|
||||
@Override
|
||||
public void robotInit() {
|
||||
CameraServer.getInstance().startAutomaticCapture();
|
||||
CameraServer.startAutomaticCapture();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user