Skip to main content

A modern alternative to the robomaster SDK

Project description

Dronemaster

a modern alternative to the Robomaster SDK for controlling DJI Tello EDU drones.

Api overview

This SDK only allows controlling one drone at a time.
To get started, create a dronemaster.Drone object an pass it the drones ip.
Before doing anything else, you have to call and await the drones initialize method to connect to the drone.
After establishing the connection, you can use many features like:

  • drone.state_subscribe(...) to subscribe to the drones state (see dronemaster.DroneState)
  • drone.serial_number() to get the serial number
  • drone.battery() to get the current battery charge
  • drone.tof() to read the current height
  • drone.ext_tof() to read the distance forwards
  • drone.keepalive() call this to keep the drone in the air without sending other commands
  • drone.reboot() reboot the drone and disconnect it
  • drone.matrix.set_brightness(...) set the brightness of the led matrix
  • drone.matrix.set_pattern(...) to set the pattern of the led matrix
  • drone.rgb.set(...) sets the color of the top led
  • drone.rgb.pulse(..., ...) pulses the top led in the specific color
  • drone.rgb.flash(..., ..., ...) flashed the top led between the two colors
  • drone.video.streamon() to enable the video stream
  • drone.video.streamoff() to stop the video stream
  • drone.video.downvision(...) to switch the used camera
  • drone.video.setfps(...) to set the cameras fps
  • drone.video.setbitrate(...) to set the cameras bitrate in Mbps
  • drone.video.setresolution(...) to set the front-facing cameras resolution
  • drone.flight.takeoff() to takeoff
  • drone.flight.land() to land
  • drone.flight.rc(..., ..., ..., ...) to set roll, pitch, yaw and throttle
  • drone.flight.stop() to stop moving and start hovering
  • drone.flight.emergency() to stop all motors
    and many more...

Examples

Find all examples on GitHub in the examples directory.

Simple flight

...
# create the drone, but don't connect
ep_drone = dronemaster.Drone("192.168.10.1")

# mark the drone as active and connect to it
await ep_drone.initialize()

serial = await ep_drone.serial_number()
battery = await ep_drone.battery()
print(f"Connected with drone '{serial}' with {battery}%")

ep_flight = ep_drone.flight

# takeoff and wait for completion (up to 20s)
await ep_flight.takeoff()

# fly forwards 20cm
await ep_flight.forward(20, timeout=7)

# land again
await ep_flight.land()
...

Receiving the status

...
async def printState(state: dronemaster.DroneState):
    print(state) # {'pitch': 0, 'roll': 0, 'yaw': 35, 'vgx': 0, 'vgy': 0, 'vgz': 0, 'templ': 67, 'temph': 70, 'tof': 10, 'h': 0, 'bat': 81, 'baro': 516.17, 'time': 27, 'agx': 5.0, 'agy': 4.0, 'agz': -1000.0, 'last_update': 1781868417.0927145, 'delta': 0.027984142303466797}

# create the drone, but don't connect
ep_drone = dronemaster.Drone("192.168.10.1")

# mark the drone as active and connect to it
await ep_drone.initialize()

serial = await ep_drone.serial_number()
battery = await ep_drone.battery()
print(f"Connected with drone '{serial}' with {battery}%")

ep_drone.state_subscribe(printState)

await asyncio.sleep(5)
...

Receiving the video stream

...
# create the drone, but don't connect
ep_drone = dronemaster.Drone("192.168.10.1")

# mark the drone as active and connect to it
await ep_drone.initialize()

serial = await ep_drone.serial_number()
battery = await ep_drone.battery()
print(f"Connected with drone '{serial}' with {battery}%")

await ep_drone.video.streamon()

# uncomment to use the downwards black and white camera
#await ep_drone.video.downvision(True)

# listen on all ips on port 11111
cap = cv2.VideoCapture("udp://0.0.0.0:11111")

while True:
    if cap.isOpened():
        ret, frame = cap.read()
        cv2.imshow('live stream', frame)
        await asyncio.sleep(1/60) # important to allow the sdk to read new commands
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break

cap.release()
cv2.destroyAllWindows()

ep_drone.reboot()
...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dronemaster-1.1.0.tar.gz (24.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dronemaster-1.1.0-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file dronemaster-1.1.0.tar.gz.

File metadata

  • Download URL: dronemaster-1.1.0.tar.gz
  • Upload date:
  • Size: 24.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for dronemaster-1.1.0.tar.gz
Algorithm Hash digest
SHA256 167a74136a753b97a5fe507ca35c76fb8d218bf92a1312a9fb99629595eb59da
MD5 51c57c773d141dfa5e28da66777b0a19
BLAKE2b-256 4fc91cd4b0a8ab4b8d201d7be0b2df573c078e12954e03f505e89dc09826c97c

See more details on using hashes here.

File details

Details for the file dronemaster-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: dronemaster-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for dronemaster-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e16aeb6dbb4859744be2c894cd9935a43c137341259f21a43588725221e1c0ff
MD5 44c33cd68e970e9966fc0bf69bb3297b
BLAKE2b-256 1ab3de7d36997ec81064921f2f88267e5b0df72f17977f3e4fa8d8f15303b81b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page