Example #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);
        }
    }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.T))
        {
            Tello.TakeOff();
        }
        else if (Input.GetKeyDown(KeyCode.L))
        {
            Tello.Land();
        }

        float lx = 0f;
        float ly = 0f;
        float rx = 0f;
        float ry = 0f;

        if (Input.GetKey(KeyCode.UpArrow))
        {
            ry = 1;
        }
        if (Input.GetKey(KeyCode.DownArrow))
        {
            ry = -1;
        }
        if (Input.GetKey(KeyCode.RightArrow))
        {
            rx = 1;
        }
        if (Input.GetKey(KeyCode.LeftArrow))
        {
            rx = -1;
        }
        if (Input.GetKey(KeyCode.W))
        {
            ly = 1;
        }
        if (Input.GetKey(KeyCode.S))
        {
            ly = -1;
        }
        if (Input.GetKey(KeyCode.D))
        {
            lx = 1;
        }
        if (Input.GetKey(KeyCode.A))
        {
            lx = -1;
        }
        Tello.controllerState.SetAxis(lx, ly, rx, ry);
    }
Example #3
0
 private void BtnTakeOff_Click(object sender, EventArgs e)
 {
     _tello.TakeOff();
 }