High Level API¶
The ARDrone Object¶
- class pyardrone.ARDrone(*, host='192.168.1.1', at_port=5556, navdata_port=5554, video_port=5555, watchdog_interval=0.5, timeout=0.01, bind=True, connect=True)[source]¶
The class representing a Parrot AR.Drone
- Parameters:
host – address of the drone
at_port – AT command port
navdata_port – NavData port
video_port – Video port
control_port – Control port
watchdog_interval – seconds between each
COMWDG
sent in backgroundbind – whether to
bind()
the sockets; this option exists for testingconnect – connect to the drone at init
- takeoff()¶
Sends the takeoff command.
- land()¶
Sends the land command.
- hover()¶
Sends the hover command.
- move(*, forward=0, backward=0, left=0, right=0, up=0, down=0, cw=0, ccw=0)¶
Moves the drone.
To move the drone forward at 0.8x speed:
>>> drone.move(forward=0.8)
To move the drone right at 0.5x speed and upward at full speed:
>>> drone.move(right=0.5, up=1)
To rotate clockwise at 0.7x speed:
>>> drone.move(cw=0.7)
- Parameters:
forward – speed for moving forward
backward – speed for moving backward
left – speed for moving left
right – speed for moving right
up – speed for moving up
down – speed for moving down
cw – speed for rotating clockwise
ccw – speed for rotating counter-clockwise
A
threading.Event
indicating whethernavdata
andstate
is ready.drone.navdata_ready.is_set() # bool: whether navdata is ready drone.navdata_ready.wait() # wait until navdata is ready
Latest
NavData
from drone.This is an attribute which gets updated each time the drone sends navdata back to the computer.
See also
- state¶
The latest state from
NavData
.>>> drone.state.fly_mask True # drone is flying >>> drone.state.video True # video is enabled
See
DroneState
for the full list of states.Latest
DroneState
from drone.
Video Support¶
The following functions are available to the ARDrone
class
if opencv 3.0 (cv2) is installed.
- class pyardrone.video.VideoMixin[source]¶
Mixin of ARDrone that provides video functionality
- property frame¶
The latest frame from ARDrone, in opencv’s format.
- property video_ready¶
A
threading.Event
object indicating whether video is ready.