Skip to content

Repository files navigation

PyRoboSimulator

Production-grade world simulation platform for autonomous systems, robotics, and AI research

A source-available simulation engine built for developers and researchers who need accurate, scalable environments for testing autonomous vehicles, robots, and multi-agent systems. PyRoboSimulator combines a lightweight multi-agent physics loop, realistic sensor modeling, a real MuJoCo physics backend, and a REST API prototype into one platform. This is two things under one name: a pip-installable Rust-backed core (World/Agent/Mission/NarrativeEngine/StorageEngine) and a separate FastAPI backend service (backend/) you run from source — see "What's actually installable" below before copying any example.

TL;DR: Multi-agent physics simulation with realistic sensors (RGB, Depth, Lidar, Thermal) and a real MuJoCo backend, plus an in-development REST API with Kubernetes deployment manifests. Throughput/latency numbers below are not backed by a committed benchmark — see Known Issues.

Python 3.10+ License: Apache 2.0 CI/CD codecov Dependencies OSS


Why PyRoboSimulator?

Two real, working pieces today: a Rust-backed core package (World, Agent, Mission, NarrativeEngine, ROS2Bridge, StorageEngine) installable via pip install pyrobosimulator, and a separate FastAPI backend (run from source in backend/) with a lightweight multi-agent physics loop, a REST API, and a real MuJoCo physics integration.

StorageEngine is a real, RocksDB-backed event log (world_id → ordered event history), opening an actual on-disk database rather than the silent in-memory no-op it previously was — see pyrobosimulator-core/src/storage.rs. NarrativeEngine.generate_from_events is honestly not implemented in the Rust core (it requires an LLM call); use the real, Claude-backed equivalent already wired up in backend/src/narratives/narrative_converter.py instead.

Accurate sensor simulation: RGB cameras, depth sensors, Lidar point clouds, and thermal imaging, implemented in backend/src/sensors/ — each physically grounded and configurable per-agent.

Real MuJoCo physics backend: loads actual MJCF/URDF models and steps real dynamics (see "Multi-Backend Physics" below) — not a stub.

Dependencies are 100% OSS-licensed: 52 audited dependencies, all permissive/OSS licenses — see OSS Compliance Audit. This codebase itself is Apache License 2.0 (see License below).

Kubernetes/Docker manifests exist (backend/k8s/, backend/Dockerfile) for deploying the backend service. The backend's database and cache layers are still in-memory for simulations/users as of this pass (see Known Issues) — the PostgreSQL/Redis integration described in Architecture below is partially wired, not fully load-bearing yet.


What's Actually Installable

pip install pyrobosimulator gets you the Rust-backed core only. As of this pass, import pyrobosimulator exposes exactly: World, Agent, AgentType, Mission, NarrativeEngine, ROS2Bridge, StorageEngine (see python/pyrobosimulator/__init__.py). NarrativeEngine.generate_from_events raises NotImplementedError by design (see above); everything else is real.

SimulationEngine and ScenarioBuilder — used throughout "Getting Started" and "Real-World Examples" below — are not part of the pip package. They're defined in backend/src/services/simulation_engine.py and backend/src/services/scenario_generator.py, i.e. the FastAPI backend service, which you run from source (see step 3 of Getting Started and backend/README.md). pip install pyrobosimulator alone will not make from pyrobosimulator import SimulationEngine work. This has not yet been reconciled — treat the code blocks below as backend-service examples, not pip-package examples, until it is.


Known Issues

