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.1.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.1-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dronemaster-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 54103388358b16888e09264b3ace808ceeb767a9ec42c5af44e2af406a589878
MD5 893eb7da18fb6da47e4d22ac83951cdd
BLAKE2b-256 74430d10a68762b58804ffdd5af0e093b931980219fbd11c50d90af93fa5cb3c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dronemaster-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 21.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a61f565989e98a35357d961481b05a503ecd13949ef00a2a7ae987c8ce0e1fe1
MD5 9c7872ddbcdfe92b378ad8e27b44cfaf
BLAKE2b-256 9ef080a27c87213b7fbf590ad8896d27cffb69de31f99e0bfe2e3dfa254edf78

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