コード例 #1
0
ファイル: Camera.cpp プロジェクト: FRC830/Stone
	void CAMERAFEEDS::changeCam(int newId) {
		int imaqError;
		IMAQdxStopAcquisition(curCam);

		if (kBtCamFront == newId)
			curCam = camFront;
		else
			curCam = camBack;

		imaqError = IMAQdxConfigureGrab(curCam);
		if(imaqError != IMAQdxErrorSuccess) {
			DriverStation::ReportError("IMAQdxConfigureGrab error: " + std::to_string((long)imaqError) + "\n");
		}
		IMAQdxStartAcquisition(curCam);
		//curCam = newId;
	}
コード例 #2
0
void Robot::TeleopPeriodic() {
	Scheduler::GetInstance()->Run();
	SmartDashboard::PutNumber("Arm Pos:",Robot::intakeArm->GetPos());
	SmartDashboard::PutNumber("POV:",oi->getDriveStick()->GetPOV(0));
	SmartDashboard::PutBoolean("old:",oldCameraSel);
	SmartDashboard::PutBoolean("sel:",CameraSel);
	double time = 0;
	if (oldCameraSel != CameraSel)
	{
		time = Timer::GetFPGATimestamp();
		IMAQdxStopAcquisition(session);
		IMAQdxUnconfigureAcquisition(session);
		IMAQdxCloseCamera(session);
		if (CameraSel)
			imaqError = IMAQdxOpenCamera("cam2", IMAQdxCameraControlModeController, &session);
		else
			imaqError = IMAQdxOpenCamera("cam0", IMAQdxCameraControlModeController, &session);
		if(imaqError != IMAQdxErrorSuccess) {
			DriverStation::ReportError("IMAQdxOpenCamera error: " + std::to_string((long)imaqError) + "\n");
		}
		imaqError = IMAQdxConfigureGrab(session);
		if(imaqError != IMAQdxErrorSuccess) {
			DriverStation::ReportError("IMAQdxConfigureGrab error: " + std::to_string((long)imaqError) + "\n");
		}
		IMAQdxStartAcquisition(session);
		oldCameraSel = CameraSel;
		time = time - Timer::GetFPGATimestamp();
		SmartDashboard::PutNumber("Switch:",time);
	}
//	if (CameraSel)
//		IMAQdxGrab(session2, frame, true, NULL);
//	else
	IMAQdxGrab(session, frame, true, NULL);
	if(imaqError != IMAQdxErrorSuccess) {
		DriverStation::ReportError("IMAQdxGrab error: " + std::to_string((long)imaqError) + "\n");
	} else {
		CameraServer::GetInstance()->SetImage(frame);
	}

}
コード例 #3
0
ファイル: Camera.cpp プロジェクト: FRC830/Stone
	void  CAMERAFEEDS::end() {
		IMAQdxStopAcquisition(curCam);
	}