protected virtual void OnGestureCommandRecognized(GestureCommandRecognizedEventArgs e) { if (GestureCommandRecognized != null) { GestureCommandRecognized(this, e); } }
private void OnGestureRecognized(object sender, GestureCommandRecognizedEventArgs e) { if (screenType == ScreenType.Drive) { switch (e.GestureCommand) { case KinectClient.GestureCommandType.Hover: if (lastCommandSent != CommandType.Hover) { kinectMessage = "Hover"; lastCommandSent = CommandType.Hover; droneClient.Progress(Drone.Commands.FlightMode.Progressive, 0, 0, 0, 0); } break; case KinectClient.GestureCommandType.StrafeLeft: if (lastCommandSent != CommandType.StrafeLeft) { lastCommandSent = CommandType.StrafeLeft; kinectMessage = "Strafe Left"; droneClient.Progress(Drone.Commands.FlightMode.Progressive, roll: -0.07f); } break; case KinectClient.GestureCommandType.StrafeRight: if (lastCommandSent != CommandType.StrafeRight) { kinectMessage = "Strafe Right"; lastCommandSent = CommandType.StrafeRight; droneClient.Progress(Drone.Commands.FlightMode.Progressive, roll: 0.07f); } break; case KinectClient.GestureCommandType.Forward: if (lastCommandSent != CommandType.Forward) { kinectMessage = "Forward"; lastCommandSent = CommandType.Forward; droneClient.Progress(Drone.Commands.FlightMode.Progressive, pitch: -0.1f); } break; case KinectClient.GestureCommandType.Backward: if (lastCommandSent != CommandType.Backward) { kinectMessage = "Backward"; lastCommandSent = CommandType.Backward; droneClient.Progress(Drone.Commands.FlightMode.Progressive, pitch: 0.1f); } break; case KinectClient.GestureCommandType.StrafeForwardLeft: if (lastCommandSent != CommandType.StrafeForwardLeft) { kinectMessage = "Strafe forward Left"; lastCommandSent = CommandType.StrafeForwardLeft; droneClient.Progress(Drone.Commands.FlightMode.Progressive, roll: -0.1f, pitch: 0.1f); } break; case KinectClient.GestureCommandType.StrafeForwardRight: if (lastCommandSent != CommandType.StrafeForwardRight) { kinectMessage = "Strafe forward Right"; lastCommandSent = CommandType.StrafeForwardRight; droneClient.Progress(Drone.Commands.FlightMode.Progressive, roll: 0.2f, pitch: 0.1f); } break; case KinectClient.GestureCommandType.StrafeBackwardLeft: if (lastCommandSent != CommandType.StrafeBackwardLeft) { kinectMessage = "Strafe backward Left"; lastCommandSent = CommandType.StrafeBackwardLeft; droneClient.Progress(Drone.Commands.FlightMode.Progressive, roll: -0.2f, pitch: -0.1f); } break; case KinectClient.GestureCommandType.StrafeBackwardRight: if (lastCommandSent != CommandType.StrafeBackwardRight) { kinectMessage = "Strafe backward Right"; lastCommandSent = CommandType.StrafeBackwardRight; droneClient.Progress(Drone.Commands.FlightMode.Progressive, roll: 0.2f, pitch: -0.1f); } break; case KinectClient.GestureCommandType.NoPlayerDetected: kinectMessage = "No player detected"; //here because the lastcommand can be Hover if (lastCommandSent != CommandType.Hover) { lastCommandSent = CommandType.Hover; droneClient.Progress(Drone.Commands.FlightMode.Progressive, 0, 0, 0, 0); } break; } OculusHandle(); //TODO: move from here and put it in its own event handler } }