A tidy way to talk to a Drone through PyMavLink
Project description
This project will contain an opinionated but tidy way to talk to a Drone through PyMavLink using the PyFlightCoach Libraries
Setup the connection:
from droneinterface import Vehicle
vehicle = Vehicle.connect('tcp:127.0.0.1:5762')
Get a single mavlink message wrapped in a pyflightcoach wrapper:
>>> vehicle.get_GlobalPositionInt()
GlobalPositionInt(
position=GPS(lat_=51.42 long_=-2.67 alt_=117.33, len=1),
agl=0.055,
velocity=Point(x_=-0.02 y_=-0.01 z_=0.0, len=1),
heading=13.95565269894666,
time_boot_ms=1840783
)
wait up to 1 second for a message:
>>> vehicle.next_heartbeat(1).type
MAV_TYPE(1=['mav_type_generic', 'mav_type_fixed_wing'])
Don't wait long enough:
>>> vehicle.next_heartbeat(1e-6)
droneinterface.scheduling.exceptions.Timeout: timeout after 1e-06 seconds waiting for message 0
Getting a pyflightcoach state object (combines 3 mavlink messages):
>>> vehicle.get_state().data
x y z rw rx ry rz t dt ... p q r du dv dw dp dq dr
0.0 -0.006941 -0.022264 0.01 -0.012416 0.989064 0.080289 0.123095 1.709667e+09 0.033333 ... -0.006507 -0.022492 0.00954 -0.567203 -1.919822 997.321415 0.0 0.0 0.0
[1 rows x 21 columns]
>>>
subscribing to a higher messaging rate:
with vehicle.subscribe(vehicle.state.ids, 10):
print(vehicle.next_state().data)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
droneinterface-0.0.4.tar.gz
(14.3 kB
view details)
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 droneinterface-0.0.4.tar.gz.
File metadata
- Download URL: droneinterface-0.0.4.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
306ebcd8e44c972cf373cd8a6e22e299900d322619a0259ad2a8ead3ca59579f
|
|
| MD5 |
cf7a6f4331d8a411042b378f21453d74
|
|
| BLAKE2b-256 |
f0478bb11809f4fa210e0a9c5ecee7a11adad2679f8194965b6aab43dfa87990
|
File details
Details for the file droneinterface-0.0.4-py3-none-any.whl.
File metadata
- Download URL: droneinterface-0.0.4-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f72a484d9287654c1de4c629307c9bacaba931d3637197b661be8feb10a4f79
|
|
| MD5 |
725b83359b6a4247af41feeca14b2b67
|
|
| BLAKE2b-256 |
a6b1d674445d17879ab9c220a4f56d6b19302eef7ace6f5e85388684e5f41136
|