| # Hierarchical System ROS2 | |
| ## 0- 前言 | |
| ### What we have | |
| - 主要逻辑(python)文件夹及文件的路径及命名如下 | |
| ``` | |
| src/ | |
| └── g0_vlm_node/ | |
| └── g0_vlm_node | |
| ├── utils/ # 储存与Gemini api处理相关的func | |
| └── vlm_main.py # VLM提供服务的核心逻辑 | |
| ``` | |
| - 注:以上包内: | |
| - vlm_main.py | |
| ### 开发说明 | |
| - VLM | |
| 1. 将String格式化,使得EHI发送的json字符串,改为结构化字符串 | |
| 2. 支持接收EHI的缓存开关 | |
| 3. 支持参数化启动,用`--use-qwen`和`--no-use-qwen`控制模型使用,默认是Gemini | |
| ## 1- Install | |
| 1. 安装Python依赖库 | |
| 参考https://github.com/whitbrunn/G0 | |
| 2. 编译工作空间 | |
| 将`src/`文件夹clone到本地工作空间下`TO/YOUR/WORKSPACE/`,运行 | |
| ``` | |
| cd TO/YOUR/WORKSPACE/ | |
| colcon build --symlink-install --cmake-args -DPython3_ROOT_DIR=$CONDA_PREFIX | |
| ``` | |
| Note: | |
| 用`ros2 pkg list | grep PACK_NAME` 检查是否有以下ROS包: | |
| - `g0_vlm_node` | |
| ## 2- Usage | |
| 1. 设置api key | |
| ``` | |
| export API_KEY=<YOUR_GEMINI_API_KEY> | |
| export API_KEY_QWEN=<YOUR_QWEN_API_KEY> | |
| ``` | |
| 2. 启动VLM Node | |
| 1.1 先按所在环境配置代理(Gemini之必需,若使用qwen版,请跳到1.3) | |
| ``` | |
| export https_proxy=http://127.0.0.1:<PORT> | |
| export http_proxy=http://127.0.0.1:<PORT> | |
| export all_proxy=http://127.0.0.1:<PORT> | |
| ``` | |
| 1.2 验证外网是否可通 | |
| ``` | |
| curl -I www.google.com | |
| ``` | |
| 预期显示(部分), | |
| ``` | |
| HTTP/1.1 200 OK | |
| Transfer-Encoding: chunked | |
| Cache-Control: private | |
| Connection: keep-alive | |
| ``` | |
| 1.3 确定上一步OK后,启动VLM节点 | |
| ``` | |
| ros2 run g0_vlm_node vlm_main | |
| ``` | |
| *若使用qwen模型推理 | |
| ``` | |
| unset http_proxy | |
| unset https_proxy | |
| unset all_proxy | |
| ros2 run g0_vlm_node vlm_main -- --use-qwen | |
| ``` | |
| ## 3- What you expect | |
| - VLM收到Send请求输出,e.g., | |
| ``` | |
| 2025-11-05 07:40:33.230 | INFO | g0_vlm_node.vlm_main:vlm_processor1:153 - One hp successfully processed: 将咖啡罐用右手放到托盘上 -> [Low]: Pick up the coffee can with the right hand and place it on the tray.! | |
| ``` | |
| - VLM收到confirm请求,e.g., | |
| ``` | |
| 2025-11-05 07:40:47.641 | INFO | g0_vlm_node.vlm_main:vlm_processor2:169 - One hp_ successfully sent to VLA: [Low]: Pick up the coffee can with the right hand and place it on the tray.! | |
| ``` | |