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 (seedronemaster.DroneState)drone.serial_number()to get the serial numberdrone.battery()to get the current battery chargedrone.tof()to read the current heightdrone.ext_tof()to read the distance forwardsdrone.keepalive()call this to keep the drone in the air without sending other commandsdrone.reboot()reboot the drone and disconnect itdrone.matrix.set_brightness(...)set the brightness of the led matrixdrone.matrix.set_pattern(...)to set the pattern of the led matrixdrone.rgb.set(...)sets the color of the top leddrone.rgb.pulse(..., ...)pulses the top led in the specific colordrone.rgb.flash(..., ..., ...)flashed the top led between the two colorsdrone.video.streamon()to enable the video streamdrone.video.streamoff()to stop the video streamdrone.video.downvision(...)to switch the used cameradrone.video.setfps(...)to set the cameras fpsdrone.video.setbitrate(...)to set the cameras bitrate in Mbpsdrone.video.setresolution(...)to set the front-facing cameras resolutiondrone.flight.takeoff()to takeoffdrone.flight.land()to landdrone.flight.rc(..., ..., ..., ...)to set roll, pitch, yaw and throttledrone.flight.stop()to stop moving and start hoveringdrone.flight.emergency()to stop all motors
and many more...
Simulator
to simulate a simple drone, run python3 -m dronemaster in a seperate terminal and make a drone listen on your local ip (eg. 127.0.0.1)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dronemaster-1.1.1.tar.gz.
File metadata
- Download URL: dronemaster-1.1.1.tar.gz
- Upload date:
- Size: 24.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af50ecfcffbd4b948f50fa2fc981e6ecfea6b18a6f9af36659dccbf8e8ac3813
|
|
| MD5 |
a4bbc800fee02f04da246a8f837be72d
|
|
| BLAKE2b-256 |
d70a3abb50f866bc1c30e747a337cb4a60a74e141b827e00e486f609537e9020
|
File details
Details for the file dronemaster-1.1.1-py3-none-any.whl.
File metadata
- Download URL: dronemaster-1.1.1-py3-none-any.whl
- Upload date:
- Size: 24.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89dc222d1d7986e3cc3c94932f933de08a5f229a8d23efcc80a1fd3fed5c4c49
|
|
| MD5 |
2f64c93e883a6e35452570c7b43b9fcf
|
|
| BLAKE2b-256 |
c578758a5994c317f1227ba7b450cfa6213cea79d7e63f00838a62813bf1fe43
|