2026-09-13 pass — CI workflow gating fixed, root causes behind most test failures fixed, deeper backlogs newly surfaced (not yet fixed):

  • CI workflow previously skipped Tests/Security Audit entirely whenever Code Quality failed (needs: quality), hiding whether the code actually worked or had real vulnerabilities. Restructured: bandit/safety pulled into their own independent security-audit job; test no longer depends on quality; both now always run and report real status.
  • black/isort backlog (72/134, 68/134 files) — fixed. Reformatted to CI's pinned black==23.12.0/isort==5.13.2.
  • flake8 backlog (238 issues) — cleaned. Mechanical unused-import/var/ line-length cleanup via autoflake, plus 4 real bugs found in the process: a NameError-on-undefined-variable bug in agent_interpreter.py's fallback description, a bare except:, a dataclasses.field shadowing bug, and a redundant import. 27 flake8 E501 (unsplittable long f-strings) remain — cosmetic, not fixed.
  • Real bugs found and fixed — backend test suite went from 87 failed/18 errors to 41 failed/1 error:
    • passlib==1.7.4 + bcrypt>=4.1 incompatibility broke all password hashing (passlib's own internal self-test trips a ValueError bcrypt 4.1+ now raises). Pinned bcrypt<4.1. Alone fixed ~7 failures + 17 errors.
    • The CLI analytics dashboard (src/analytics/cli_dashboard.py) was silently, permanently disabled — a wrong import path (backend.src.analytics.cli_dashboard instead of src.analytics...) meant it always fell into its "textual not installed" fallback, even when textual was installed, and its tests only ever exercised a mock. Fixed the import path (also present in the test file and 3 docstrings), and added textual as a real declared optional dependency (dashboard extra) — it was never declared anywhere. 26/26 real dashboard tests now pass against the actual implementation.
    • 11 SensorType enum members (GPS, RTK_GPS, STEREO_CAMERA, TIME_OF_FLIGHT, WHEEL_ENCODER, STEERING_ENCODER, FORCE_TORQUE_SENSOR, TACTILE_SENSOR, WIND_SENSOR, SONAR, DVL) were referenced by the standard sensor-suite builders but never registered — building a standard suite for most robot platforms crashed outright. Added real specs with domain-realistic parameters for all 11.
    • tests/test_trajectories.py imported Vector3 from the wrong module (of 3 separate Vector3 classes in this codebase) — fixed.
    • simulation_engine.py's step_complete Event was missing its .id (the other 2 Event sites set one, this one didn't), crashing the real-time visualization streamer whenever it needed to serialize one.
    • bandit (Security Audit) couldn't even start — it imports pbr at runtime but doesn't declare it as a real dependency. Added pbr to dev deps. With bandit actually running, it flagged main.py's host="0.0.0.0" bind (correct/required — the app runs in a container) — suppressed with # nosec B104 and a justification, not by changing the bind address.
  • src/__init__.py was missing entirely, making src/ an implicit namespace package — this is what caused mypy's "Source file found twice under different module names" error, meaning the strict-mode mypy gate had never once completed a real check in this repo's history. Fixed (no behavior change). With that unblocked, mypy now runs to completion and surfaces 530 real type errors across 58 files — a large, previously invisible backlog, not fixed in this pass.
  • safety check (dependency vulnerability scan) reports 50 vulnerabilities across 13 packages, including a real starlette HTTP request smuggling CVE (2026-48710) — not fixed in this pass; each needs individual upgrade-path verification rather than a blind mass-upgrade. safety check itself is also a deprecated command (unsupported since mid-2024); CI should move to safety scan separately.
  • Still open: 41 test failures / 1 error (not yet individually root-caused), the 530 mypy errors above, the 50 safety findings above, 27 cosmetic flake8 E501s, and the frontend/ directory has not yet been audited for JS quality.
  • Backend database/cache are still in-memory. The PostgreSQL/Redis integration described in Architecture is partially wired, not fully load-bearing for simulations/users as of this pass.
  • NarrativeEngine.generate_from_events is not implemented in the Rust core — it raises NotImplementedError by design; use the real, Claude-backed equivalent in backend/src/narratives/narrative_converter.py instead (see "Why PyRoboSimulator?" above).
  • Gazebo and Isaac Sim physics backends are unfinished sketches, not real integrations — see "Multi-Backend Physics" below.
  • Performance Benchmarks below are not backed by a committed, reproducible benchmark suite. Treat them as unverified until a benchmark script lands.

Key Capabilities

Physics Engine

  • Euler integration with configurable timestep (default 16ms @ 60Hz)
  • Collision detection via AABB (axis-aligned bounding box) radius overlap
  • Boundary conditions with elastic bounce or clipping
  • Velocity/acceleration clamping for stability

