# 🤖 RoboPARA: Dual-Arm Robot Planning with Parallel Allocation and Recomposition Across Tasks

This repository contains the official implementation of **RoboPARA**, a novel large language model (LLM)-driven framework for solving the **Dual-Arm Cooperative Scheduling Problem**. RoboPARA introduces a two-stage planning architecture that explicitly optimizes dual-arm parallelism in complex multitask scenarios, supported by a newly constructed dataset **X-DAPT**.

> 📄 This repository accompanies our ICLR 2026 submission:
>  *"RoboPARA: Dual-Arm Robot Planning with Parallel Allocation and Recomposition Across Tasks"*

------

## 🧩 Overview

RoboPARA addresses the dual-arm task planning challenge through a two-stage pipeline:

1. **Dependency Graph-based Planning Candidates Generation**
   - Natural language instructions are processed via Retrieval-Augmented Generation (RAG).
   - A structured prompt incorporating environment states and historical knowledge is used to generate a task-level Directed Acyclic Graph (DAG).
   - A verification module detects and corrects structural errors in the DAG.
2. **Graph Re-Traversal-based Dual-Arm Parallel Planning**
   - A dual-arm schedule is constructed from the corrected DAG.
   - Scheduling algorithms optimize makespan while ensuring arm exclusivity, lock consistency, and deadlock prevention.

------

## 🗂 Repository Structure

```
├── memory/
│   ├── long_term_memory/       
│   └── short_term_memory/      
├── prompts/                    
├── src/
│   ├── RAG.py 
│   ├── DAG.py 
│   ├── plan.py
│   └── main.py
├── plot/        
├── requirements.txt
└── README.md
```

------

## 📦 Installation

```bash
pip install -r requirements.txt
```

You will need:

- OpenAI API key or DeepSeek V3 endpoint (for LLM inference)
- Python 3.8+

------

## 🚀 Usage

Import your GPT-4o API key path in  `main.py` .

```python
api_path = "YOUR_API_KEY_PATH"
```

If you are **not using a proxy**, you can safely comment out or remove these lines in `RAG.py`. If you're using a proxy, make sure the proxy is already running before executing the program.

```python
os.environ["http_proxy"] = "http://your.proxy.ip:port"
os.environ["https_proxy"] = "http://your.proxy.ip:port"
```

Edit the `main.py` to define your instruction and run the planner.

```bash
instruction = "Prepare carrot slices and cream bread (Complete the kitchen scene package A, B)."
```

```bash
python src/main.py
```

The system will:

1. Retrieve relevant procedural knowledge via RAG.
2. Generate and correct dependency graphs with LLM.
3. Schedule an optimized dual-arm execution plan.
4. Output synchronized action plans with timestamps and arm assignments.

------

## 🧠 Key Features

- **LLM-Driven Dependency Graph Generation**
   Constructs a task-level DAG using memory-augmented LLM prompting, with error correction via structural rules.
- **Deadlock-Aware Scheduling Algorithm**
   Incorporates rollback strategy to resolve inter-arm lock contention in real time.
- **Pick-Use-Place Semantics**
   Enforces structured action chains (e.g., pick → use → place) per object and tool type.
- **Inter-Package Optimization**
   Merges redundant operations across task packages to reduce execution steps and time.
- **Two-Arm Parallelism Maximization**
   Enables fine-grained synchronization, consistently achieving 2.8× to 10× more parallel steps than baseline methods.

------

## 📊 Benchmark Dataset: X-DAPT

RoboPARA is evaluated on the newly introduced **Cross-Scenario Dual-Arm Parallel Task Dataset (X-DAPT)**, the first dataset designed for benchmarking dual-arm parallel planning. The full dataset will be released upon acceptance.

- 🔟 Scenes: kitchen, office, factory, agricultural greenhouse, etc.
- 📦 >1000 task packages with three difficulty levels (easy, medium, hard)
- 📈 Evaluates execution efficiency, failure rate, and dual-arm parallelism

------

## 📌 Evaluation Metrics

- **Total Execution Index (TEI)**: Speed-performance composite score
- **Task Failure Rate (TFR)**: Planning robustness under complexity
- **Parallel Planning Ratio (PPR)**: Degree of intra-package parallel steps
- **Arm Parallelism Ratio (APR)**: Average dual-arm simultaneous usage

RoboPARA consistently achieves state-of-the-art results across all metrics and baselines.

------

## 🤖 Real-World Deployment

RoboPARA has been validated using **Franka Research 3** and **UR5e** robotic platforms, executing task plans in real kitchen and greenhouse scenes. It demonstrates human-like dual-arm coordination with over **30% to 50% execution time reduction**.

