import React, { useState } from "react"; import { Button } from "../components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "../components/ui/card"; import { Alert, AlertDescription } from "../components/ui/alert"; import { PortManager } from "../components/PortManager"; import { CalibrationPanel } from "../components/CalibrationPanel"; import { TeleoperationPanel } from "../components/TeleoperationPanel"; import { isWebSerialSupported } from "../../lerobot/web/calibrate"; import type { RobotConnection } from "../../lerobot/web/types/robot-connection.js"; interface HomeProps { onGetStarted: () => void; connectedRobots: RobotConnection[]; onConnectedRobotsChange: (robots: RobotConnection[]) => void; } export function Home({ onGetStarted, connectedRobots, onConnectedRobotsChange, }: HomeProps) { const [calibratingRobot, setCalibratingRobot] = useState(null); const [teleoperatingRobot, setTeleoperatingRobot] = useState(null); const isSupported = isWebSerialSupported(); const handleCalibrate = ( port: SerialPort, robotType: "so100_follower" | "so100_leader", robotId: string ) => { // Find the robot from connectedRobots const robot = connectedRobots.find((r) => r.port === port); if (robot) { setCalibratingRobot(robot); } }; const handleTeleoperate = (robot: RobotConnection) => { setTeleoperatingRobot(robot); }; const handleFinishCalibration = () => { setCalibratingRobot(null); }; const handleFinishTeleoperation = () => { setTeleoperatingRobot(null); }; return (
{/* Header */}

🤖 LeRobot.js

State-of-the-art AI for real-world robotics in JavaScript

{!isSupported && ( Web Serial API is not supported in this browser. Please use Chrome, Edge, or another Chromium-based browser to use this demo. )}
{/* Main Content */} {calibratingRobot ? (
) : teleoperatingRobot ? ( ) : (
)}
); }