Drone
Main drone class reponsible for drone control. The class can initialize a drone connection with telnet on IP 192.168.1.1.
Drone class
- class dronevis.drone_connect.drone.Drone(ip_address='192.168.1.1')
Drone implementation for connecting, controlling, retrieving video stream from the drone using sockets
- __init__(ip_address='192.168.1.1')
Initialize ip and communication ports
- Parameters:
ip_address (str, optional) – IP of the drone. Defaults to “192.168.1.1”.
- connect_video(close_callback, operation_callback, model_name)
Initialize and start video thread
- disconnect_video()
Disconnect video stream
- connect()
Start communication thread to send control commands
- Raises:
ConnectionError – Lost connection to drone
ConnectionError – Cannot send commands to drone
- set_config(**kwargs)
Set a configuration onto the drone
See possibles arguments with
`list_config`- Raises:
AttributeError – raised when there is an invalid config
- Returns:
a flag that everything went fine
- Return type:
- forward(speed=0.2)
Make the drone go forward, speed is between 0 and 1
- backward(speed=0.2)
Make the drone go backward, speed is between 0 and 1
- left(speed=0.2)
Make the drone go left, speed is between 0 and 1
- upward(speed=0.2)
Make the drone rise in the air, speed is between 0 and 1
- downward(speed=0.2)
Make the drone descend, speed is between 0 and 1
- rotate_left(speed=0.8)
Make the drone turn left, speed is between 0 and 1
- rotate_right(speed=0.8)
Make the drone turn right, speed is between 0 and 1
- right(speed=0.2)
Make the drone go right, speed is between 0 and 1
Command the drone, all the arguments are between -1 and 1
- Parameters:
left_right (int, optional) – how much horizontal move (y-axis). Defaults to 0.
front_back (int, optional) – how much horizontal move (x-axis). Defaults to 0.
up_down (int, optional) – how much vertical move (z-axis). Defaults to 0.
angle_change (int, optional) – how much to change the angle. Defaults to 0.
- Returns:
a flag for valid execution
- Return type:
- stop()
Stop the drone
- set_callback(callback=None)
Set the callback function