Spaces:
Sleeping
Sleeping
metadata
title: RobotHub TransportServer
emoji: ๐ค
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 8000
suggested_hardware: cpu-upgrade
suggested_storage: small
short_description: Real-time robotics control and video streaming platform
tags:
- robotics
- control
- websocket
- fastapi
- svelte
- real-time
- video-streaming
- transport-server
- robothub
pinned: true
fullWidth: true
๐ค RobotHub TransportServer
A high-performance, real-time communication platform for robotics control and video streaming. Built for multi-tenant environments with WebSocket and WebRTC technologies.
๐ Overview
RobotHub TransportServer enables real-time, bidirectional communication between robotics systems, cameras, and control interfaces. It provides a unified platform for:
- Real-time robot joint control via WebSocket connections
- Live video streaming via WebRTC technology
- Multi-workspace isolation for secure multi-tenant deployments
- Producer/Consumer architecture for scalable robotics applications
- Cross-platform client libraries (JavaScript/TypeScript and Python)
๐๏ธ Architecture
Core Components
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ RobotHub TransportServer โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ ๐ REST API โ ๐ WebSocket โ ๐น WebRTC โ
โ - Room management โ - Real-time control โ - Video โ
โ - Workspace control โ - Joint updates โ - Streamingโ
โ - Status & health โ - State sync โ - P2P conn โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Multi-Workspace & Room Management โ
โ workspace_1/ workspace_2/ workspace_n/ โ
โ โโโ robotics_room_1 โโโ robotics_room_1 โโโ ... โ
โ โโโ robotics_room_2 โโโ video_room_1 โ โ
โ โโโ video_room_1 โโโ video_room_2 โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Producer/Consumer Pattern
Robotics Control:
- Producer: Sends joint commands and control signals
- Consumer: Receives commands and executes robot movements
Video Streaming:
- Producer: Streams camera feeds or screen content
- Consumer: Receives and displays video streams
๐ ๏ธ Key Features
โ Real-time Robotics Control
- Joint-level robot control with normalized values
- Emergency stop mechanisms
- State synchronization between multiple clients
- Support for 6-DOF robotic arms (extensible)
โ WebRTC Video Streaming
- Low-latency video streaming
- Multiple camera support
- Screen sharing capabilities
- Automatic quality adaptation
โ Multi-Workspace Architecture
- Complete isolation between workspaces
- UUID-based workspace identification
- Scalable room management within workspaces
โ Cross-Platform Clients
- JavaScript/TypeScript: Browser and Node.js support
- Python: AsyncIO-based client for robotics applications
- Consistent API across all platforms
โ Production Ready
- Docker containerization
- Health monitoring endpoints
- Comprehensive logging
- Error handling and recovery
๐ Quick Start
Using Docker (Recommended)
# Clone the repository
git clone https://github.com/julien-blanchon/RobotHub-TransportServer
cd RobotHub-TransportServer
# Build and run with Docker
docker build -t robothub-transport-server .
docker run -p 8000:8000 robothub-transport-server
Development Setup
# Install Python dependencies
cd server
uv venv
source .venv/bin/activate
uv sync
uv pip install -e .
# Start the server
uv run launch_with_ui.py
# The server will be available at:
# - API: http://localhost:8000/api
# - Demo UI: http://localhost:8000
๐ Client Libraries
JavaScript/TypeScript
cd client/js
bun install
bun run build
import { robotics, video } from '@robothub/transport-server-client';
// Robotics control
const producer = new robotics.RoboticsProducer('http://localhost:8000');
await producer.connect(workspaceId, roomId);
await producer.sendJointUpdate([
{ name: 'joint_1', value: 45.0 },
{ name: 'joint_2', value: -30.0 }
]);
// Video streaming
const videoProducer = new video.VideoProducer('http://localhost:8000');
await videoProducer.connect(workspaceId, roomId);
await videoProducer.startCamera();
Python
cd client/python
uv venv
source .venv/bin/activate
uv sync
uv pip install -e .
import asyncio
from transport_server_client import RoboticsProducer
from transport_server_client.video import VideoProducer
async def main():
# Robotics control
producer = RoboticsProducer('http://localhost:8000')
await producer.connect(workspace_id, room_id)
await producer.send_joint_update([
{'name': 'joint_1', 'value': 45.0},
{'name': 'joint_2', 'value': -30.0}
])
# Video streaming
video_producer = VideoProducer('http://localhost:8000')
await video_producer.connect(workspace_id, room_id)
await video_producer.start_camera()
asyncio.run(main())
๐ฎ Interactive Demo
The included demo application showcases all features:
cd demo
bun install
bun run dev
Visit http://localhost:5173
to access:
- Workspace Management: Create and manage isolated environments
- Robotics Control: Real-time robot arm control interface
- Video Streaming: Camera and screen sharing demos
- Multi-room Support: Manage multiple concurrent sessions
๐ง API Reference
REST Endpoints
Workspaces & Rooms
GET /robotics/workspaces/{workspace_id}/rooms
POST /robotics/workspaces/{workspace_id}/rooms
DELETE /robotics/workspaces/{workspace_id}/rooms/{room_id}
GET /robotics/workspaces/{workspace_id}/rooms/{room_id}/state
GET /video/workspaces/{workspace_id}/rooms
POST /video/workspaces/{workspace_id}/rooms
DELETE /video/workspaces/{workspace_id}/rooms/{room_id}
WebSocket Connections
WS /robotics/workspaces/{workspace_id}/rooms/{room_id}/ws
WS /video/workspaces/{workspace_id}/rooms/{room_id}/ws
Message Types
Robotics Messages
joint_update
: Send/receive joint position commandsstate_sync
: Synchronize complete robot stateemergency_stop
: Emergency stop signalheartbeat
: Connection health monitoring
Video Messages
stream_started
: Video stream initiatedstream_stopped
: Video stream endedwebrtc_offer/answer/ice
: WebRTC signalingvideo_config_update
: Stream configuration changes
๐ Integration Examples
ML/AI Robotics Pipeline
# Example: AI model controlling robot via TransportServer
import asyncio
from transport_server_client import RoboticsProducer
from transport_server_client.video import VideoConsumer
class AIRobotController:
def __init__(self, server_url, workspace_id):
self.robot_producer = RoboticsProducer(server_url)
self.camera_consumer = VideoConsumer(server_url)
self.workspace_id = workspace_id
async def start_control_loop(self):
# Connect to robot control room
await self.robot_producer.connect(self.workspace_id, 'robot_control')
# Connect to camera feed
await self.camera_consumer.connect(self.workspace_id, 'camera_feed')
# Set up frame processing
self.camera_consumer.on_frame_update(self.process_frame)
async def process_frame(self, frame_data):
# AI inference on camera frame
joint_commands = await self.ai_model.predict(frame_data)
# Send robot commands
await self.robot_producer.send_joint_update(joint_commands)
Multi-Robot Coordination
// Example: Coordinating multiple robots
import { robotics } from '@robothub/transport-server-client';
class MultiRobotCoordinator {
private robots: Map<string, robotics.RoboticsProducer> = new Map();
async addRobot(robotId: string, workspaceId: string, roomId: string) {
const producer = new robotics.RoboticsProducer();
await producer.connect(workspaceId, roomId);
this.robots.set(robotId, producer);
}
async coordinatedMovement(positions: Map<string, JointUpdate[]>) {
// Send synchronized commands to all robots
const promises = Array.from(positions.entries()).map(([robotId, joints]) => {
const producer = this.robots.get(robotId);
return producer?.sendJointUpdate(joints);
});
await Promise.all(promises);
}
}
๐ Project Structure
RobotHub-TransportServer/
โโโ server/ # FastAPI backend server
โ โโโ src/
โ โ โโโ robotics/ # Robotics control logic
โ โ โโโ video/ # Video streaming logic
โ โ โโโ api.py # Main API routes
โ โโโ launch_with_ui.py # Server launcher
โโโ client/
โ โโโ js/ # JavaScript/TypeScript client
โ โโโ python/ # Python client library
โโโ demo/ # SvelteKit demo application
โโโ Dockerfile # Container configuration
โโโ README.md
๐ข Deployment
Production Docker Deployment
# Build production image
docker build -t robothub-transport-server .
# Run with custom configuration
docker run -d \
--name robothub-transport-server \
-p 8000:8000 \
-e LOG_LEVEL=info \
robothub-transport-server
Development Setup
# Clone repository
git clone https://github.com/julien-blanchon/RobotHub-TransportServer
cd RobotHub-TransportServer
# Server development
cd server
uv venv && source .venv/bin/activate
uv sync
# Client development
cd client/js
bun install
# Demo development
cd demo
bun install