USTC-WrightEagle-AI/26-WrightEagle.AI-MHRC-planning
GitHub: USTC-WrightEagle-AI/26-WrightEagle.AI-MHRC-planning
基于LLM的MHRC认知框架,为RoboCup@Home服务机器人提供自然语言到原子动作的端到端任务规划能力。
Stars: 0 | Forks: 0
# 基于 LLM 的任务规划系统
[](https://www.python.org/)
## 概述
本项目实现了 **MHRC 框架的单机器人变体**,专为 RoboCup@Home 竞赛设计。该系统利用大型语言模型(LLM)进行自然语言理解和任务规划,采用模块化架构,包含四个核心组件:Observation、Memory、Planning 和 Execution。
### 模块说明
| 模块 | 功能 | 实现状态 |
|--------|--------------|----------------------|
| **Observation** | 从 navigation、perception 和 manipulation 组件收集信息。 | ✅ 基础实现 |
| **Memory** | 记录任务执行历史和来自环境的反馈。 | ✅ 基础实现 |
| **Planning** | 基于 LLM 的任务分解,将任务分解为预定义的动作序列。 | ✅ 完整实现 |
| **Execution** | 动作执行、状态监控和反馈收集。 | ✅ 模拟实现 |
## 项目结构
```
LLM/
├── src/ # Source code
│ ├── main.py # Entry point
│ ├── config.py # Configuration
│ ├── config_local.example.py # Configuration template
│ ├── robot_controller.py # Main controller
│ └── modules/ # Four core modules
│ ├── observation/ # Observation module
│ │ ├── observer_interface.py # Observer interface
│ │ └── observers.py # Concrete observer implementations
│ ├── memory/ # Memory module
│ │ └── memory_manager.py # Memory manager
│ ├── planning/ # Planning module
│ │ ├── llm_client.py # LLM client
│ │ ├── prompts.py # Prompt templates
│ │ ├── schemas.py # Action schemas
│ │ └── planner.py # Task planner
│ └── execution/ # Execution module
│ ├── executor.py # Action executor
│ ├── mock_robot.py # Mock robot (for testing)
│ ├── robot_interface.py # Robot interface definition
│ └── feedback.py # Feedback collector
├── demo/ # Demo scripts
├── tests/ # Test cases
├── requirements.txt # Dependencies
└── setup.sh # Setup script
```
## 快速开始
### 1. 环境设置
**使用自动设置脚本(推荐):**
```
# 克隆 repository
git clone https://github.com/USTC-WrightEagle-AI/LLM.git
cd LLM
```bash
# 克隆 repository
git clone https://github.com/USTC-WrightEagle-AI/LLM.git
cd LLM
# 运行 setup script
bash setup.sh
```
该脚本将:
- 创建一个名为 `cade` 的 conda 环境(Python 3.11)
- 从 `requirements.txt` 安装所有依赖项
- 从模板创建配置文件
**手动设置:**
```
# 创建 conda environment
conda create -n cade python=3.11 -y
conda activate cade
# 安装 dependencies
pip install -r requirements.txt
# 复制 configuration template
cp src/config_local.example.py src/config_local.py
```
### 2. LLM 配置
**选项 A:云端 API(推荐用于开发)**
```
# 编辑 configuration file
nano src/config_local.py
# 添加你的 API key
# 支持的 providers: DeepSeek, Alibaba DashScope, OpenAI-compatible APIs
```
**选项 B:本地 Ollama**
```
# 安装 Ollama
curl -fsSL https://ollama.com/install.sh | sh
# Pull model
ollama pull qwen2.5:3b
# 在 config_local.py 中配置
MODE = RunMode.LOCAL
```
### 3. 运行系统
```
# 进入 source directory
cd src
# Interactive mode
python main.py
# Test mode (预定义 scenarios)
python main.py --test
# Demo mode
python main.py --demo
# Debug mode
python main.py --mode debug
```
### 4. 示例命令
```
User: Hello
User: Go to the kitchen
User: Help me find an apple
User: Place the apple on the table
User: status # Check robot status
User: stats # View statistics
User: quit # Exit
```
## 预定义动作集
遵循 MHRC 框架,我们的系统将自然语言指令分解为一系列预定义动作:
| 动作 | 描述 | 参数 | 示例 |
|--------|-------------|-----------|---------|
| `navigate` | 导航到目标位置 | `target`:位置名称或坐标 | `{"type": "navigate", "target": "kitchen"}` |
| `search` | 在环境中搜索物体 | `object_name`:目标物体名称 | `{"type": "search", "object_name": "apple"}` |
| `pick` | 抓取目标物体 | `object_name`,`object_id`(可选) | `{"type": "pick", "object_name": "bottle"}` |
| `place` | 将手持物体放置在指定位置 | `location`:目标放置位置 | `{"type": "place", "location": "table"}` |
| `speak` | 输出语音内容 | `content`:要朗读的文本 | `{"type": "speak", "content": "Task completed"}` |
| `wait` | 等待 / 无操作 | `reason`(可选):等待原因 | `{"type": "wait", "reason": "awaiting user"}` |
这些动作使用 **Pydantic schemas** 进行验证,以确保格式正确和类型安全。
标签:AI风险缓解, C2, DLL 劫持, LLM, MHRC, Petitpotam, Python, RoboCup@Home, Unmanaged PE, 人工智能, 人机交互, 任务分解, 任务规划, 决策系统, 动作执行, 大语言模型, 导航, 无后门, 智能家居, 服务机器人, 机器人, 机器人控制, 模块化架构, 环境感知, 用户模式Hook绕过, 认知框架, 逆向工具