MRT Autopilot Python3 API
This repository contains the Python3 API for the MRT Autopilot.
Installation
pip3 install mrtautopilot
Usage
Example usage:
#!/usr/bin/env python3
import logging
import selectors
import mrtautopilot
# example for send_protobuf_proxy
from mrtproto import autopilot_pb2
PROTO_ID = 0x5433 # defined by protocol
def main():
mavlink = mrtautopilot.MavlinkThread()
proto = autopilot_pb2.VehicleData()
proto.position.latitude_deg = 38.3
proto.position.longitude_deg = -77.1
def got_low_bandwidth():
d: mrtautopilot.LowBandwidth = mavlink.low_bandwidth_queue.get_nowait()
logging.info(f"Got Vehicle Data: {d.latitude_deg}, {d.longitude_deg}")
try:
sel = selectors.DefaultSelector()
sel.register(
mavlink.low_bandwidth_queue_fileobj,
selectors.EVENT_READ,
got_low_bandwidth,
)
count = 0
mavlink.start()
while True:
mavlink.send_heartbeat()
count += 1
if count == 5:
mavlink.send_protobuf_proxy(PROTO_ID, proto.SerializeToString())
if count == 6:
m = mrtautopilot.mission
mavlink.send_mission(
m.Mission(
fault_config=m.FaultConfig(
fault_responses={},
loiter_radius_m=30,
loiter_duration_s=365 * 24 * 60 * 60,
response_speed_mps=3,
),
rally_points=[],
fence=[],
mission_items=[
m.Waypoint(lat_deg=38.31, lon_deg=-77.02, speed_mps=6),
m.Waypoint(lat_deg=38.31, lon_deg=-77.00, speed_mps=6),
m.Waypoint(lat_deg=38.34, lon_deg=-77.00, speed_mps=7),
m.DriftLoiter(
lat_deg=38.34, lon_deg=-77.00, speed_mps=3, radius_m=50
),
],
)
)
if count == 10:
mavlink.set_motor_enablement(True)
mavlink.send_waypoint(38.3, -77.1, 3.0)
if count == 20:
mavlink.set_motor_enablement(False)
mavlink.send_autopilot_stop()
for key, mask in sel.select():
key.data()
finally:
mavlink.stop()
def setup_logging():
logging.basicConfig(
format="%(asctime)s.%(msecs)03d | %(threadName)s | %(levelname)8s | %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
)
logger = logging.getLogger()
logger.setLevel(logging.INFO)
if __name__ == "__main__":
setup_logging()
try:
main()
except KeyboardInterrupt:
pass
Metadata
Release files for mrtautopilot 7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mrtautopilot-7.tar.gz | 13.7 kB | Without provenance | Details for mrtautopilot-7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mrtautopilot-7-py3-none-any.whl | Python 3 | none | any | Details for mrtautopilot-7-py3-none-any.whl |
Total release size: 25.2 kB
Release files / mrtautopilot-7.tar.gz
| Download URL | mrtautopilot-7.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fa88f33742427ec5416d1091463fbe0c019abaca9e04d0374b7831777c38bd69
|
|
BLAKE2b-256 checksum How to use checksums |
95dbae2a3c046ef43ced582fb496788913b6d05a7d69fe9bb162e465f7bfb81f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Release files / mrtautopilot-7-py3-none-any.whl
| Download URL | mrtautopilot-7-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5ee0d9c0ed454da688adce682b0e93b9a4c6b78895f1d44bf7441d11f579398
|
|
BLAKE2b-256 checksum How to use checksums |
6d2894334e51992cfb7c95fc2b223acfe38bbcaa99673f2a3946dca0987985ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Security for mrtautopilot 7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.