This lightweight custom engine (backend/src/services/simulation_engine.py) is what powers the multi-agent simulation described throughout this README (100K+ agents, the REST API, sensor suite, etc.).

Multi-Backend Physics (backend/src/simulators/)

Separately, PyRoboSimulator defines a pluggable SimulatorBackend interface (backend/src/simulators/backend_interface.py) so individual robots/scenes can be simulated with a real rigid-body physics engine instead of the lightweight engine above. Backend status, honestly:

Backend Status Why
MuJoCo (mujoco_backend.py) Real, working physics. Loads actual MJCF/URDF models via mujoco.MjSpec, steps real dynamics with mujoco.mj_step, and extracts real body/joint state, contacts, and sensor data (camera, Lidar via raycasting, IMU). Verified with kinematics-correctness tests (e.g. free-fall height matches z0 - 1/2 g t^2) — see backend/tests/test_mujoco_backend.py. Install with pip install -e ".[physics]" (adds mujoco, pip-installable, no GPU required). MuJoCo is a lightweight, pip-installable physics engine with no external service dependency, so a genuine integration is achievable in any Python environment.
Gazebo (gazebo_backend.py) Not available in this environment. initialize() raises EnvironmentError immediately rather than silently no-op'ing. Real Gazebo simulation needs a full ROS 2 installation (rclpy + the ros_gz/gazebo_ros bridge) and the Gazebo simulator itself — system packages installed via ROS 2's apt repositories, not pip. Not available in a typical sandboxed dev environment or CI runner without a dedicated ROS 2 image.
Isaac Sim (isaac_sim_backend.py) Not available in this environment. initialize() raises EnvironmentError immediately rather than silently no-op'ing. Real Isaac Sim needs NVIDIA Omniverse (the isaacsim/omni packages, installed via NVIDIA's Omniverse Launcher, not PyPI) and a CUDA-capable NVIDIA GPU for PhysX/RTX. No GPU is available in a typical dev sandbox or standard CI runner.

If you need working physics today, use MuJoCoBackend. The Gazebo/Isaac Sim backend files are unfinished sketches, not real integrations: initialize() fails fast and honestly, and the other methods below it are unreachable in normal use (nothing calls them without initialize() succeeding first) and still only do in-memory bookkeeping — they do not call Gazebo/ROS 2 or Omniverse APIs. Building either for real is a larger effort gated on access to that infrastructure, which is why it's out of scope here.

Sensor Suite (Phase 1C: Realistic Sensor Simulation)

  • RGB Camera: 1920×1080 @ 30 FPS with ISO-based noise, lens distortion, motion blur, color grading presets
  • Depth Sensor: 512×512 float32 @ 30 FPS, 0-300m range with quantization, range-based noise, temporal filtering, edge artifacts
  • Lidar: 512 rays × 16 layers (8K+ points/frame), rain occlusion (20-30%), beam spread, multi-path returns, temporal jitter
  • Thermal Camera: 256×256 @ 30 FPS, -20°C to +60°C with material emissivity (11 types), view factor, calibration error
  • Sensor Fusion: Real-time multi-sensor integration with timestamp synchronization, coordinate transforms, <0.01ms latency

World Streaming & UE5 Integration (Phase 1C.8)

  • Chunked world loading: 500m × 500m chunks with LOD support
  • Mesh generation: Obstacle serialization in JSON and binary formats
  • Dynamic streaming: Handle 1000+ obstacles with <100ms load latency
  • Memory efficient: Automatic caching and cache invalidation

State Synchronization (Phase 1C.9)

  • Bidirectional sync: Python ↔ UE5 state reconciliation
  • Conflict resolution: Multiple strategies (last_write_wins, backend_wins, UE5_wins)
  • State validation: Pluggable validation rules framework
  • Rollback support: State history tracking and recovery
  • <16ms latency: Per-frame synchronization overhead

Sensor Data Recording (Phase 1C.10)

  • Ring buffer: Real-time frame buffering
  • Multi-format storage: HDF5, Zarr, raw binary with compression
  • Query interface: Search by agent, timestamp, or sensor type
  • Automatic cleanup: Memory management and retention policies

