public MainWindow() { InitializeComponent(); xboxController = new XboxController.XboxController(); pilotPreferences.xboxController = xboxController; comSock = new commSockReceiver(35000); comSock.IncomingLine += comSock_IncomingLine; comSock.newConnection += comSock_newConnection; comSock.connectionLost += comSock_connectionLost; comSock.beginAccept(); driveInputMan = new driveInputManager(xboxController); driveTransmit = new driveTransmitter(driveInputMan, comSock); try { orientation = OculusOrientation.getInstance(); ptTransmitter = new OculusTransmitter(comSock, orientation); } catch (Exception e) { MessageBox.Show("WARNING! Oculus offline (probably not plugged in). ERROR: " + e.Message); } pilotPreferences.topSpeedChanged += pilotPreferences_topSpeedChanged; }
/// <summary> /// Using a factory model, returns an instance (the only one actually) of the Oculus. The device will start firing events with an updated orientation immediately. /// </summary> /// <returns></returns> public static OculusOrientation getInstance() { if (instance == null) { instance = new OculusOrientation(); } return instance; }
public MainWindow() { InitializeComponent(); cameraView = new dualCameraViewer.MainWindow(); cameraView.Show(); comVizIn.setTitle("PT COM IN"); comVizOut.setTitle("PT COM OUT"); ArduMan = ArduinoManager.Instance; ArduMan.findArduinos(); PTDuino = ArduMan.getPanTiltArduino(); PTDuino.Data_Received += PTDuino_Data_Received; orientation = OculusOrientation.getInstance(); orientation.orientationChanged += orientation_orientationChanged; }
public OculusTransmitter(commSockReceiver _CSR, OculusOrientation _OcuOrient) { CSR = _CSR; OcuOrient = _OcuOrient; OcuOrient.yawChanged += OcuOrient_yawChanged; OcuOrient.pitchChanged += OcuOrient_pitchChanged; sendTimer = new Timer(sendTimerCallback, null,100, 50); //can send up to 20 times per second }