private void Exit_Click(object sender, EventArgs e) { Wiimotes.getWiimotesObject().cleanup(); m_WiimoteRecordingHandler.disconnectWiimotes(); mTrainingHandler.CleanupMedia(); Environment.Exit(0); }
//public static void Test3SpaceSensorAccGyro() //{ // SpaceSensorMain spaceSensorMain = new SpaceSensorMain(); // spaceSensorMain.SpaceSensorObject1.Connect(); // CSVFileWriter csvFileWriter = new CSVFileWriter(@"D:\temp\TestData.csv"); // for (int i = 0; i < 50; i++) // { // SensorData sensorDataObj = spaceSensorMain.SpaceSensorObject1.ReadAccGyroData(); // //Quaternion sensor2QuatObj = _spaceSensorMain.SpaceSensorObject2.ReadOrientation(); // StringBuilder dataRow = new StringBuilder(); // dataRow.Append(String.Format("{0:hh:mm:ss.fff}", DateTime.Now)); // dataRow.Append("," + sensorDataObj.AccDataObject.DataVector.X); // dataRow.Append("," + sensorDataObj.AccDataObject.DataVector.Y); // dataRow.Append("," + sensorDataObj.AccDataObject.DataVector.Z); // dataRow.Append("," + sensorDataObj.GyroDataObject.Pitch); // dataRow.Append("," + sensorDataObj.GyroDataObject.Roll); // dataRow.Append("," + sensorDataObj.GyroDataObject.Yaw); // csvFileWriter.writeLine(dataRow.ToString()); // Thread.Sleep(100); // } // csvFileWriter.close(); //} public static void Test3SpaceSensor() { Wiimotes wiimotesObj = Wiimotes.getWiimotesObject(); wiimotesObj.connectWiimotes(1); wiimotesObj.StartDataCollection(@"D:\temp\TestData.csv", true); Thread.Sleep(30000); wiimotesObj.StopDataCollection(); Thread.Sleep(3000); wiimotesObj.disconnectWiimotes(); Application.Exit(); }
public Form1() { cleanup(); InitializeComponent(); string workingDirectory = MainGUI.Properties.Settings.Default.WorkingDirectory; string wiimoteApplicationPath = MainGUI.Properties.Settings.Default.WiimoteApplicationPath; string matlabApplicationPath = MainGUI.Properties.Settings.Default.MatlapApplicationPath; string mediaDirectory = MainGUI.Properties.Settings.Default.MediaDirectory; ProjectConstants.initialize(workingDirectory, wiimoteApplicationPath, matlabApplicationPath, mediaDirectory); Environment.CurrentDirectory = ProjectConstants.PROJECT_PATH; this.openVideoDialog = new System.Windows.Forms.OpenFileDialog(); this.openMP3FileDialog = new System.Windows.Forms.OpenFileDialog(); this.openWiimoteSimulationFileDialog = new System.Windows.Forms.OpenFileDialog(); // openVideoDialog // this.openVideoDialog.DefaultExt = "avi"; this.openVideoDialog.FileName = "kangaroo.avi"; this.openVideoDialog.Filter = "movie files|*.avi||"; this.openVideoDialog.Title = "Choose a movie to play"; // openMP3Dialog // this.openMP3FileDialog.DefaultExt = "mpw"; this.openMP3FileDialog.Filter = "mp3 files|*.mp3||"; this.openMP3FileDialog.Title = "Choose a mp3 file to play"; // openWiimoteSimulationDialog // this.openWiimoteSimulationFileDialog.DefaultExt = "csv"; this.openWiimoteSimulationFileDialog.Filter = "csv files|*.csv||"; this.openWiimoteSimulationFileDialog.Title = "Choose a wiimote data file for simulation"; //open Wiimote Dialog this.openWiimoteDataDialog = new System.Windows.Forms.OpenFileDialog(); this.openWiimoteDataDialog.DefaultExt = "csv"; this.openWiimoteDataDialog.Filter = "csv files|*.csv||"; this.openWiimoteDataDialog.Title = "Choose Wiimote Data File to upload"; this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); this.saveFileDialog.DefaultExt = "csv"; this.saveFileDialog.Filter = "csv files|*.csv||"; saveFileDialog.InitialDirectory = ProjectConstants.WIIMOTE_REFERENCE_DATA_PATH; this.wiimoteDisconnect.Enabled = false; Configuration config = Configuration.getConfiguration(); config.initialize(); this.configurationBindingSource.DataSource = config; WiimoteDataStore.getWiimoteDataStore().initialize(); Wiimotes l_Wiimotes = Wiimotes.getWiimotesObject(); m_WiimoteRecordingHandler = new WiimoteRecordingHandler(l_Wiimotes, this); m_WiimoteRecordingHandler.Initialize(); m_WiimoteCalibrationHandler = new WiimoteCalibrationHandler(l_Wiimotes, this); m_WiimoteCalibrationHandler.Initialize(); this.trainingSegmentInfoBindingSource.DataSource = WiimoteDataStore.getWiimoteDataStore().TrainingSegmentInfoRecords; InitializeBluetoothSetupTab(); initializeTraining(l_Wiimotes); applicationStartSpeech(); InitializeMogreComponent(); mSpeechRecognition = SpeechRecognition.getSpeechRecognition(); mSpeechRecognition.VoiceCommandReceivedEvent += new SpeechRecognition.OnVoiceCommandReceivedEvent(OnVoiceCommandReceivedEvent); setButtonVoiceCommandOff(false); this.quartenionViewerControl.SetWiimotes(l_Wiimotes); //OSCCommunication oscCommunication = new OSCCommunication(); //oscCommunication.Initialize(l_Wiimotes); /* * try * { * m_OgreControl = new OgreControl(this.ogrePanel.Handle); * m_OgreControl.Init(); * * } * catch (MogreWrapperException e) * { * MessageBox.Show(e.Message, * "An Ogre exception has occurred!"); * } * * Disposed += new EventHandler(Form1_Disposed); * Resize += new EventHandler(Form1_Resize); * Paint += new PaintEventHandler(Form1_Paint); */ }