# lpigeon
## 基本信息
- Slug: `lpigeon-unitree-go2-mcp-server`
- Source: modelscope
- Publisher: @lpigeon/unitree-go2-mcp-server
- Categories: os-automation / home-automation-and-iot / command-line
- Hosted: No
- License: Apache License 2.0
- Source URL: https://www.modelscope.cn/mcp/servers/@lpigeon/unitree-go2-mcp-server
## 简介
暂无描述。
## MCP Server 详情

# Unitree Go2 MCP 服务器
![ROS 2](https://img.shields.io/badge/ROS_2-Foxy|Humble-blue)
![静态徽章](https://img.shields.io/badge/License-Apache2.0-green)

<center><img src="https://github.com/lpigeon/unitree-go2-mcp-server/blob/main/img/thumbnail.png" width="800"/></center>

**Unitree Go2 MCP 服务器** 是一个基于模型上下文协议（MCP）构建的服务器，它允许用户通过大型语言模型（LLM）解释的自然语言命令来控制 Unitree Go2 机器人。这些命令被转换为 ROS2 指令，使机器人能够执行相应的动作。

<a href="https://glama.ai/mcp/servers/@lpigeon/unitree-go2-mcp-server">
  <img width="380" height="200" src="https://glama.ai/mcp/servers/@lpigeon/unitree-go2-mcp-server/badge" alt="Unitree Go2 服务器 MCP 服务器" />
</a>

## 要求

- **Unitree Go2 机器人**
- **Ubuntu 20.04 或 22.04**
- **ROS2 环境** : [Humble](https://docs.ros.org/en/humble/Installation.html)（推荐）或 [Foxy](https://docs.ros.org/en/foxy/Installation.html)

## MCP 功能

您可以在 [MCPFUNCTIONS.md](MCPFUNCTIONS.md) 中找到功能列表。

## 安装

### 1. 设置 `unitree_ros2` 环境

https://github.com/unitreerobotics/unitree_ros2

- **您需要完成上述仓库中的设置，直到“步骤 2：连接和测试”。**

### 2. 克隆此仓库

bash
git clone https://github.com/lpigeon/unitree-go2-mcp-server.git
cd unitree-go2-mcp-server


### 3. `uv` 安装
- 要安装 `uv`，您可以使用以下命令：
bash
curl -LsSf https://astral.sh/uv/install.sh | sh

或者
bash
pip install uv


- 创建虚拟环境并激活它（可选）
bash
uv venv
source .venv/bin/activate


### 4. MCP 服务器配置
将 MCP 设置写入 mcp.json。

**请记住，配置必须在连接到 Go2 的 PC 上进行。**

bash
{
    "mcpServers": {
        "unitree-go2-mcp-server": {
            "command": "uv",
            "args": [
              "--directory",
              "/ABSOLUTE/PATH/TO/PARENT/FOLDER/unitree-go2-mcp-server",
              "run",
              "server.py"
            ]
        }
    }
}


如果您使用 Claude Desktop，可以使用以下命令找到 mcp.json：

- MacOS
bash
code ~/Library/Application Support/Claude/claude_desktop_config.json


- Linux(Ubuntu)
  
您可以安装 Claude Desktop 来使用 [claude-desktop-debian](https://github.com/aaddrick/claude-desktop-debian)。

bash
code ~/.config/Claude/claude_desktop_config.json


- Windows
bash
code $env:AppDataClaudeclaude_desktop_config.json


## 如何使用
### 1. 设置 `UNITREE_ROS2_SETUP_SH_PATH`。
- 打开 `server.py` 并更改您的 `UNITREE_ROS2_SETUP_SH_PATH`（例如 `/home/lpigeon/unitree_ros2/setup.sh`）

#### 如果您使用 `rosbridge`，则需要设置 IP 和端口以连接 rosbridge（可选）。
- 打开 `server.py` 并更改您的 `LOCAL_IP`、`ROSBRIDGE_IP` 和 `ROSBRIDGE_PORT`。（`ROSBRIDGE_PORT` 的默认值是 `9090`）

### 2. 检查 Go2 机器人是否已连接到网络。
在终端中输入以下命令。
bash
ros2 topic list

您应该看到以下主题：
bash
/wirelesscontroller

**如果看不到该主题，请检查 Go2 机器人与网络之间的连接。**

### 3. 运行任何已导入 `unitree-go2-mcp-server` 的 AI 系统。

### 4. 输入“让 Go2 机器人以 0.5 米/秒的速度前进 3 秒”。

<center><img src="https://github.com/lpigeon/unitree-go2-mcp-server/blob/main/img/how_to_use_1.png" width="500"/></center>

### 5. 检查 Go2 机器人的移动情况。

<center><img src="https://github.com/lpigeon/unitree-go2-mcp-server/blob/main/img/how_to_use_2.gif" width="500"/></center>

### 6. 输入您想要执行的操作并享受！

## 上下文理解当你输入类似“看起来Go2有点累了”这样的命令时，大语言模型会根据上下文进行理解——明白机器人可能需要休息或某种形式的伸展！

<center><img src="https://github.com/lpigeon/unitree-go2-mcp-server/blob/main/img/contextual_understanding.gif" width="800"/></center>

## 简单任务
这个任务是一个综合性的演示任务，展示了Unitree Go2机器人的避障、方向变换以及用户交互能力。

<center><img src="https://github.com/lpigeon/unitree-go2-mcp-server/blob/main/img/task_test.gif" width="800"/></center>

## 贡献
欢迎贡献！  
无论你是修正拼写错误、添加新功能还是提出改进建议，你的帮助都是被感激的。  
请遵循[贡献指南](CONTRIBUTING.md)以获取更多关于如何为本项目做贡献的详细信息。

