Skip to main content

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

# example for send_protobuf_proxy
from mrtproto import autopilot_pb2

import mrtautopilot

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}, has control: {mavlink.has_control()}"
        )

    try:
        sel = selectors.DefaultSelector()
        sel.register(
            mavlink.low_bandwidth_queue_fileobj,
            selectors.EVENT_READ,
            got_low_bandwidth,
        )

        count = 0
        mavlink.start()
        while True:
            if mavlink.has_control():
                mavlink.send_heartbeat()

            count += 1

            if count == 3:
                mavlink.send_take_control()

            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()

            if count == 25:
                mavlink.send_autopilot_manual_mode()

            if count > 25:
                # z = thrust, # r = rudder, 0=%0, 1000=100%
                mavlink.send_manual_control(z=100, r=100)

            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 15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mrtautopilot 15
File Size Uploaded Provenance Actions
mrtautopilot-15.tar.gz 17.4 kB With provenance Details for mrtautopilot-15.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mrtautopilot 15
File Interpreter ABI Platform Actions
mrtautopilot-15-py3-none-any.whl Python 3 none any Details for mrtautopilot-15-py3-none-any.whl

Total release size: 31.2 kB

Release files / mrtautopilot-15.tar.gz

Download URL mrtautopilot-15.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4da187f05e8a067697c9a78af55d8c94a5a73fafdb2e21086954c1bc0be3b21e
BLAKE2b-256 checksum
How to use checksums
5a0b6e5eb9c505e4686b266bed0cc262b4cd6893c7a676c137c57ad6f3725114
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / mrtautopilot-15-py3-none-any.whl

Download URL mrtautopilot-15-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f75566caaf46ff68da76e0435b330368ca61bdab711cb947b8cd795528d888a
BLAKE2b-256 checksum
How to use checksums
7e2c256c649ab3d42693ad3d8dcb690f7c5f7c64952684cef0a848f9c6b162c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Security for mrtautopilot 15

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mrtautopilot-15.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page