This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Rust-based quadrotor autonomy framework for simulation, trajectory planning, and control. The project uses a modular architecture with clear separation between simulation physics, control algorithms, planning strategies, sensors, and visualization.
cargo build- Development buildcargo build --release- Optimized release build with thin LTO
cargo run config/quad.yaml- Run simulation with configurationcargo run --release config/quad.yaml- Run optimized version
cargo test- Run all testscargo test --release- Run tests in release modecargo clippy- Run Rust linter for code qualitycargo fmt- Format code according to Rust standardscargo check- Fast type checking without building
cargo test test_name- Run specific test by namecargo test module_name::- Run all tests in a module
The codebase follows a domain-driven modular structure:
-
Simulation Core (
src/quadrotor.rs)- Physics simulation with configurable integration methods (Euler, RK4)
- State management for position, velocity, orientation, and angular velocity
- Comprehensive dynamics modeling including drag effects
-
Control System (
src/control/)- PID controller with anti-windup for position and attitude control
- Separate gains for position (x,y,z) and attitude (roll,pitch,yaw) control
- Configurable control frequency separate from simulation frequency
-
Planning Layer (
src/planning/)- Basic: Hover, MinimumJerkLine planners
- Trajectory: Circle, Lissajous, Landing patterns
- Advanced: ObstacleAvoidance using potential fields, Waypoint navigation
- Optimization-based: Minimum snap trajectory generation using quadratic programming (OSQP)
-
Sensor Simulation (
src/sensors/)- IMU with configurable noise and bias parameters
- Depth camera with ray casting and configurable field of view
- Optional multi-threaded rendering for performance
-
Environment (
src/environment/)- Procedural maze generation with obstacles
- Dynamic obstacle support with configurable movement patterns
- Spatial queries for collision detection
- Configuration-Driven: All parameters loaded from YAML config files (
config/quad.yaml) - Error Handling: Custom
SimulationErrortype for comprehensive error management - Visualization: Real-time 3D visualization and telemetry via rerun.io integration
- Performance: Optional parallelization for computationally intensive operations
nalgebra: Linear algebra operations and transformationsrerun: 3D visualization and data loggingosqp: Quadratic programming solver for trajectory optimizationrand: Stochastic processes for sensor noiserayon: Parallel computation for depth rendering
Tests are organized alongside their modules and focus on:
- Unit tests for mathematical operations and transformations
- Integration tests for planner-controller interactions
- Simulation accuracy tests for physics and sensor models
When modifying planners or controllers, ensure corresponding tests are updated to verify trajectory generation and tracking performance.