예제 #1
0
        /// <summary>
        /// Converts byte to command and then executes command
        /// </summary>
        /// <param name="receivedCommand"></param>
        public void handleCommand(byte[] receivedCommand)
        {
            int command = (int)receivedCommand[2];

            switch (command)
            {
            // 0 is Start Cameras
            case 0:
            {
                MotionCapture.StartCameras();
                camerasStartedEvent();
                break;
            }

            // 1 is Stop Cameras
            case 1:
            {
                MotionCapture.StopCameras();
                break;
            }

            // 2 is Send Camera Coordinates
            case 2:
            {
                MotionCapture.UpdateCameraList();
                OptitrackCameraList.TransmitListOfCameras();
                break;
            }

            // 3 is Start Treadmill At Fixed Speed
            case 3:
            {
                TreadmillController.SetSpeed((float)BitConverter.ToDouble(receivedCommand, 4));
                break;
            }

            // 4 is Stop Treadmill
            case 4:
            {
                TreadmillController.SetSpeed(0.0f);
                break;
            }

            //8 is toggle feet on/off
            case 8:
            {
                break;
            }

            default:
            {
                System.Diagnostics.Debug.WriteLine("Invalid command received: " + command.ToString());
                break;
            }
            }
        }
예제 #2
0
        public static void UpdateCameraList()
        {
            int             numberOfCameras = pointcloud.CameraCount;
            OptiTrackCamera camera          = new OptiTrackCamera();

            double[] tempRotationMatrix = new double[9];

            for (int i = 0; i < numberOfCameras; i++)
            {
                camera.CameraNumber = i;
                camera.xCoordinate  = pointcloud.GetCamera(i).X * 1000;
                camera.yCoordinate  = pointcloud.GetCamera(i).Y * 1000;
                camera.zCoordinate  = pointcloud.GetCamera(i).Z * 1000;

                for (int j = 0; j < 9; j++)
                {
                    tempRotationMatrix[j] = pointcloud.GetCamera(i).GetRotationMatrix(j);
                }
                camera.RotationMatrix = tempRotationMatrix;
                OptitrackCameraList.AddCamera(camera);
            }
        }
예제 #3
0
 private void buttonUpdateCameraList_Click(object sender, EventArgs e)
 {
     MotionCapture.UpdateCameraList();
     OptitrackCameraList.TransmitListOfCameras();
 }