Exemplo n.º 1
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Return))
        {
            if (Tello.state.flying)
            {
                Debug.Log("Landing");
                Tello.Land();
            }
            else
            {
                if (Tello.state.batteryLower)
                {
                    Debug.LogError("Battery too low for take off");
                    return;
                }

                if (Tello.state.batteryLow)
                {
                    Debug.LogWarning("Battery low");
                }

                Debug.Log("Taking off");
                Tello.TakeOff();
            }
        }

        if (Tello.ConnectionState == ConnectionState.Connected && Tello.state.flying)
        {
            Tello.controllerState.SetAxis(Input.GetAxis("Rotate") * droneSpeed / 100, Input.GetAxis("Levitate") * droneSpeed / 100, Input.GetAxis("LRTranslate") * droneSpeed / 100, Input.GetAxis("FBTranslate") * droneSpeed / 100);
            Tello.SetMaxHeight(height);
        }
    }
Exemplo n.º 2
0
    private void Tello_onConnection(TelloLib.ConnectionState newState)
    {
        //throw new System.NotImplementedException();
        //Debug.Log("Tello_onConnection : " + newState);
        if (newState == TelloLib.ConnectionState.Connected)
        {
            Tello.QueryAttAngle();
            Tello.SetMaxHeight(50);

            Tello.SetPicVidMode(1);             // 0: picture, 1: video
            Tello.SetVideoBitRate((int)VideoBitRate.VideoBitRateAuto);
            //Tello.setEV(0);
            Tello.RequestIframe();
        }
    }