Skip to content

Tutorial 00: Random Fly

SakuraSakura edited this page Oct 18, 2018 · 4 revisions

In this tutorial, we will show you how to use VIVID Python API to control your drone.
Suppose you have selected a scene and Vivid Drone as your vehicle:

Let's do a random fly first. First, make sure you have Python installed in your environment.

$ git clone https://github.com/kuanting/vivid.git
$ pip install msgpack-rpc-python   ### install Python RPC library
$ cd python_example/00_random_fly/
$ python random_fly.py

The drone will start to fly frenziedly.

The source code of random_fly.py is provided below. First we use VividClient to connect to our environment: client = VividClient(ip="127.0.0.1", port=16612)

Then we use moveByDistance() to fly our drone, isHit() to check if the drone has hit an obstacle, and turnByDegree() to make random turns when we hit an obstacle.

Python Example

The python example is provided here.

Clone this wiki locally