Skip to content

Latest commit

 

History

History
84 lines (61 loc) · 3.45 KB

File metadata and controls

84 lines (61 loc) · 3.45 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Overview

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.

Build and Development Commands

Building

  • cargo build - Development build
  • cargo build --release - Optimized release build with thin LTO

Running

  • cargo run config/quad.yaml - Run simulation with configuration
  • cargo run --release config/quad.yaml - Run optimized version

Testing and Quality

  • cargo test - Run all tests
  • cargo test --release - Run tests in release mode
  • cargo clippy - Run Rust linter for code quality
  • cargo fmt - Format code according to Rust standards
  • cargo check - Fast type checking without building

Running a Single Test

  • cargo test test_name - Run specific test by name
  • cargo test module_name:: - Run all tests in a module

Architecture Overview

The codebase follows a domain-driven modular structure:

Core Components

  1. 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
  2. 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
  3. 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)
  4. 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
  5. Environment (src/environment/)

    • Procedural maze generation with obstacles
    • Dynamic obstacle support with configurable movement patterns
    • Spatial queries for collision detection

Key Design Patterns

  • Configuration-Driven: All parameters loaded from YAML config files (config/quad.yaml)
  • Error Handling: Custom SimulationError type for comprehensive error management
  • Visualization: Real-time 3D visualization and telemetry via rerun.io integration
  • Performance: Optional parallelization for computationally intensive operations

External Dependencies

  • nalgebra: Linear algebra operations and transformations
  • rerun: 3D visualization and data logging
  • osqp: Quadratic programming solver for trajectory optimization
  • rand: Stochastic processes for sensor noise
  • rayon: Parallel computation for depth rendering

Testing Strategy

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.