Skip to main content

Multi-Robot Data Animation & Plotting Assistance

Project description

mr-dapa — Multi-Robot Data Animation & Plotting Assistance

Rapid visualization of multi-agent time-series data. Researchers have N robots' timestamped data and need to quickly generate static plots and animations.

Quick Start

pip install mr-dapa
python examples/minimal/generate_data.py
python examples/minimal/main.py

API Overview

import mr_dapa as mrdp

components = {
    'x': {'title': 'X Position', 'class': 'LinesComponent', 'keys': ['x']},
    'map': {'title': 'Map', 'class': 'MapComponent', 'limits': {"x": [-3, 7], "y": [-3, 7]}},
}

# Static plot — returns figure (no file saved)
fig = mrdp.StaticGlobalPlotDrawer(files=['data.json'], components=components).draw(['x', 'map'])

# Chain API for filtering
mrdp.StaticGlobalPlotDrawer(files=['data.json'], components=components) \
    .set_id_list([1, 3]) \
    .set_time_range((0.2, 0.5)) \
    .draw(['x'], save=True)                # save=True writes to file

# Animation
mrdp.AnimationDrawer(files=['data.json'], components=components) \
    .draw(['x', 'map'], time_ratio=2, save=True)

Draw Modes

Drawer Behavior
StaticGlobalPlotDrawer All robots in shared subplots
StaticSeparatePlotDrawer One figure per robot
StaticGroupPlotDrawer All robots, per-robot subplots in one figure
AnimationDrawer Time-based MP4 animation

Components

Component Description
LinesComponent Time-series line plots
MapComponent 2D position map with trails
ScatterComponent Scatter/phase plot (x vs y)
FillComponent Filled area between values
HeatmapComponent 2D density heatmap
Map3DComponent 3D position map with trajectories
SearchHeatmapComponent First-search-time grid heatmap
PairDistanceComponent Inter-robot distance and safety/communication range plots

Adapters

from mr_dapa import CSVAdapter, MultiFileAdapter, NumPyAdapter, SimulationLogAdapter, ParametricStudyAdapter

loader = mrdp.StaticGlobalPlotDrawer(files=['data.csv'], components=components, adapter=CSVAdapter())
loader = mrdp.StaticGlobalPlotDrawer(files=['r1.json', 'r2.json'], components=components, adapter=MultiFileAdapter())
loader = mrdp.StaticGlobalPlotDrawer(files=['sim/data.json'], components=components, adapter=SimulationLogAdapter())
loader = mrdp.StaticGlobalPlotDrawer(files=['summary.json'], components=components, adapter=ParametricStudyAdapter())

SimulationLogAdapter is for frame-based simulation logs with state[*].runtime and state[*].robots[*]. It extracts robot state, control inputs, CBF-like metric dictionaries, link-denial metrics, and global search coverage so existing line/map components can plot real simulation runs quickly.

ParametricStudyAdapter is for parameter sweep summaries with a parametric_study object. It maps parameter values onto the canonical x-axis and exposes metrics such as final_coverage and duration for comparison plots.

Agent-Friendly Inspection

data = mrdp.SimulationLogAdapter().load('sim/data.json')
summary = mrdp.inspect_data(data)
components = mrdp.suggest_components(data)

print(summary['robot_ids'])
mrdp.StaticGlobalPlotDrawer(
    files=['sim/data.json'],
    components=components,
    adapter=mrdp.SimulationLogAdapter(),
).draw(list(components), save=True)

Interactive Menu

Install with [menu] extra and use run_interactive_session() for quick interactive visualization:

from mr_dapa import run_interactive_session

run_interactive_session(data_folder="data", file_pattern="*.json")

Data Format

Canonical JSON format (each robot has its own timestamp array — supports async data):

[
  {
    "id": 1,
    "timestamp": [0.0, 0.02, 0.04],
    "values": [
      {"name": "X Position", "alias": "x", "unit": "m", "value": [1.0, 1.1, 1.2]},
      {"name": "Y Position", "alias": "y", "unit": "m", "value": [2.0, 2.1, 2.2]}
    ]
  }
]

Requirements

  • Python >= 3.9
  • numpy, matplotlib, tqdm
  • ffmpeg (for animation export)

Installation

pip install mr-dapa
pip install mr-dapa[menu]   # includes basic-interactive-menu for interactive CLI
pip install -e ".[dev]"    # development: pytest, ruff

Testing

pytest tests/               # 168 tests
pytest tests/ -v             # verbose
pytest tests/ -k "adapter"   # filter by name

Test structure: conftest.py provides shared fixtures. Each test_*.py covers one module.

License

MIT

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

mr_dapa-1.0.1.tar.gz (46.2 kB view details)

Uploaded Source

Built Distribution

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

mr_dapa-1.0.1-py3-none-any.whl (44.4 kB view details)

Uploaded Python 3

File details

Details for the file mr_dapa-1.0.1.tar.gz.

File metadata

  • Download URL: mr_dapa-1.0.1.tar.gz
  • Upload date:
  • Size: 46.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mr_dapa-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e24e7e1d483296a11bf54f0998a49afba701032d08e8429e40734cf55f115765
MD5 165ade2ca223500e078c5fe49d1faa36
BLAKE2b-256 1f8d03bb2e9aab2d96b43e9b7363f2078f0b8b88b109a986343b0c1f5887f857

See more details on using hashes here.

Provenance

The following attestation bundles were made for mr_dapa-1.0.1.tar.gz:

Publisher: publish.yml on xirhxq/mr-dapa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mr_dapa-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: mr_dapa-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 44.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mr_dapa-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 65ebfa8c1668c9e444eef9d644087ea651e3e3eb8ad6a5d1c81f6e5cd1a9b2b3
MD5 ec05cc3a8114930437d525384a49e4d7
BLAKE2b-256 b3ca1b745a954edc0613883476262da63e52fddf6786389bd6f4ac1d21a2769d

See more details on using hashes here.

Provenance

The following attestation bundles were made for mr_dapa-1.0.1-py3-none-any.whl:

Publisher: publish.yml on xirhxq/mr-dapa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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