Beispiel #1
0
        private void StickStateUpdater(StickState state)
        {
            stickStateControl.HeightAxis = state.Height;
            stickStateControl.YawAxis    = state.Yaw;
            stickStateControl.RollAxis   = state.Roll;
            stickStateControl.PitchAxis  = state.Pitch;
            if (_remoteControl)
            {
                if (_keyBoardEnabled)
                {
                    var roll  = _roll;
                    var pitch = _pitch;
                    var yaw   = _yaw;
                    var h     = _height;
                    _tello.SendRcCommand(roll, pitch, h, yaw);
                }
                else
                {
                    var roll  = Normalize(state.Roll, rollDead.Value);
                    var pitch = -Normalize(state.Pitch, pitchDead.Value);
                    var h     = -Normalize(state.Height, heightDead.Value);
                    var yaw   = Normalize(state.Yaw, yawDead.Value);
                    _tello.SendRcCommand(roll, pitch, h, yaw);
                }
            }
            MethodInvoker dele = delegate()
            {
                stickStateControl.Invalidate();
            };

            Invoke(dele);
        }