LeLab - Web Interface for LeRobot

June 18, 2025 ยท View on GitHub

A modern web-based interface for controlling and monitoring robots using the LeRobot framework. This application provides an intuitive dashboard for robot teleoperation, data recording, and calibration management.

๐Ÿค– About

LeLab bridges the gap between LeRobot's powerful robotics capabilities and user-friendly web interfaces. It offers:

  • Real-time robot control through an intuitive web dashboard
  • Dataset recording for training machine learning models
  • Live teleoperation with WebSocket-based real-time feedback
  • Configuration management for leader/follower robot setups
  • Joint position monitoring and visualization

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Frontend      โ”‚    โ”‚   FastAPI        โ”‚    โ”‚   LeRobot       โ”‚
โ”‚   (React/TS)    โ”‚โ—„โ”€โ”€โ–บโ”‚   Backend        โ”‚โ—„โ”€โ”€โ–บโ”‚   Framework     โ”‚
โ”‚                 โ”‚    โ”‚                  โ”‚    โ”‚                 โ”‚
โ”‚   โ€ข Dashboard   โ”‚    โ”‚   โ€ข REST APIs    โ”‚    โ”‚   โ€ข Robot       โ”‚
โ”‚   โ€ข Controls    โ”‚    โ”‚   โ€ข WebSockets   โ”‚    โ”‚     Control     โ”‚
โ”‚   โ€ข Monitoring  โ”‚    โ”‚   โ€ข Recording    โ”‚    โ”‚   โ€ข Sensors     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โœจ Features

๐ŸŽฎ Robot Control

  • Teleoperation: Direct robot arm control through web interface
  • Joint monitoring: Real-time joint position feedback via WebSocket
  • Safety controls: Start/stop teleoperation with status monitoring

๐Ÿ“น Data Recording

  • Dataset creation: Record episodes for training ML models
  • Session management: Start, stop, and manage recording sessions
  • Episode controls: Skip to next episode or re-record current one
  • Real-time status: Monitor recording progress and status

โš™๏ธ Configuration

  • Config management: Handle leader and follower robot configurations
  • Calibration support: Load and manage calibration settings
  • Health monitoring: System health checks and diagnostics

๐ŸŒ Web Interface

  • Modern UI: Built with React, TypeScript, and Tailwind CSS
  • Real-time updates: WebSocket integration for live data
  • Responsive design: Works on desktop and mobile devices

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.8+
  • Node.js 16+ (for frontend development)
  • LeRobot framework installed and configured
  • Compatible robot hardware

Installation

  1. Clone the repository

    git clone <your-repo-url>
    cd leLab
    
  2. Install the Python backend

    # If installing in virtual environment
    python -m venv .venv
    source .venv/bin/activate
    # If installing globally
    # Note: Git-LFS required: brew install git-lfs
    pip install -e .
    

Running the Application

After installation, you can use the lelab command-line tools:

# Start only the backend server (default)
lelab

# Start both backend and frontend servers
lelab-fullstack

# Start only the frontend development server
lelab-frontend

Command Options:

  • lelab - Starts only the FastAPI backend server on http://localhost:8000
  • lelab-fullstack - Starts both FastAPI backend (port 8000) and Vite frontend (port 8080) with auto-browser opening
  • lelab-frontend - Starts only the frontend development server with auto-browser opening

Frontend Repository:

The frontend is automatically cloned from leLab-space when you run lelab-frontend or lelab-fullstack. The system will:

  1. Check if the frontend already exists in the parent directory
  2. Clone the repository if it doesn't exist
  3. Install dependencies with npm install
  4. Start the development server and auto-open your browser

Key Endpoints

  • POST /move-arm - Start robot teleoperation
  • POST /stop-teleoperation - Stop current teleoperation
  • GET /joint-positions - Get current joint positions
  • POST /start-recording - Begin dataset recording
  • POST /stop-recording - End recording session
  • GET /get-configs - Retrieve available configurations
  • WS /ws/joint-data - WebSocket for real-time joint data

๐Ÿ—๏ธ Project Structure

leLab/
โ”œโ”€โ”€ app/                      # FastAPI backend
โ”‚   โ”œโ”€โ”€ main.py              # Main FastAPI application
โ”‚   โ”œโ”€โ”€ recording.py         # Dataset recording logic
โ”‚   โ”œโ”€โ”€ teleoperating.py     # Robot teleoperation logic
โ”‚   โ”œโ”€โ”€ calibrating.py       # Robot calibration logic
โ”‚   โ”œโ”€โ”€ training.py          # ML training logic
โ”‚   โ”œโ”€โ”€ config.py            # Configuration management
โ”‚   โ”œโ”€โ”€ scripts/             # Command-line scripts
โ”‚   โ”‚   โ”œโ”€โ”€ backend.py       # Backend-only startup
โ”‚   โ”‚   โ”œโ”€โ”€ frontend.py      # Frontend-only startup
โ”‚   โ”‚   โ””โ”€โ”€ fullstack.py     # Full-stack startup
โ”‚   โ””โ”€โ”€ static/              # Static web files
โ”œโ”€โ”€ ../leLab-space/   # React frontend (auto-cloned)
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/      # React components
โ”‚   โ”‚   โ”œโ”€โ”€ pages/           # Page components
โ”‚   โ”‚   โ”œโ”€โ”€ hooks/           # Custom React hooks
โ”‚   โ”‚   โ””โ”€โ”€ contexts/        # React contexts
โ”‚   โ”œโ”€โ”€ public/              # Static assets
โ”‚   โ””โ”€โ”€ package.json         # Frontend dependencies
โ”œโ”€โ”€ pyproject.toml           # Python project configuration
โ””โ”€โ”€ README.md               # This file

๐Ÿ”ง Development

Backend Development

# Install in editable mode
pip install -e .

# Run backend only with auto-reload
lelab

Frontend Development

# Automatically clones, installs deps, and starts dev server
lelab-frontend

Full-Stack Development

# Start both backend and frontend with auto-reload
lelab-fullstack

Development Notes:

  • The frontend repository is automatically managed (cloned/updated)
  • Both commands auto-open your browser to the appropriate URL
  • Backend runs on http://localhost:8000
  • Frontend runs on http://localhost:8080 with API proxying

๐Ÿค Contributing

  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

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • LeRobot - The underlying robotics framework
  • FastAPI - Modern web framework for building APIs
  • React - Frontend user interface library

Note: Make sure your LeRobot environment is properly configured and your robot hardware is connected before running the application.