Skip to content

ZXiiiC/SRDrone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

SRDrone: LLM-Driven Autonomous UAV Planning System with Continuous Evaluation and Reflective Optimization

Paper License ROS Language

๐Ÿ“– Overview

SRDrone is an open-source implementation of the LLM-driven autonomous UAV planning system presented in our research paper. The system achieves two key goals: (1) robustly evaluating task execution outcomes to detect planning flaws, and (2) driving progressive refinement to ensure successful task completion.

๐ŸŽฏ Research Contributions

This work makes the following key contributions to the field of autonomous aerial robotics:

  1. Continuous State Evaluation Framework: Enables reliable outcome determination and interpretable anomaly attribution for drone operations through Action-Centric State Capture and CMSR algorithm.

  2. Hierarchical BT Modification: Facilitates a two-stage refinement process that generates structural reflective experience and guarantees the reliability of behavior tree refinements.

  3. Closed-Loop Learning System: Establishes an iterative improvement mechanism where each cycle updates the Experience Base with validated corrections, enabling continuous planning enhancement.

๐Ÿ—๏ธ System Architecture

The system consists of two main phases:

Task Execution Phase

  • Action-Centric State Capture: Filters critical flight states from high-frequency drone data streams
  • CMSR Algorithm: Performs spatiotemporal semantic extraction, converting multidimensional temporal sensor data into natural language task narratives
  • Task Determination: Generates interpretable diagnostic insights for subsequent planning optimization

Reflective Optimization Phase

  • Hierarchical BT Analysis: Localizes errors across behavioral execution, logical conditions, and planning structure
  • Dual-Constraint Processing: Ensures operational feasibility within hardware/software boundaries and structural validity
  • Node-Level Correction: Generates precise correction specifications for behavioral and logical nodes

๐Ÿ“ Project Structure

