CoolFace
Apppublic

abbas-mesolitica/LeRobot-Arena

sourceHugging Faceupdated 3mo agoView on Hugging Face
4likes
App README

๐Ÿค– LeRobot Arena

A web-based robotics control and simulation platform that bridges digital twins and physical robots. Built with Svelte for the frontend and FastAPI for the backend.

๐Ÿš€ Quick Start with Docker

The easiest way to run LeRobot Arena is using Docker, which sets up both the frontend and backend automatically.

Prerequisites

Step-by-Step Instructions

  1. 1.Clone the repository
bash
   git clone <your-repo-url>
   cd lerobot-arena
  1. 1.Build and start the services
bash
   docker-compose up --build
  1. 1.Access the application
  • โ€”Frontend: http://localhost:7860
  • โ€”Backend API: http://localhost:8080
  • โ€”API Documentation: http://localhost:8080/docs
  1. 1.Stop the services
bash
   # Press Ctrl+C to stop, or in another terminal:
   docker-compose down

Alternative Docker Commands

If you prefer using Docker directly:

bash
# Build the image
docker build -t lerobot-arena .

# Run the container
docker run -p 7860:7860 lerobot-arena

๐Ÿ› ๏ธ Development Setup

For local development with hot-reload capabilities:

Frontend Development

bash
# Install dependencies
bun install

# Start the development server
bun run dev

# Or open in browser automatically
bun run dev -- --open

Backend Development

bash
# Navigate to Python backend
cd src-python

# Install Python dependencies (using uv)
uv sync

# Or using pip
pip install -e .

# Start the backend server
python start_server.py

Building Standalone Executable

The backend can be packaged as a standalone executable using box-packager:

bash
# Navigate to Python backend
cd src-python

# Install box-packager (if not already installed)
uv pip install box-packager

# Package the application
box package

# The executable will be in target/release/lerobot-arena-server
./target/release/lerobot-arena-server

Note: Requires Rust/Cargo to be installed for box-packager to work.

๐Ÿ“‹ Project Structure

lerobot-arena/
โ”œโ”€โ”€ src/                    # Svelte frontend source
โ”‚   โ”œโ”€โ”€ lib/               # Reusable components and utilities
โ”‚   โ”œโ”€โ”€ routes/            # SvelteKit routes
โ”‚   โ””โ”€โ”€ app.html           # App template
โ”œโ”€โ”€ src-python/            # Python backend
โ”‚   โ”œโ”€โ”€ src/               # Python source code
โ”‚   โ”œโ”€โ”€ start_server.py    # Server entry point
โ”‚   โ”œโ”€โ”€ target/            # Box-packager build output (excluded from git)
โ”‚   โ””โ”€โ”€ pyproject.toml     # Python dependencies
โ”œโ”€โ”€ static/                # Static assets
โ”œโ”€โ”€ Dockerfile             # Docker configuration
โ”œโ”€โ”€ docker-compose.yml     # Docker Compose setup
โ””โ”€โ”€ package.json           # Node.js dependencies

๐Ÿณ Docker Information

The Docker setup includes:

  • โ€”Multi-stage build: Optimized for production using Bun and uv
  • โ€”Automatic startup: Both services start together
  • โ€”Port mapping: Backend on 8080, Frontend on 7860 (HF Spaces compatible)
  • โ€”Static file serving: Compiled Svelte app served efficiently
  • โ€”User permissions: Properly configured for Hugging Face Spaces
  • โ€”Standalone executable: Backend packaged with box-packager for faster startup

For detailed Docker documentation, see DOCKER_README.md.

๐Ÿ”ง Building for Production

Frontend Only

bash
bun run build

Backend Standalone Executable

bash
cd src-python
box package

Complete Docker Build

bash
docker-compose up --build

๐ŸŒ What's Included

  • โ€”Real-time Robot Control: WebSocket-based communication
  • โ€”3D Visualization: Three.js integration for robot visualization
  • โ€”URDF Support: Load and display robot models
  • โ€”Multi-robot Management: Control multiple robots simultaneously
  • โ€”WebSocket API: Real-time bidirectional communication
  • โ€”Standalone Distribution: Self-contained executable with box-packager

๐Ÿšจ Troubleshooting

Port Conflicts

If ports 8080 or 7860 are already in use:

bash
# Check what's using the ports
lsof -i :8080
lsof -i :7860

# Use different ports
docker run -p 8081:8080 -p 7861:7860 lerobot-arena

Container Issues

bash
# View logs
docker-compose logs lerobot-arena

# Rebuild without cache
docker-compose build --no-cache
docker-compose up

Development Issues

bash
# Clear node modules and reinstall
rm -rf node_modules
bun install

# Clear Svelte kit cache
rm -rf .svelte-kit
bun run dev

Box-packager Issues

bash
# Clean build artifacts
cd src-python
box clean

# Rebuild executable
box package

# Install cargo if missing
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

๐Ÿš€ Hugging Face Spaces Deployment

This project is configured for deployment on Hugging Face Spaces:

  1. 1.Fork this repository to your GitHub account
  2. 2.Create a new Space on Hugging Face Spaces
  3. 3.Connect your GitHub repository
  4. 4.Select Docker SDK (should be auto-detected from the frontmatter)
  5. 5.Deploy - The Space will automatically build and run

The frontend will be available at your Space URL, and the backend API will be accessible at /api/ endpoints.

๐Ÿ“š Additional Documentation

  • โ€”Docker Setup Guide - Detailed Docker instructions
  • โ€”Robot Architecture - System architecture overview
  • โ€”Robot Instancing Guide - Multi-robot setup

๐Ÿค Contributing

  1. 1.Fork the repository
  2. 2.Create a feature branch
  3. 3.Make your changes
  4. 4.Test with Docker: docker-compose up --build
  5. 5.Submit a pull request

๐Ÿ“„ License

This project is licensed under the MIT License.


Built with โค๏ธ for the robotics community ๐Ÿค–