private void ListenForJoystick() { JoyStickValues current = new JoyStickValues(0, 0, 0, 0); foreach (var joystickItem in JoyStickValuesQueue.GetConsumingEnumerable()) { current.throttle = joystickItem.throttle ?? current.throttle; current.roll = joystickItem.roll ?? current.roll; current.pitch = joystickItem.pitch ?? current.pitch; current.yaw = joystickItem.yaw ?? current.yaw; djiClient.SetJoyStickValue((float)current.throttle, (float)current.roll, (float)current.pitch, (float)current.yaw); } }
private void SetJoyStickValue(JoyStickValues newValues) { JoyStickValuesQueue.TryAdd(newValues); }