@@ -2,26 +2,44 @@ Getting Started:
22----------------
33
44``` python
5- >> > import libardrone
6- >> > drone = libardrone .ARDrone()
5+ >> > from libardrone import ardrone
6+ >> > drone = ardrone .ARDrone()
77>> > # You might need to call drone.reset() before taking off if the drone is in
88>> > # emergency mode
99>> > drone.takeoff()
1010>> > drone.land()
1111>> > drone.halt()
1212```
1313
14- The drone's property ` image ` contains always the latest image from the camera.
15- At present this is in the format of a numpy array with dimensions (width, height, 3).
16- This may change in future.
14+ Using the drone's function ` get_image() ` you can get the latest image from the camera.
15+ At present this is in the format of a numpy array with dimensions (width, height, 3) that can be used e.g. in opencv:
16+
17+
18+ ``` python
19+ >> > import cv2
20+ >> > cv2.namedWindow(' image' , cv2.WINDOW_AUTOSIZE )
21+ >> > while True :
22+ >> > # get image data as numpy array
23+ >> > img = drone.get_image()
24+ >> > # show image using opencv
25+ >> > cv2.imshow(" image" , cv2.cvtColor(img, cv2.COLOR_BGR2RGB ))
26+ >> > if cv2.waitKey(1 ) & 0x FF == ord (' q' ): # press 'q' to quit
27+ >> > break
28+ ```
29+
1730The drone's property ` navdata ` contains always the latest navdata.
31+ You can for example get the current battery charge from that:
1832
33+ ```
34+ >>> bat = drone.navdata.get(0, dict()).get('battery', 0)
35+ >>> print('Battery: %i%%' % bat)
36+ ```
1937
20- Demo:
21- -----
38+ Demo (pygame) :
39+ --------------
2240
2341There is also a demo application included which shows the video from the drone
24- and lets you remote-control the drone with the keyboard:
42+ and lets you remote-control the drone with the keyboard (you need pygame for it to work) :
2543
2644 RETURN - takeoff
2745 SPACE - land
@@ -52,7 +70,7 @@ Requirements:
5270
5371This software was tested with the following setup:
5472
55- * Python 2.7.6
73+ * Python 2.7.13
5674 * Unmodified AR.Drone firmware 2.0
5775
5876
@@ -62,4 +80,3 @@ License:
6280This software is published under the terms of the MIT License:
6381
6482 http://www.opensource.org/licenses/mit-license.php
65-
0 commit comments