[wpilibc] Revert "Return reference from GetInstance" (#3342)

This reverts commit a79faace1b.

This change will be superseded in a non-breaking way by changing to static functions and deprecating GetInstance() entirely.
This commit is contained in:
Peter Johnson
2021-05-09 18:16:07 -07:00
committed by GitHub
parent 3cc2da3328
commit 3fe8fc75aa
18 changed files with 63 additions and 67 deletions

View File

@@ -19,15 +19,15 @@ class Robot : public frc::TimedRobot {
static void VisionThread() {
// Get the Axis camera from CameraServer
cs::AxisCamera camera =
frc::CameraServer::GetInstance().AddAxisCamera("axis-camera.local");
frc::CameraServer::GetInstance()->AddAxisCamera("axis-camera.local");
// Set the resolution
camera.SetResolution(640, 480);
// Get a CvSink. This will capture Mats from the Camera
cs::CvSink cvSink = frc::CameraServer::GetInstance().GetVideo();
cs::CvSink cvSink = frc::CameraServer::GetInstance()->GetVideo();
// Setup a CvSource. This will send images back to the Dashboard
cs::CvSource outputStream =
frc::CameraServer::GetInstance().PutVideo("Rectangle", 640, 480);
frc::CameraServer::GetInstance()->PutVideo("Rectangle", 640, 480);
// Mats are very memory expensive. Lets reuse this Mat.
cv::Mat mat;

View File

@@ -50,7 +50,7 @@ class Robot : public frc::TimedRobot {
frc::DifferentialDrive m_robotDrive{m_left, m_right};
frc::Joystick m_stick{0};
frc::LiveWindow& m_lw = frc::LiveWindow::GetInstance();
frc::LiveWindow& m_lw = *frc::LiveWindow::GetInstance();
frc::Timer m_timer;
};

View File

@@ -24,15 +24,15 @@ class Robot : public frc::TimedRobot {
static void VisionThread() {
// Get the USB camera from CameraServer
cs::UsbCamera camera =
frc::CameraServer::GetInstance().StartAutomaticCapture();
frc::CameraServer::GetInstance()->StartAutomaticCapture();
// Set the resolution
camera.SetResolution(640, 480);
// Get a CvSink. This will capture Mats from the Camera
cs::CvSink cvSink = frc::CameraServer::GetInstance().GetVideo();
cs::CvSink cvSink = frc::CameraServer::GetInstance()->GetVideo();
// Setup a CvSource. This will send images back to the Dashboard
cs::CvSource outputStream =
frc::CameraServer::GetInstance().PutVideo("Rectangle", 640, 480);
frc::CameraServer::GetInstance()->PutVideo("Rectangle", 640, 480);
// Mats are very memory expensive. Lets reuse this Mat.
cv::Mat mat;

View File

@@ -16,7 +16,7 @@ class Robot : public frc::TimedRobot {
public:
void RobotInit() override {
#if defined(__linux__)
frc::CameraServer::GetInstance().StartAutomaticCapture();
frc::CameraServer::GetInstance()->StartAutomaticCapture();
#else
wpi::errs() << "Vision only available on Linux.\n";
wpi::errs().flush();

View File

@@ -21,7 +21,7 @@ void Robot::Teleop() {}
void Robot::Test() {}
void Robot::StartCompetition() {
auto& lw = frc::LiveWindow::GetInstance();
auto& lw = *frc::LiveWindow::GetInstance();
RobotInit();