Architecture
This page describes SMART’s system architecture and design.
Overview
SMART is built on a modular architecture consisting of:
Simulator Core (ARGoS-based)
Execution Monitor (Action Dependency Graph)
RPC Server (Communication layer)
Python Client (API and tools)
┌─────────────────────────┐
│ MAPF Planner │
│ (Your Algorithm) │
└───────────┬─────────────┘
│ Paths
▼
┌─────────────────────────┐
│ Python Client API │
│ (run_sim.py) │
└───────────┬─────────────┘
│ RPC
▼
┌──────────────────────────────────────────────┐
│ SMART Server (C++) │
├──────────────────────────────────────────────┤
│ ┌────────────────────────────────────────┐ │
│ │ Action Dependency Graph (ADG) │ │
│ │ - Parse plans │ │
│ │ - Build dependency graph │ │
│ │ - Monitor execution │ │
│ └───────────────┬────────────────────────┘ │
│ │ │
│ ┌───────────────▼────────────────────────┐ │
│ │ ARGoS Simulator │ │
│ │ - Physics engine │ │
│ │ - Robot controllers │ │
│ │ - Collision detection │ │
│ └────────────────────────────────────────┘ │
└──────────────────────────────────────────────┘
│
▼
┌─────────────────────────┐
│ Statistics & Logs │
└─────────────────────────┘
Components
ARGoS Simulator
SMART uses ARGoS 3 as the physics-based simulator:
Physics Engine - Realistic 2D dynamics and collisions
Robot Models - Differential drive robots (footbots)
Sensors - Position, proximity, obstacle detection
Visualization - 3D OpenGL rendering
Location: client/ directory
Key files:
* client/controllers/ - Robot controller logic
* client/loop_functions/ - Simulation orchestration
Action Dependency Graph (ADG)
The ADG monitors plan execution and handles uncertainties:
Plan Parser - Converts paths to action sequences
Graph Builder - Creates dependency graph from actions
Execution Monitor - Tracks progress and detects issues
Coordination - Manages agent interactions
Location: server/ directory
Key files:
* server/inc/parser.h - Path parsing
* server/src/ADG_server.cpp - Main server logic
RPC Communication
Uses rpclib for client-server communication:
Protocol - MessagePack over TCP
Port - Default 8182 (configurable)
Methods - Load scenario, set paths, run simulation, get stats
Key RPC calls:
* load_scenario(map, scen, agents)
* set_paths(paths_json)
* run_simulation(headless)
* get_statistics()
Python Client
High-level Python API and CLI tools:
CLI -
run_sim.pycommand-line interfaceAPI -
SMARTClientclass for programmatic accessUtilities - Path conversion, visualization, analysis
Location: Root directory
Key files:
* run_sim.py - Main CLI entry point
* ArgosConfig/ToArgos.py - Configuration generation
Execution Flow
Initialization
User → run_sim.py → Start ADG_server → Connect RPC
Load Scenario
Load .map → Load .scen → Generate ARGoS config → Initialize robots
Set Paths
MAPF paths → Parse to actions → Build ADG → Validate
Simulation
ARGoS tick → Update robot states → Check ADG → Detect delays/collisions → Log events
Results
Simulation complete → Aggregate stats → Return to client
Data Flow
Path Input:
MAPF Planner
↓
paths.txt (discrete waypoints)
↓
Python client (validation)
↓
RPC (JSON serialization)
↓
ADG Server (parse to actions)
↓
ARGoS (continuous execution)
Statistics Output:
ARGoS (execution events)
↓
ADG (aggregation)
↓
RPC (JSON response)
↓
Python client
↓
CSV file / Python dict
Design Principles
Modularity
Each component has a well-defined interface:
Planner-agnostic: works with any MAPF algorithm
Swappable simulator: ARGoS can be replaced
Extensible: easy to add new metrics or features
Scalability
Designed for large numbers of agents:
Efficient ADG representation
Spatial hashing for collision detection
Parallel simulation (when using ARGoS parallelization)
Realism
Bridges planning and reality:
Physics-based dynamics
Execution uncertainty
Communication delays
Sensor noise (configurable)
Code Structure
smart/
├── client/ # ARGoS components
│ ├── controllers/ # Robot controllers
│ ├── loop_functions/ # Simulation logic
│ └── embedding/ # Utilities
├── server/ # ADG server
│ ├── inc/ # Headers
│ └── src/ # Implementation
├── ArgosConfig/ # Config generation
├── build/ # Build outputs
├── docs/ # Documentation
├── tests/ # Unit tests
├── run_sim.py # Main CLI
└── CMakeLists.txt # Build config
Build System
SMART uses CMake for building:
# Top-level CMakeLists.txt structure
cmake_minimum_required(VERSION 3.16)
project(Lifelong_SMART)
# Build options
option(BUILD_SERVER "Build ADG server" ON)
option(BUILD_CLIENT "Build ARGoS client" ON)
# Dependencies
find_package(Boost REQUIRED)
find_package(ARGoS REQUIRED)
# Subdirectories
add_subdirectory(server)
add_subdirectory(client)
Threading Model
Main Thread - ARGoS simulation loop
RPC Thread - Handles client requests
Worker Threads - Physics computations (ARGoS internal)
Thread safety is ensured through: * Mutex locks on shared state * Message queues for commands * Atomic operations for statistics
Performance Considerations
Bottlenecks:
Physics simulation (ARGoS)
Collision detection
RPC serialization (for large path sets)
Optimizations:
Spatial hashing for O(1) neighbor queries
Lazy ADG evaluation
Batch RPC calls
Compiled with -O3 optimization
Scaling:
~100 agents: Real-time with visualization
~1000 agents: Real-time headless
1000+ agents: Use time-scaling or distributed simulation
Extending SMART
Add a new metric:
Modify
server/src/ADG_server.cppto track the metricUpdate statistics struct
Return via RPC
Parse in Python client
Add a new robot model:
Create controller in
client/controllers/Register in
CMakeLists.txtUpdate ARGoS config generation
Add Python API wrapper
Add a new sensor:
Implement sensor in ARGoS controller
Expose data via RPC
Add Python API method
Next Steps
../contributing - Contributing guide