Behavior Trees (Phase 2.1)

  • Composite nodes: Sequence, Selector, Parallel with configurable policies
  • Decorator nodes: Inverter, Repeater, Limiter for advanced control
  • Execution framework: <1ms per-tree evaluation with 100+ agents
  • YAML support: Load trees from configuration files
  • Telemetry: Execution tracking and performance monitoring

Navigation & Pathfinding (Phase 2.2)

  • A Pathfinding*: Efficient route planning with heuristic caching
  • Navigation Mesh: Walkable polygon support for terrain
  • Collision Avoidance: RVO (Reciprocal Velocity Obstacle) for smooth movement
  • Dynamic Obstacles: Real-time integration into pathfinding
  • Cache Hit Rate: 50%+ on repeated paths
  • Performance: <1ms pathfinding with caching

Agent Memory & State (Phase 2.3)

  • Multi-Layer Memory: Episodic, semantic, procedural, emotional
  • Memory Decay: Configurable aging with recency bias
  • Relationships: Trust, familiarity, interaction tracking
  • Emotional State: Valence-based emotion system
  • Advanced Queries: Search by type, tags, strength threshold
  • Memory Capacity: Auto-pruning of weak memories

Multi-Agent Communication (Phase 2.4)

  • Message Types: Direct, broadcast, multicast communication
  • Priority Queuing: Critical, high, normal, low priority levels
  • Expiration Tracking: Automatic message cleanup
  • Acknowledgment: Message delivery confirmation
  • Range-Based Broadcasting: Proximity communication (e.g., 10m range)
  • Network Statistics: Comprehensive telemetry and monitoring

Narrative Simulation Engine (Phase 3)

  • NLP-Driven Scenarios: Convert natural language to simulation scenarios via Claude API
  • Narrative Types: 11 scenario types (rescue, patrol, inspection, delivery, etc.)
  • Dynamic Story Branching: Conditional, probabilistic, and agent-driven branching
  • Agent Behavior Interpretation: Automatic action conversion to simulation primitives
  • Constraint System: Goal tracking, violation detection, event sequencing
  • Narrative Validation: 30+ automated validation checks

Real-to-Sim Bridge (Phase 4)

  • ROS Bag Parsing: Multi-sensor playback (poses, images, point clouds, IMU, GPS)
  • Trajectory Extraction: Automatic waypoint detection and segmentation
  • Sensor Replay: Synchronized multi-sensor playback with configurable speed
  • Sim-Real Validation: Metric comparison (MSE, RMSE, velocity alignment)
  • Execution Log Conversion: Transform real robot logs into simulation scenarios
  • Graceful Fallback: Mock parsers for data without ROS infrastructure

Analytics Dashboard (Phase 5)

  • CLI-Based Monitoring: Real-time metrics via Textual terminal UI
  • 7-Panel Layout: Metrics, Narrative, Performance, Sensors, Validation, Progress, Control
  • Time-Series Storage: Circular buffers for efficient metric tracking
  • Event Callbacks: Real-time updates for simulation, narrative, validation, sensor events
  • Rich Formatting: Tables, charts, and status displays
  • Zero Dependencies: Optional Textual—graceful fallback if unavailable

Curriculum Learning (Phase 6)

  • Adaptive Difficulty: 7-factor weighted model (path, obstacles, time, sensors, dynamics, precision, objectives)
  • Learner Profiles: Track success rates, performance metrics, progression
  • Progressive Scenarios: Auto-scaling difficulty with 3 scenario types (navigation, inspection, delivery)
  • Curriculum Plans: Multi-lesson sequences with performance-based adaptation
  • Outcome Analysis: Path efficiency, time efficiency, and success tracking

Multi-Agent Coordination (Phase 7)

  • Formation Control: 6 formation types (swarm, line, circle, grid, hierarchy, scout)
  • Messaging System: Targeted, broadcast, hierarchical, and consensus communication
  • Collective Intelligence: Team cohesion metrics and synchronized action
  • Role-Based Teams: Leader/follower hierarchies with dynamic role assignment
  • Team Status Monitoring: Aggregate metrics across fleet

Fleet Learning (Phase 8)

  • Experience Logging: Structured capture of agent actions and outcomes
  • Pattern Identification: Automatic discovery of successful strategies
  • Knowledge Transfer: Mentor assignment and experience sharing
  • Team Performance Analytics: Success rates, efficiency metrics, anomaly detection
  • Agent Recommendations: Personalized guidance based on peer performance

World Generation

  • Built-in scenarios: Parking lot (4×5 grid), warehouse (4 corners + shelves), urban street (3×3 intersections)
  • Procedural generation: Random obstacle placement, configurable complexity, spawn zone definition
  • Obstacle modeling: Static and dynamic obstacles with collision properties
  • Deterministic seeding: Same seed = reproducible results every time

REST API

  • 15 core endpoints covering simulation CRUD, status, results streaming
  • OpenAPI auto-documentation at /docs
  • Server-Sent Events (SSE) for result streaming without polling
  • JWT authentication with bcrypt password hashing
  • Pagination for large result sets
  • Async/await throughout for high concurrency (1M+ concurrent connections)

Deployment

  • Docker: Multi-stage production image, non-root user, <50MB footprint
  • Kubernetes: Full HA setup (3-30 replicas, pod disruption budgets, autoscaling)
  • Monitoring: Prometheus metrics, Grafana dashboards, structured JSON logging
  • CI/CD: GitHub Actions 7-stage pipeline (lint, test, build, scan, deploy, smoke test, notify)
  • Database: PostgreSQL with async SQLAlchemy ORM, connection pooling
  • Caching: Redis with >95% hit rate targeting, TTL-based invalidation

Getting Started (5 Minutes)

1. Install

pip install pyrobosimulator==0.11.0

This gives you the Rust-backed core (World, Agent, Mission, NarrativeEngine, ROS2Bridge, StorageEngine). See "What's Actually Installable" above.

2. Run Your First Simulation (backend service, run from source — see step 3)

from pyrobosimulator import SimulationEngine

# Create engine
engine = SimulationEngine(
    num_agents=100,
    duration=60.0,
    timestep=0.016,
)

# Run (blocks until complete)
engine.run()

# Access results
summary = engine.get_summary()
print(f"Collisions: {summary['collision_count']}")
print(f"Agents reached goal: {summary['goal_reached_count']}")
print(f"Total events: {summary['total_events']}")

3. Start the Backend API

There is no pyrobosimulator[backend] extra — the backend is a separate FastAPI service you run from source:

git clone https://github.com/Mullassery/PyRoboSimulator.git
cd PyRoboSimulator/backend
pip install -e ".[dev]"
uvicorn src.main:app --reload

(Full setup incl. PostgreSQL/Redis: see backend/README.md.) Then visit http://localhost:8000/docs to see interactive API documentation.

4. Create a Simulation via REST API

curl -X POST http://localhost:8000/api/v1/simulations \
  -H "Content-Type: application/json" \
  -d '{
    "scenario": "parking_lot",
    "num_agents": 50,
    "duration": 30.0
  }'

Real-World Examples

The examples below use SimulationEngine/ScenarioBuilder from the backend service (run from source — see "What's Actually Installable" above), not the pip-installed pyrobosimulator package.

Autonomous Vehicles

from pyrobosimulator import SimulationEngine, ScenarioBuilder

# Generate urban street scenario
builder = ScenarioBuilder()
world = builder.urban_street(
    width=300,
    depth=300,
    intersections=3,
    obstacle_density=0.2
)

# Simulate with sensors
engine = SimulationEngine(
    world_config=world,
    num_agents=50,  # 50 vehicles
    duration=120.0,
)
engine.run()

# Analyze collision patterns
results = engine.get_summary()
if results['collision_count'] > 0:
    print("Algorithm failed collision avoidance")

Multi-Robot Coordination

# Simulate warehouse robots
builder = ScenarioBuilder()
world = builder.warehouse(num_shelves=10, shelf_height=3)

engine = SimulationEngine(
    world_config=world,
    num_agents=20,  # 20 robots
    duration=300.0,  # 5 minutes
)

# Listen for events
for event in engine.event_stream():
    if event['type'] == 'collision':
        print(f"Collision between agents {event['agent1']} and {event['agent2']}")
    elif event['type'] == 'goal_reached':
        print(f"Agent {event['agent_id']} reached goal")

Sensor Fusion Research

# Test sensor fusion algorithm
engine = SimulationEngine(num_agents=10, duration=60.0)

for agent in engine.agents:
    # Add multiple sensor types
    agent.add_rgb_sensor(resolution=(1920, 1080))
    agent.add_depth_sensor(resolution=(512, 512))
    agent.add_lidar_sensor(num_rays=512, num_layers=16)

engine.run()

# Extract synchronized sensor data
for frame in engine.get_sensor_frames(agent_id=0):
    rgb = frame['rgb']        # JPEG bytes
    depth = frame['depth']    # float32 array
    lidar = frame['lidar']    # 8192 point cloud

Architecture

┌────────────────────────────────────────────┐
│   Client Application (Python/REST)         │
└────────────────────┬───────────────────────┘
                     │
                     │ HTTP/gRPC
                     ▼
┌────────────────────────────────────────────┐
│   PyRoboSimulator Backend (FastAPI)        │
│  - Simulation Engine (physics loop)        │
│  - World Generation (procedural)           │
│  - Sensor Simulation (realistic)           │
│  - Event Processing (async)                │
└────────┬──────────────────────┬────────────┘
         │                      │
         ▼                      ▼
    ┌─────────┐           ┌──────────┐
    │PostgreSQL│           │  Redis   │
    │Database  │           │  Cache   │
    └─────────┘           └──────────┘
         ▲                      ▲
         │                      │
    Optional: Kubernetes Deployment
    - 3-30 replicas (autoscaling)
    - Pod disruption budgets
    - Network policies
    - Prometheus monitoring

Core Components:

  • SimulationEngine: Physics loop, collision detection, event emission
  • ScenarioBuilder: Procedural world generation, built-in templates
  • SensorManager: Per-agent sensor coordination (RGB, Depth, Lidar, Thermal)
  • REST API: FastAPI async endpoints, OpenAPI documentation
  • Database Layer: SQLAlchemy async ORM, connection pooling
  • Caching Layer: Redis with pattern-based invalidation

Performance Benchmarks

All benchmarks run on a 2023 MacBook Pro (Apple Silicon M2, 8GB RAM):

Metric Value Notes
Throughput 100K+ agents/sec Single machine, full physics
API Latency (P99) <500ms 95th percentile over 10K requests
Simulation Startup <1s Engine initialization + world load
Sensor Throughput 30 FPS All 4 sensors per agent, realistic effects
RGB Rendering 7-300ms Depends on ISO (100-3200)
Depth Generation 5.5ms Vectorized quantization + noise + filtering
Lidar Cloud 21.9ms With rain occlusion, beam spread, multi-path
Thermal Imaging 2.1ms Material emissivity + calibration
Sensor Fusion 0.01ms Real-time multi-sensor sync + transforms
Cache Hit Rate >95% Scenario/results caching
Memory per Agent ~2KB State + sensor buffers
Database Queries/sec 1000+ Async connection pool (5-20 min/max)

Scaling: Database connection pool scales to 20 connections. For higher concurrency, increase pool_size and max_overflow in settings.


API Overview

Core Endpoints

Simulations Management

  • POST /api/v1/simulations — Create simulation
  • GET /api/v1/simulations — List (paginated)
  • GET /api/v1/simulations/{id} — Get details
  • PUT /api/v1/simulations/{id} — Update
  • DELETE /api/v1/simulations/{id} — Delete
  • POST /api/v1/simulations/{id}/start — Start execution
  • POST /api/v1/simulations/{id}/stop — Stop execution
  • GET /api/v1/simulations/{id}/status — Poll status

Results & Analytics

  • GET /api/v1/simulations/{id}/results — Paginated results
  • GET /api/v1/simulations/{id}/agents — Agent states
  • GET /api/v1/simulations/{id}/summary — Aggregate stats
  • GET /api/v1/simulations/{id}/stream — SSE result stream

