A real-time robot controlling and monitoring system using WebRTC technology for low-latency communication between operators and multiple robotic platforms.
This project provides a comprehensive WebRTC-based infrastructure for real-time robot control and monitoring. The system enables real-time bidirectional communication through WebRTC data channels and media streams, providing operators with live video feeds, sensor data, and responsive control interfaces.
graph TB
subgraph "Frontend (React + TypeScript)"
UI[Dashboard Interface]
WS[WebSocket Client]
RTC[WebRTC Client]
WID[Widget System]
end
subgraph "Backend (FastAPI)"
API[REST API]
SIG[WebRTC Signaling]
DB[(PostgreSQL)]
AUTH[Authentication]
end
subgraph "Robot Platforms"
R1[Robot 1<br/>ROS2/ROS1]
R2[Robot 2<br/>ROS2/ROS1]
RN[Robot N<br/>ROS2/ROS1]
end
UI --> API
WS --> SIG
RTC -.->|P2P Connection| R1
RTC -.->|P2P Connection| R2
RTC -.->|P2P Connection| RN
API --> DB
API --> AUTH
- Low-latency control and monitoring between robot and user using WebRTC peer-to-peer connections
- WebSocket signaling server for connection establishment
- Automatic reconnection and connection state management
- Simultaneous control of multiple heterogeneous robots
- Dynamic robot discovery and connection management
- Individual robot status monitoring and control
- Real-time camera feeds with adaptive quality
- Multiple video streams per robot (MSID-based routing)
- FPS monitoring and stream statistics
- MediaStream optimization for low-latency transmission
- Live telemetry and sensor data transmission via DataChannels
- Protobuf-based data serialization for efficient transmission
- Real-time data visualization through customizable widgets
- Historical data tracking and analysis
- Send commands and receive feedback in real-time
- Remote control interfaces for robot manipulation
- Command history tracking and validation
- Emergency stop functionality
- Modular design supporting easy extension to new robot platforms
- Widget-based dashboard for flexible data visualization
- Plugin architecture for custom functionality
- Microservices-ready deployment options
- Docker & Docker Compose (for production deployment)
- Python 3.11+ (for development)
- Node.js 18+ (for frontend development)
- PostgreSQL 13+ (for data storage)
-
Clone the repository
git clone https://github.com/your-org/ai-gcs-server.git cd ai-gcs-server -
Setting .env file
Set up the
.envfile for the backend and thefrontend/.envfile for the frontend. Each environment file configures environment variables for its respective service. -
Backend Setup
cd backend uv sync source .venv/bin/activate uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
-
Frontend Setup
cd frontend npm install npm run dev -
Database Setup
# need pre-setup local postgresql cd backend alembic upgrade head
-
change .env file which located on deploy/prod
-
create docker network named "proxy"
docker network create proxy
-
run docker compose command below:
# Using Docker Compose docker-compose -f deploy/prod/docker-compose.backend.yaml up -d docker-compose -f deploy/prod/docker-compose.frontend.yaml up -d
For detailed deployment instructions, see Deployment Guide.
- Robot Registration: Register your robot through the admin interface
- WebRTC Setup: Configure robot-side WebRTC client with signaling server
- Connection Establishment: Establish P2P connection through signaling
- Data Streaming: Start streaming video and sensor data
- Create Dashboard: Set up custom dashboard layouts
- Add Widgets: Configure widgets for different data types
- Robot Mapping: Map widgets to specific robot data streams
- Real-time Monitoring: Monitor and control robots in real-time
- Video Widgets: Display live camera feeds
- Sensor Widgets: Visualize sensor data (position, velocity, etc.)
- Control Widgets: Send commands to robots
- Custom Widgets: Create custom visualization components
- Robot Client: Implement WebRTC client for your robot
- Data Parsing: Create data parsers for your sensor types
- Widget Integration: Add widgets for your robot's data
- Testing: Test with the signaling server
- Widget Template: Use the universal widget template
- Data Integration: Connect to appropriate data stores
- UI Components: Build responsive UI components
- Configuration: Add configuration options
- WebSocket API: See WebSocket Documentation
- WebRTC Setup: See MediaStream Setup and DataChannel Setup
ai-gcs-server/
โโโ backend/ # FastAPI backend
โ โโโ app/
โ โ โโโ api/ # REST API endpoints
โ โ โโโ websocket/ # WebRTC signaling
โ โ โโโ schemas/ # Pydantic models
โ โ โโโ core/ # Core configuration
โ โโโ alembic/ # Database migrations
โ โโโ pyproject.toml # Python dependencies
โโโ frontend/ # React frontend
โ โโโ src/
โ โ โโโ components/ # React components
โ โ โโโ dashboard/ # Dashboard system
โ โ โโโ rtc/ # WebRTC client
โ โ โโโ hooks/ # Custom React hooks
โ โโโ package.json # Node.js dependencies
โโโ docs/ # Documentation
โโโ deploy/ # Deployment configurations
This project is licensed under the MIT License - see the LICENSE file for details.