Skip to content

About

A highly customizable, lightweight and safe Python framework for MAVLink routing. Break free from rigid routing tables and use dynamic Python callbacks to intercept, filter, modify, and route telemetry data exactly how your unique architecture demands!

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

PyMavRouter

PyMavRouter is a lightweight, thread-safe framework that gives you total control over your MAVLink network. Instead of forcing you into predefined routing topologies, it provides a blank canvas.

Whether you are connecting a swarm of vehicles to multiple servers, building a custom logging pipeline, or intercepting data for real-time analysis, PyMavRouter lets you write the rules.

The Custom Callback Advantage

The core of PyMavRouter is its callback-driven architecture. Every device you connect triggers a custom Python function when a message arrives. This allows you to:

  • Filter Traffic: Drop specific MAVLink messages before they congest your network.
  • Inspect & Modify: Read message IDs, target systems, or payload data to make complex routing decisions on the fly.
  • Broadcast or Isolate: Send data to a single specific endpoint, or broadcast it to a massive array of connected clients.

Key Capabilities

  • Endpoint Agnostic: Connect serial ports, TCP streams, or UDP endpoints interchangeably (and many more, see pymavlink documentation).
  • Built-in Thread Safety: Inject messages into the data stream safely from background processes or external scripts.
  • Dynamic Topology: Add or drop endpoints dynamically while the main routing loop continues to run without interruption.
  • Zero Overhead Routing: By default, the framework acts as a lightweight dispatcher. You only pay the computational cost for the specific logic you write.

Minimal Example

from mavrouter import MavDevice, MavRouter

# 1. Define your endpoints (Serial, TCP, UDP, etc.)
endpoint_a = MavDevice(address="/dev/ttyUSB0", listen_to=True)
endpoint_b = MavDevice(address="127.0.0.1:14550", listen_to=True, is_input=False)

# 2. Write your completely custom routing logic
def custom_logic_a(msg):
    # You decide exactly what happens to the message here!
    endpoint_b.send_msg(msg)
    
endpoint_a.set_callback(custom_logic_a)

# 3. Start the engine
router = MavRouter()
router.add_device(endpoint_a)
router.add_device(endpoint_b)
router.route_loop()

About

A highly customizable, lightweight and safe Python framework for MAVLink routing. Break free from rigid routing tables and use dynamic Python callbacks to intercept, filter, modify, and route telemetry data exactly how your unique architecture demands!

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages