void Start() { m_Client = new Client(); m_RetimingClient = new RetimingClient(); // If we're using the retimer, we don't want to use our own thread for getting frames. GetFrameThread = !IsRetimed; if (ConfigureWireless) { Output_ConfigureWireless WifiConfig = m_Client.ConfigureWireless(); if (WifiConfig.Result != Result.Success) { print("Failed to configure wireless: " + WifiConfig.ToString()); } else { print("Configured adapter for wireless settings"); } } print("Starting..."); Output_GetVersion OGV = m_Client.GetVersion(); print("Using Datastream version " + OGV.Major + "." + OGV.Minor + "." + OGV.Point + "." + OGV.Revision); if (Log) { SetupLog(); } m_Thread = new Thread(ConnectClient); m_Thread.Start(); }
void Start() { print("Starting..."); // Make a new client Output_GetVersion OGV = MyClient.GetVersion(); print("GetVersion Major: " + OGV.Major); // Connect to a server string HostName = "192.168.1.119:801"; int noAttempts = 0; print("Connecting to " + HostName + "..."); while (!MyClient.IsConnected().Connected) { // Direct connection Output_Connect OC = MyClient.Connect(HostName); print("Connect result: " + OC.Result); noAttempts += 1; if (noAttempts == 3) { break; } System.Threading.Thread.Sleep(200); } MyClient.EnableSegmentData(); MyClient.EnableMarkerData(); MyClient.EnableUnlabeledMarkerData(); // get a frame from the data stream so we can inspect the list of subjects MyClient.GetFrame(); Output_GetSubjectCount OGSC = MyClient.GetSubjectCount(); print("GetSubjectCount: " + OGSC.Result + "|" + OGSC.SubjectCount); // the first subjects in the data stream will be the original subjects unmodified by pegasus Output_GetSubjectName OGSN = MyClient.GetSubjectName(OGSC.SubjectCount - 1); print("GetSubjectName: " + OGSN.Result + "|" + OGSN.SubjectName); SubjectName = OGSN.SubjectName; // get the position of the root and point the camera at it Output_GetSubjectRootSegmentName OGSRSN = MyClient.GetSubjectRootSegmentName(SubjectName); Output_GetSegmentGlobalTranslation RootPos = MyClient.GetSegmentGlobalTranslation(SubjectName, OGSRSN.SegmentName); Output_GetMarkerCount mcount = MyClient.GetMarkerCount(SubjectName); Output_GetUnlabeledMarkerGlobalTranslation OGSGT = MyClient.GetUnlabeledMarkerGlobalTranslation(0); Vector3 Target = new Vector3(-(float)OGSGT.Translation[0] / 1000f, (float)OGSGT.Translation[1] / 1000f, (float)OGSGT.Translation[2] / 1000f); Camera.main.transform.LookAt(Target); }
void Start() { //data_UI.text = "Try this test"; m_Client = new Client(); m_RetimingClient = new RetimingClient(); print("Starting..."); Output_GetVersion OGV = m_Client.GetVersion(); print("Using Datastream version " + OGV.Major + "." + OGV.Minor + "." + OGV.Point + "." + OGV.Revision); if (Log) { SetupLog(); } m_Thread = new Thread(ConnectClient); m_Thread.Start(); }
private void TrackButton_Click(object sender, EventArgs e) { if (trackButton.Text == "Track") { if (serialPort.IsOpen) { for (byte i = 0; i < 5; i++) { Thread.Sleep(1000); logBox.Text += string.Format("{0}" + newLine, 5 - i); logBox.Update(); } trackButton.Text = "Stop Tracking"; trackButton.Update(); Thread.Sleep(0); logBox.Text += "Connecting "; logBox.Update(); while (!client.IsConnected().Connected) { client.Connect("localhost:801"); logBox.Text += ". "; logBox.Update(); Thread.Sleep(200); } logBox.Text += newLine + "Connected" + newLine; logBox.Update(); client.EnableSegmentData(); client.SetStreamMode(StreamMode.ClientPull); client.SetAxisMapping(Direction.Forward, Direction.Left, Direction.Up); Output_GetAxisMapping output_GetAxisMapping = client.GetAxisMapping(); Output_GetVersion output_GetVersion = client.GetVersion(); try { trackThread.Start(); } catch { MessageBox.Show("Unable to start new thread! Please restart the app.", "Error"); } logBox.Text += "\"track\" thread started" + newLine; logBox.Update(); } else { status.Text = "Disconnected"; MessageBox.Show("Serial Port connection required.", "Warning"); } } else { if (!driveThread.IsAlive) { client.Disconnect(); trackButton.Text = "Track"; trackButton.Update(); } else { MessageBox.Show("\"Drive\" thread still running!", "Warning"); } } Thread.Sleep(0); }