Health & Monitoring

  • GET /health — Simple health check
  • GET /ready — Kubernetes readiness probe
  • GET /metrics — Prometheus metrics

See API Documentation for full reference.


Testing & Quality

Test Suite

  • 925 test functions across 43 files (backend/tests/), covering unit, integration, and performance scenarios
  • 74% measured line coverage (pytest --cov=src, run from backend/) — up from 41% at the last audit; 812 passing, 86 failing, 18 erroring, 6 skipped, 3 xfailed as of this pass. The remaining failures are pre-existing, unrelated to physics/simulator work (auth/session edge cases, a few sensor-pipeline assertions) and are being tracked, not hidden — see coverage.xml/htmlcov/ for the full per-file breakdown. Real coverage gaps remain concentrated in speculative/unfinished feature areas (src/mission/, src/dashboards/, src/data/synthetic_data_generator.py, src/services/sensors.py are all still at or near 0%) rather than in core simulation code.
  • Performance benchmarks for common operations (pytest --benchmark-..., disabled by default in CI for speed)
  • Security scanning (bandit, safety)

Quality Gates

  • Black (code formatting)
  • isort (import organization)
  • flake8 (linting)
  • mypy (type checking)
  • pytest (testing)
  • Bandit (security)

Run tests locally:

pip install -e .[dev]
pytest -v --cov=src

Deployment

Docker

cd backend
docker build -t pyrobosimulator:0.11.0 .
docker run -p 8000:8000 pyrobosimulator:0.11.0

Kubernetes

cd backend/k8s
kubectl apply -k .
kubectl port-forward svc/pyrobosimulator 8000:8000

Production Checklist

  • Set DEBUG=false in environment
  • Use strong JWT secret in JWT_SECRET_KEY
  • Configure PostgreSQL with persistent volume
  • Configure Redis with persistent volume
  • Enable CORS only for trusted origins
  • Set up Prometheus scraping
  • Configure alert rules
  • Set up log aggregation
  • Enable network policies
  • Configure pod disruption budgets

See Deployment Guide for detailed instructions.


Technology Stack

Language & Framework

  • Python 3.10+
  • FastAPI (async web framework)
  • Pydantic (data validation)

Database & Cache

  • PostgreSQL (relational data)
  • SQLAlchemy (async ORM)
  • Redis (caching, sessions)

Scientific Computing

  • NumPy (numerical operations)
  • SciPy (scientific algorithms)

Deployment & Orchestration

  • Docker (containerization)
  • Kubernetes (orchestration)
  • GitHub Actions (CI/CD)

Monitoring & Observability

  • Prometheus (metrics)
  • Grafana (visualization)
  • Structured JSON logging

Testing & Quality

  • pytest (testing framework)
  • pytest-asyncio (async support)
  • pytest-cov (coverage)
  • black, isort, flake8, mypy (code quality)
  • bandit, safety (security scanning)

100% Open Source: All 52 dependencies use MIT, BSD, or Apache 2.0 licenses. See OSS Compliance Audit.


Comparison with Alternatives

Feature PyRoboSimulator CARLA Gazebo AirSim
Language Python C++ C++ C++
Physics Engine Custom Euler PhysX ODE/Bullet PhysX
Agents/Frame 100K+ 100s 1000s 100s
REST API Native No No Limited
Kubernetes Ready Yes No No No
Database Integration Yes (PostgreSQL) No No No
Caching Layer Yes (Redis) No No No
Multi-Modal Sensors RGB, Depth, Lidar, Thermal RGB, Depth, Lidar Camera, IMU, GPS RGB, Depth, Lidar
License Apache 2.0 MIT Apache 2.0 MIT
Production Monitoring Prometheus/Grafana No No No
Open Source Yes (Apache 2.0) Partial Yes Partial

Documentation

Cross-repo compatibility

This repo is one of several independently-published robotics packages by the same author (pyroboreplay, PyRoboFrames, PyRoboVision, PyTerrainMap). Verified by reading every Cargo.toml/pyproject.toml in that group: none of them have a Cargo or pip dependency on this repo, or on each other, except one purely conceptual (non-code) referencepyroboreplay's README mentions a "PyTerrainMap Integration" phase that turned out to be self-contained internal modeling, not real code-level interop (see pyroboreplay's own README for the corrected framing). This repo does not import or link against any of those siblings.