SRDrone
โ”œโ”€โ”€ common_msgs/                    # Custom ROS message definitions
โ”‚   โ”œโ”€โ”€ msg/                        # Message types (Aruco, Obj, Objects, MissionState)
โ”œโ”€โ”€ controller/                     # Flight control module (C++17)
โ”‚   โ”œโ”€โ”€ src/ros1_node.cpp          # Main control node (BehaviorTree engine)
โ”‚   โ”œโ”€โ”€ config/mav.xml             # Behavior tree definition
โ”‚   โ””โ”€โ”€ config/*.yaml              # Configuration parameters
โ”œโ”€โ”€ evaluator/                      # ๐Ÿ†• Task execution evaluation module
โ”‚   โ”œโ”€โ”€ pipeline.py                # 3.2 evaluator pipeline scaffold
โ”‚   โ””โ”€โ”€ ARCHITECTURE.md            # Evaluator design notes
โ”œโ”€โ”€ reflector/                      # ๐Ÿ†• Reflective optimization module  
โ”‚   โ”œโ”€โ”€ pipeline.py                # 3.3 reflector pipeline scaffold
โ”‚   โ””โ”€โ”€ ARCHITECTURE.md            # Reflector design notes
โ”œโ”€โ”€ object_det/                     # Object detection module (Python)
โ”‚   โ”œโ”€โ”€ scripts/det.py             # Main detection node (YOLO)
โ”‚   โ””โ”€โ”€ scripts/ObjectDetect.py    # YOLO inference core
โ”œโ”€โ”€ recognize_aruco/                # ArUco marker recognition
โ”œโ”€โ”€ sensor_pkg/                     # Sensor driver and data adaptation
โ”œโ”€โ”€ workflow/                       # Closed-loop orchestration scaffold
โ”‚   โ”œโ”€โ”€ cli.py                     # Workflow runner
โ”‚   โ”œโ”€โ”€ parsers/controller_btlog.py# BTlog session parser
โ”‚   โ””โ”€โ”€ IMPLEMENTATION_3_2_3_3.md  # Implementation notes
โ””โ”€โ”€ sh/                            # System launch scripts

๐Ÿš€ Key Features

๐Ÿง  Intelligent Decision Making

  • Behavior Tree Framework: Modular and extensible task decision logic using BehaviorTree.CPP
  • Multi-Source Perception: YOLO deep learning object detection + ArUco marker recognition
  • Sensor Fusion: GNSS/IMU data fusion (Faster-LIO/Ego-Planner stack)

๐ŸŽฏ Advanced Capabilities

  • Visual Servoing: Multi-camera parallel processing (forward + downward views)
  • Adaptive Planning: Real-time trajectory planning and execution
  • Continuous Learning: Closed-loop improvement through experience accumulation

๐Ÿ”ง Comprehensive Integration

  • Simulation Support: RflySim virtual simulation environment
  • Hardware Support: RealSense/Livox hardware compatibility
  • System Orchestration: Automated launch scripts coordinating multiple ROS nodes

๐Ÿ“‹ Installation

System Requirements

  • OS: Ubuntu 18.04/20.04 LTS
  • ROS: ROS1 Melodic/Noetic
  • C++: C++17 standard
  • GPU: Optional (CUDA 10.2+, cuDNN 7.6+ for YOLO acceleration)

Quick Start

# 1. Create ROS workspace
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws

# 2. Clone repository
cd src
git clone https://github.com/your-repo/SRDrone.git
cd ..

# 3. Install dependencies
rosdep install --from-paths src --ignore-src -r -y

# 4. Build project
catkin build

# 5. Source environment
source devel/setup.bash

Dependencies

Core Dependencies

Package Purpose License
ROS1 Middleware BSD
BehaviorTree.CPP Decision Framework MIT
YOLO v5/v8 Object Detection AGPL-3.0
OpenCV Image Processing Apache-2.0
PCL Point Cloud Processing BSD
MAVROS Flight Controller Interface BSD

External Planning Stack

  • Faster-LIO: GNSS-IMU fusion localization
  • Ego-Planner: Trajectory planning
  • RflySim: Virtual simulation platform

๐ŸŽฎ Usage

Simulation Mode

# Launch simulation environment
cd ~/catkin_ws/src/SRDrone/sh
bash start_sim.sh

# Monitor execution
tail -f ~/catkin_ws/src/SRDrone/controller/config/BTlog.txt

# Visualize in RViz
rviz -d ~/catkin_ws/src/SRDrone/sensor_pkg/rflysim.rviz

Real Flight Mode

# Launch real flight stack
cd ~/catkin_ws/src/SRDrone/sh
bash start_control.sh

# Manual control (for debugging)
rostopic pub /mavros/set_mode mavros_msgs/SetMode "{base_mode: 0, custom_mode: 'OFFBOARD'}"
rosservice call /mavros/cmd/arming "value: true"

Custom Behavior Trees

Edit controller/config/mav.xml to customize mission workflows:

<root BTCPP_format="4">
    <BehaviorTree ID="MainTree">
        <Sequence>
            <Condition ID="Check_Takeoff"/>
            <Action ID="Takeoff"/>
            <Condition ID="Check_cross_frame1"/>
            <Action ID="Cross_frame1"/>
            <Condition ID="Check_Land"/>
            <Action ID="Land"/>
        </Sequence>
    </BehaviorTree>
</root>

Workflow Mode (Paper 3.2/3.3 Scaffold)

Run the closed-loop scaffold (default reads controller/config/BTlog.txt):

python3 -m workflow.cli \
  --mission-id demo_mission \
  --max-cycles 1 \
  --state-source controller_log \
  --controller-log-path controller/config/BTlog.txt

Notes:

  • Stage-A input source is controller-filtered BT logs (no duplicate filtering in workflow).
  • BTlog is parsed per run session: one plan XML block (<root ...>...</root>) + following filtered log block.
  • Session selection policy is reverse chronological (cycle=0 uses latest session).
  • Evaluator/Reflector stages are text-first outputs (LLM free-form text), with optional structured fields for engineering/debug.

Use stub input source for local debugging:

python3 -m workflow.cli --state-source stub --max-cycles 1

๐Ÿ“Š Performance Metrics

Evaluation Framework

  • Real-time Processing: State evaluation latency < 100ms
  • Accuracy: Task execution determination accuracy > 95%
  • Interpretability: Anomaly attribution interpretability score > 0.8

Planning Optimization

  • Correction Accuracy: Behavior tree modification accuracy > 90%
  • Success Rate: Planning refinement success rate > 85%
  • Learning Efficiency: Continuous improvement through experience accumulation

๐Ÿงช Development Status

โœ… Implemented Modules

  • Common message definitions
  • Flight control with Behavior Trees
  • Multi-camera object detection
  • ArUco marker recognition
  • Sensor integration (RflySim/RealSense)
  • Launch orchestration scripts

๐Ÿšง Under Development

  • Evaluator Module: Continuous state evaluation framework
  • Reflector Module: Hierarchical behavior tree modification
  • Experience base and learning mechanisms
  • Advanced visualization tools

๐Ÿ“… Planned Features

  • Multi-UAV coordination
  • Advanced simulation scenarios
  • Real-world deployment guides
  • Performance benchmarking suite

๐Ÿ“š Research Context

This implementation is based on the following research contributions:

Core Algorithms

  • CMSR (Continuous Multi-Semantic Representation): Spatiotemporal semantic extraction for sensor-to-language conversion
  • Hierarchical BT Modification: Two-stage refinement with dual-constraint processing
  • Action-Centric State Capture: Critical flight state filtering from high-frequency data streams

Theoretical Foundations

  • Behavior Trees in robotics and autonomous systems
  • Visual servoing control theory
  • Multi-sensor fusion and state estimation
  • Continuous learning and experience accumulation

๐Ÿ“– Documentation

๐Ÿค Contributing

We welcome contributions from the research community! Please follow our contribution guidelines:

Development Workflow

  1. Fork this repository
  2. Create a feature branch (git checkout -b feature/your-feature)
  3. Commit your changes (git commit -am 'Add your feature')
  4. Push to the branch (git push origin feature/your-feature)
  5. Create a Pull Request

Code Standards

  • C++: Follow Google C++ Style Guide, use clang-format
  • Python: Follow PEP 8, use 4-space indentation
  • Commits: Use conventional commit format (feat:, fix:, docs:, etc.)

๐Ÿ“„ License

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

๐Ÿ™ Acknowledgments

We thank the following open-source projects and communities:

  • ROS community and MAVROS maintainers
  • BehaviorTree.CPP development team
  • YOLO official and ultralytics team
  • PCL and OpenCV communities
  • RflySim virtual simulation platform team

๐Ÿ“ž Contact

๐Ÿ“„ Citation

If you use this work in your research, please cite our paper:

@article{zhang2025llm,
  title={LLM-Driven Self-Refinement for Embodied Drone Task Planning},
  author={Zhang, Deyu and Zhang, Xicheng and Li, Jiahao and Long, Tingting and Dai, Xunhua and Fu, Yongjian and Zhang, Jinrui and Ren, Ju and Zhang, Yaoxue},
  journal={arXiv preprint arXiv:2508.15501},
  year={2025}
}

Last Updated: November 2024
Version: 1.0.0
Status: Active Development

About

Implementation of SRDrone

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages