title: Tello Edu Drone: How to Capture Image with Python Codes
body: <p>I am a beginner learning to program a drone, called Tello. I am trying to capture an image with it. </p>
  
  <p>I have got <a href="https://terra-1-g.djicdn.com/2d4dce68897a46b19fc717f3576b7c6a/Tello%20%E7%BC%96%E7%A8%8B%E7%9B%B8%E5%85%B3/For%20Tello/Tello%20SDK%20Documentation%20EN_1.3_1122.pdf" rel="nofollow noreferrer">the manual</a>. </p>
  
  <p>In the manual, there is no option for capturing image with the drone. Only recording video is mentioned there. How can I capture the image with Python codes with the drone?</p>
  
  <p>Here are the codes of <code>tello.py</code> file:</p>
  
  <pre><code># This code is adopted from https://learn.droneblocks.io/p/tello-drone-programming-with-python/
  # Import the necessary modules
  import socket
  import threading
  import time
  
  
  class Tello():
  
      def __init__(self):
          # IP and port of Tello
          self.tello_address = ('192.168.10.1', 8889)
  
          # IP and port of local computer
          self.local_address = ('', 9000)
  
          # Create a UDP connection that we'll send the command to
          self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  
          # Bind to the local address and port
          self.sock.bind(self.local_address)
  
          # Create and start a listening thread that runs in the background
          # This utilizes our receive functions and will continuously monitor for incoming messages
          self.receiveThread = threading.Thread(target=self.receive)
          self.receiveThread.daemon = True
          self.receiveThread.start()
  
      # Send the message to Tello and allow for a delay in seconds
      def send(self, message, delay):
          # Try to send the message otherwise print the exception
          try:
              self.sock.sendto(message.encode(), self.tello_address)
              print("Sending message: " + message)
          except Exception as e:
              print("Error sending: " + str(e))
  
          # Delay for a user-defined period of time
          time.sleep(delay)
  
      # Receive the message from Tello
      def receive(self):
          # Continuously loop and listen for incoming messages
          while True:
              # Try to receive the message otherwise print the exception
              try:
                  response, ip_address = self.sock.recvfrom(128)
                  print("Received message: " + response.decode(encoding='utf-8'))
              except Exception as e:
                  # If there's an error close the socket and break out of the loop
                  self.sock.close()
                  print("Error receiving: " + str(e))
              break
  </code></pre>
  
  <p>Here are the codes of <code>flight1.py</code> file:</p>
  
  <pre><code>import tello
  
  # Billy
  billy = tello.Tello()
  
  # Each leg of the box will be 100 cm. Tello uses cm units by default.
  box_leg_distance = 100
  
  # Yaw 90 degrees
  yaw_angle = 90
  
  # Yaw clockwise (right)
  yaw_direction = "ccw"
  
  # Put Tello into command mode
  billy.send("command", 3)
  
  
  # Send the takeoff command
  billy.send("takeoff", 5)
  
  # Fly box pattern
  billy.send("forward " + str(box_leg_distance), 4)
  billy.send("ccw " + str(yaw_angle), 3)
  billy.send("forward " + str(box_leg_distance), 4)
  billy.send("ccw " + str(yaw_angle), 3)
  billy.send("forward " + str(box_leg_distance), 4)
  billy.send("ccw " + str(yaw_angle), 3)
  billy.send("forward " + str(box_leg_distance), 4)
  billy.send("ccw " + str(yaw_angle), 3)
  billy.send("forward " + str(box_leg_distance), 4)
  billy.send("ccw " + str(yaw_angle), 3)
  
  # Special : Flip backwards
  billy.send("flip b ", 4)
  
  # Send the land command
  billy.send("land ", 4)
  
  
  
  # Print message
  print("Mission completed successfully!")
  
  # Close the socket
  billy.sock.close()
  </code></pre>
  
  <p>What should I do to capture an image with the drone?</p>