No version for distro humble. Known supported distros are highlighted in the buttons above.
No version for distro jazzy. Known supported distros are highlighted in the buttons above.
No version for distro kilted. Known supported distros are highlighted in the buttons above.
No version for distro rolling. Known supported distros are highlighted in the buttons above.
Repository Summary
Description | sim_llm 是一个基于 ROS2 的仿真测试,使用当下热门的大语言模型控制 turtle 做出一些简单的行动。 |
Checkout URI | https://github.com/lalafua/sim_llm.git |
VCS Type | git |
VCS Version | main |
Last Updated | 2025-05-12 |
Dev Status | UNKNOWN |
Released | UNRELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
Name | Version |
---|---|
llm_robot | 0.0.0 |
my_interfaces | 0.0.0 |
robot_description | 0.0.0 |
robot_navigation2 | 0.0.0 |
README
sim_llm
介绍
此仓库基于 ROS2 Humble 开发,原 ROS1 分支可以在新开的仓库查看: sim_llm_ROS1
相较于 ROS1 Noetic 上的实现,该分支做了如下改动:
- urdf 建模替换,帮助调试 TF Tree
- 建图算法使用 Cartographer ( ROS1 为 gmapping )
- 导航框架使用 Nav2( ROS1 为 map_server 和 move_base )
改动主要是适配 ROS1 -> ROS2 的功能包切换升级,顶层控制逻辑并没有改变
Demo
顶层逻辑
顶层任务逻辑分三个 node
完成:
-
llm_nlp node
:自然语言处理节点。接收用户输入,调用 SiliconFlow api ,通过给 AI 合适的 prompt 将自然语言转换为 Json 字符串,并将其作为服务请求发送到/llm_nlp/cmd
服务。 -
camera node
:识别节点。从摄像头捕获图像,使用 Roboflow 模型进行物体检测,然后将检测结果发布到/camera/recognized
。为了缓解识别图像造成的卡顿掉帧,通过多线程处理捕获操作和帧操作,同时也可以避免阻塞定时器的回调任务。 -
llm_robot node
:控制节点。通过 TF Tree :map -> base_footprint
的变换关系,获得机器人的实时坐标;订阅camera
节点发布的/camera/recognized
识别的目标信息;使用nav2_simple_commander.robot_navigator
的BasicNavigator
类,执行简单的导航任务。
参考
- TF2
- Navigation2
- Cartographer
- 鱼香ROS
- ROS2 Cookbook
- Gemini2.0 Flash Thinking
部署
先决条件
- 我的开发环境
==============================
ROS2 Development Environment
==============================
OS Info: Linux ubuntu2204 6.8.0-52-generic #53~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jan 15 19:18:46 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Python Version: Python 3.10.12
Gcc Version: gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
CMake Version:cmake version 3.22.1
ROS Distro: humble
=============================
你应该还要准备一个摄像头
- clone 该项目
git clone https://github.com/lalafua/sim_llm.git
cd sim_llm/
- 安装 python 依赖
pip install -r requirements.txt
-
设置环境变量
打开 .bashrc , 在最后添加:
export SILICONFLOW_API_KEY = "<your SiliconFlow api key>"
- 注:也可以替换为其他大模型供应商的 API , 最好支持 openai 的 API 调用方式
- 编译工程文件
colcon build --symlink-install
运行
打开两个终端 分别运行
source install/setup.bash
ros2 run llm_robot llm_nlp
```bash source install/setup.bash ros2 launch llm_robot llm_robot.launch.py
File truncated at 100 lines see the full file
CONTRIBUTING
No version for distro galactic. Known supported distros are highlighted in the buttons above.
No version for distro iron. Known supported distros are highlighted in the buttons above.
No version for distro melodic. Known supported distros are highlighted in the buttons above.
No version for distro noetic. Known supported distros are highlighted in the buttons above.