Skip to main content

A Python tool for measuring round-trip time (RTT) using the MAVLink TIMESYNC protocol

Project description

MAVPing

Test and Build
Publish to PyPI

A Python tool for measuring round-trip time (RTT) using the MAVLink TIMESYNC protocol. This tool uses sends TIMESYNC messages and calculates the latency between your system and a MAVLink-compatible device. It is built using the pymavlink library.

Features

  • TIMESYNC Protocol: Uses MAVLink's built-in timesync protocol for accurate timing
  • Multiple Connection Types: Support for both serial and UDP connections
  • Comprehensive Statistics: Provides min, max, mean, median, and standard deviation of RTT
  • Configurable Parameters: Adjustable ping count, interval, and timeout
  • Error Handling: Robust error handling with detailed failure reporting

Installation

pip install mavping

Manual installation

  1. Clone this repro

    git clone https://github.com/krausemann/mavping.git
    
  2. Install Python dependencies:

    pip install -r requirements.txt
    
  3. Verify .MAVLink installation:

    python -c "import pymavlink; print('MAVLink installed successfully')"
    
  4. Run mavping

    python src/mavping/mavping.py -h
    

Usage

Serial Connection

Connect to a device via serial port:

mavping --port /dev/ttyUSB0

UDP Connection

Connect to a device via UDP (e.g., for SITL or network-connected devices):

mavping --udp 192.168.1.100:14550

Command Line Options

  • --port: Serial port (e.g., /dev/ttyUSB0, COM3)
  • --baud: Baud rate for serial connection (default: 115200, optional)
  • --udp: UDP address:port (e.g., 192.168.1.100:14550)
  • --target-system: Target system ID (default: auto-detect)
  • --target-component: Target component ID (default: auto-detect)
  • --count: Number of pings to send (default: 10)
  • --interval: Interval between pings in seconds (default: 1.0)
  • --timeout: Timeout for each ping in seconds (default: 5.0)
  • --verbose: Enable verbose output for debugging

Output Example

Connected to system 1, component 1 (Fixed wing aircraft.)
Starting 10 pings with 1.0s interval...
Ping #1: 3.96ms
Ping #2: 7.47ms
...

==================================================
PING STATISTICS
==================================================
Total pings: 10
Successful: 10
Failed: 0
Success rate: 100.0%

RTT Statistics (ms):
  Min: 3.96
  Max: 7.67
  Mean: 6.56
  Median: 6.58
  Std Dev: 1.15
==================================================

Requirements

  • Python 3.7+
  • pymavlink >= 2.4.37
  • pyserial >= 3.5

License

mavping is released under MIT License. It was created with assistance from Cursor IDE, using an unspecified reasoning model. Parts of it might resemble other software which was used to train the model. It was not possible to verify possible copyright violations. Kindly contact the author in case you think your copyright is violated.

Repository

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

mavping-0.1.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mavping-0.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file mavping-0.1.0.tar.gz.

File metadata

  • Download URL: mavping-0.1.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for mavping-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b296465887210250a06004c665aa8947e369d65cbe1178cd8cafe2c1d864bc88
MD5 b4c7b7e92148f08b8c7c645e26908591
BLAKE2b-256 41dd66f8fab4132ef1ef32ef51fdf47dcb894cd7526dc578ed6a3f34f556fa7b

See more details on using hashes here.

File details

Details for the file mavping-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mavping-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for mavping-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 30a9454ca4d2878736bac6e8aa62c51b566457f6bc15bedcea240dd5e2b38bfc
MD5 0b24046be77af652288c530f15a7315e
BLAKE2b-256 86a1da811a136ad2d24df7df4392c5120b56d199944723e5db9bbc5b8dfd12c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page