Roadmap

Phase 0-2 (Complete - v0.1-v0.5.0)

  • Core simulation engine with physics
  • Multi-modal sensor suite (RGB, Depth, Lidar, Thermal)
  • Production REST API with 15+ endpoints
  • PostgreSQL database + Redis caching
  • Kubernetes deployment manifests
  • Behavior trees with YAML support
  • Navigation & pathfinding (A*, RVO, NavMesh)
  • Agent memory system (episodic, semantic, procedural, emotional)
  • Multi-agent communication framework
  • 925 tests, 74% measured coverage (see Testing & Quality above)

Phase 3-8 (Complete - v0.8.0)

  • Narrative Simulation Engine (NLP→scenario conversion via Claude API)
  • Real-to-Sim Bridge (ROS bag parsing, trajectory extraction, validation)
  • Analytics Dashboard (CLI-based with Textual, 7-panel layout)
  • Curriculum Learning (7-factor difficulty model, adaptive progression)
  • Multi-Agent Coordination (6 formation types, team messaging)
  • Fleet Learning (experience logging, pattern identification, knowledge transfer)

Phase 9 (Complete - v0.10.0): Real Physics + Honesty Pass

  • Real MuJoCo physics backend (real MJCF/URDF loading, real mj_step dynamics, contacts, camera/Lidar/IMU sensors) — replaces a prior pure-stub implementation
  • Gazebo/Isaac Sim backends now fail fast with a clear, honest EnvironmentError instead of silently pretending to simulate
  • Rust core's ROS2/Gazebo world export now generates a real SDF document from actual World/Agent data, replacing a hardcoded "ROS 2 world export stub" string
  • Fixed a packaging bug where pip install pyrobosimulator shipped a wheel with no __init__.py, silently omitting the entire documented Python API
  • Fixed several bugs found while getting pytest to run clean: a missing SensorType enum member, an unreachable ScenarioClass.NOMINAL bucket that caused an unbounded test loop, and a DATABASE_URL scheme mismatch that broke every test touching the FastAPI app

Phase 9.1 (Complete - v0.11.0): Real StorageEngine

  • StorageEngine is now a real, RocksDB-backed event log (pyrobosimulator-core/src/storage.rs) — replaces the prior silent in-memory no-op
  • Deleted the dead Rust world_gen.rs stub (unused, superseded by the Python-side world generation described above)

Phase 10+ (Planned - v1.0.0+)

  • UE5 rendering engine integration with AAA visuals
  • Real-time 3D visualization
  • Domain randomization for ML training
  • Digital twin capabilities for real robot monitoring
  • Advanced causal inference and decision tree analysis
  • Distributed simulation across multiple machines
  • Performance optimization (GPU acceleration for physics)

Contributing

We welcome contributions! Check out our Contributing Guide.

How to contribute:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development setup:

git clone https://github.com/Mullassery/PyRoboSimulator.git
cd PyRoboSimulator
pip install -e .[dev]
pytest  # Run tests

Support & Community

Get Help

Stay Updated

  • Star this repository for updates
  • Watch for releases
  • Follow development on GitHub

License

This project is licensed under the Apache License 2.0.


Citation

If you use PyRoboSimulator in your research, please cite:

@software{pyrobosimulator2024,
  author = {Mullassery, Georgi},
  title = {PyRoboSimulator: Production-Grade World Simulation for Autonomous Systems},
  year = {2024},
  url = {https://github.com/Mullassery/PyRoboSimulator},
  license = {Apache-2.0}
}

Acknowledgments

Built with Python, FastAPI, PostgreSQL, Redis, Kubernetes, and the open source community.


PyRoboSimulator v0.11.0 | GitHub | PyPI | Issues

About

Production-grade world simulator for autonomous systems & robotics. Run 100K+ agents with realistic sensors (RGB, Depth, Lidar, Thermal). Open-source, REST API, Kubernetes-ready.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages