This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
CrazySim2Real is a comprehensive sim2real benchmarking framework for Crazyflie drones that enables evaluation of control algorithms in both simulation and real hardware environments. The project consists of two main components:
- Crazyflie Simulator (
crazyflie_sim/) - Physics-based drone simulator built on NVIDIA Isaac Lab - Benchmarking Framework (
crazyflie_benchmark/) - Unified testing interface for sim and real hardware
# Initialize git submodules (required for Isaac Lab)
./scripts/init.sh
# Install Python dependencies for benchmarking
pip install -r crazyflie_benchmark/requirements.txt# Start simulator with Docker (creates unique container instance)
./scripts/start.sh /workspace/isaaclab/CrazySim2Real/crazyflie_sim/run.py
# Start simulator with custom parameters
./scripts/start.sh /workspace/isaaclab/CrazySim2Real/crazyflie_sim/run.py --port 8000
# Stop all running simulator containers
./scripts/start.sh --stop-allcd crazyflie_benchmark
# List available test plans
python main.py --list-tests
# Run tests in simulation
python main.py --config config/simulator_config.yaml --test-plan step_tests.yaml
# Run tests on real hardware
python main.py --config config/hardware_config.yaml --test-plan step_tests.yaml
# Analyze test results
python main.py --analyze logs/20250513_001722-step-real/
# Compare sim vs real results
python main.py --compare logs/sim/20250513_005534-step-sim/ logs/real/20250513_001722-step-real/crazyflie_benchmark/ - Main testing framework
main.py- CLI entry point with comprehensive argument parsingcontroller.py- Flight controller interface for both sim and hardwareconnection.py- Connection management for hardware/simulatorsafety.py- Safety monitoring systemlogging_manager.py- Data logging and persistencedata_processor.py- Post-processing and metrics calculationplotter.py- Visualization and plotting utilitiestests/- Test implementations (StepTest, ImpulseTest, SineSweepTest)config/- Configuration files for hardware and simulator
crazyflie_sim/ - Isaac Lab-based simulator
sim/simulation_manager.py- Core simulation orchestration with DroneState dataclasscontrollers/- Controller implementations (PID, attitude control)api/- HTTP API server for external communicationrun.py- Simulator entry point script
Unified Interface: Both simulator and hardware use identical test protocols through the same controller interface, enabling direct sim2real comparison.
Safety-First Design: Built-in safety monitoring prevents dangerous commands on real hardware with configurable limits.
Modular Controllers: Controller architecture supports easy swapping between different control strategies (PID, attitude control, custom implementations).
Docker Integration: Simulator runs in Isaac Lab Docker container with volume mounting and automatic cleanup.
- Test plans (YAML) define test sequences (step, impulse, sine sweep)
- Main CLI loads config and instantiates appropriate connection (hardware/sim)
- FlightController executes test commands through unified interface
- SafetyMonitor validates all commands before execution
- LoggingManager captures telemetry data during tests
- DataProcessor analyzes results and generates metrics
- Plotter creates visualization outputs
- Hardware config: Crazyflie radio URI, hover thrust, safety limits
- Simulator config: Host/port, normalized thrust values
- Test plans: YAML files defining test parameters and sequences
- Safety limits: Configurable bounds for roll/pitch angles and thrust
The simulator uses thread-safe DroneState dataclass for state management between simulation thread and API server, ensuring consistent data access.