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.0.0.tar.gz (22.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.0.0-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dronemaster-1.0.0.tar.gz
  • Upload date:
  • Size: 22.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.0.0.tar.gz
Algorithm Hash digest
SHA256 77c85326bf583f1f2d77ed43c76f2fb2c8c3dc39f42d16a9f0b3c4ba9408ecf6
MD5 b530f5a5de755a01d7e93c7c971b56c3
BLAKE2b-256 bfd1f9199d71c43a0c6a01e91857e502eace3aaaaf4ba8697ffa910a63e1fb8c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dronemaster-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 21.4 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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6da16d451838ae78e2141324660588f084b53b62b5a971aea04425c78a87829d
MD5 2918111bff566522cd2b3432fe3462a6
BLAKE2b-256 e7615d9b3b4e73eddb3d2edd6694d6a81fc741b08838878c8b738e0b65748c56

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