Ejemplo n.º 1
0
 private void DroneTakeOff()
 {
     droneClient.FlatTrim();//before take off send this command
     headPositionStart = OculusClient.GetOrientation();
     if (lastCommandSent != CommandType.TakeOff)
     {
         droneClient.Takeoff();
         lastCommandSent = CommandType.TakeOff;
     }
 }
Ejemplo n.º 2
0
        //head dx, sx, up, down
        private void OculusHandle()
        {
            oculusXText = "On Hold";
            oculusYText = "On Hold";
            var cameraPositionNew = OculusClient.GetOrientation();
            var delta             = headPositionStart.X - cameraPositionNew.X;
            var compare           = delta;

            if (delta < 0)
            {
                delta *= -1;
            }
            if (delta >= xThreshold)
            {
                if (compare > 0)
                {
                    oculusXText = "Right";
                    if (lastCommandSent != CommandType.TurnRight)
                    {
                        lastCommandSent = CommandType.TurnRight;
                        droneClient.Progress(Drone.Commands.FlightMode.Progressive, yaw: 0.4f);
                    }
                }
                else
                {
                    oculusXText = "Left";
                    if (lastCommandSent != CommandType.TurnLeft)
                    {
                        lastCommandSent = CommandType.TurnLeft;
                        droneClient.Progress(Drone.Commands.FlightMode.Progressive, yaw: -0.4f);
                    }
                }
                return;
            }
            delta   = headPositionStart.Y - cameraPositionNew.Y;
            compare = delta;
            if (delta < 0)
            {
                delta *= -1;
            }
            if (delta >= yThreshold)
            {
                if (compare > 0)
                {
                    oculusYText = "Up";
                    if (lastCommandSent != CommandType.GoUp)
                    {
                        lastCommandSent = CommandType.GoUp;
                        droneClient.Progress(Drone.Commands.FlightMode.Progressive, gaz: 0.4f);
                    }
                }
                else
                {
                    oculusYText = "Down";
                    if (lastCommandSent != CommandType.GoDown)
                    {
                        lastCommandSent = CommandType.GoDown;
                        droneClient.Progress(Drone.Commands.FlightMode.Progressive, gaz: -0.4f);
                    }
                }
            }
        }