Install
openclaw skills install @threelevelchord/ros-noetic-nav-cartographerROS Noetic navigation system using Cartographer for localization, interfacing via TF and rosbridge to control move_base for waypoint navigation.
openclaw skills install @threelevelchord/ros-noetic-nav-cartographer专为使用Cartographer定位的ROS Noetic导航系统设计。通过TF获取位姿,通过rosbridge与move_base交互。
必须启动 rosbridge_server:
source /opt/ros/noetic/setup.bash
roslaunch rosbridge_server rosbridge_tcp.launch
Cartographer导航系统:
# 示例启动命令(根据实际项目调整)
roslaunch robot_navigation navigation_with_cartographer_cpp.launch
如果没有运行rosbridge,所有导航命令都会失败!
| 特性 | 原版 (AMCL) | Cartographer版 |
|---|---|---|
| 定位算法 | AMCL | Cartographer |
| 位姿获取 | /amcl_pose Topic | TF变换 |
| 地图格式 | .pgm + .yaml | .pbstream |
| 重定位 | 自动 | 需手动设置初始位姿 |
ros-noetic-nav-cartographer/
├── SKILL.md # 本说明文档
├── waypoints.json # Cartographer专用航点
└── scripts/
├── waypoints_manager.py # 航点管理
├── nav.py # 导航脚本(单点+巡航)
└── get_pose_tf.py # 通过TF获取位姿
在 TOOLS.md 中添加:
### ROS Noetic Navigation - Cartographer
- workspace: ~/robot5 # 根据实际项目调整
- rosbridge_host: localhost
- rosbridge_port: 9090
- pose_tf_target: base_link # 小车坐标系
- pose_tf_source: map # 地图坐标系
- waypoints_file: ~/.openclaw/workspace/skills/ros-noetic-nav-cartographer/waypoints.json
- map_file: ~/robot5/src/robot_navigation/maps/my_map.pbstream
# 基本查询
python3 scripts/get_pose_tf.py
# 指定坐标系
python3 scripts/get_pose_tf.py --target-frame base_footprint --source-frame map
# JSON格式输出
python3 scripts/get_pose_tf.py --json
# 列出所有航点
python3 scripts/waypoints_manager.py list
# 添加航点
python3 scripts/waypoints_manager.py add 充电座 --x 0.0 --y 0.0 --yaw 0
python3 scripts/waypoints_manager.py add 客厅 --x 3.0 --y 2.0 --yaw 90
# 获取航点
python3 scripts/waypoints_manager.py get 客厅
# 删除航点
python3 scripts/waypoints_manager.py remove 客厅
# 使用命名航点
python3 scripts/nav.py goto 客厅
# 自然语言命令
python3 scripts/nav.py cmd "去客厅"
# 巡航多个航点
python3 scripts/nav.py cruise 卧室 餐厅 书房
# 自然语言命令
python3 scripts/nav.py cmd "去卧室 餐厅 书房"
python3 scripts/nav.py goto 客厅 --host 192.168.1.100 --port 9090
| 参数 | 说明 | 默认值 |
|---|---|---|
--host | rosbridge主机 | localhost |
--port | rosbridge端口 | 9090 |
--timeout | 导航超时(秒) | 180 |
--target-frame | TF目标坐标系(小车) | base_link |
--source-frame | TF源坐标系(地图) | map |
启动rosbridge:
roslaunch rosbridge_server rosbridge_tcp.launch
启动Cartographer导航:
roslaunch robot_navigation navigation_with_cartographer_cpp.launch
在RViz中手动重定位(2D Pose Estimate)
驾驶小车到目标位置,记录航点:
# 获取当前位置
python3 scripts/get_pose_tf.py
# 保存航点
python3 scripts/waypoints_manager.py add 客厅 --x <x值> --y <y值> --yaw <角度>
测试导航:
python3 scripts/nav.py goto 客厅
map -> base_link 变换# 检查rosbridge是否运行
curl http://localhost:9090
# 启动rosbridge
roslaunch rosbridge_server rosbridge_tcp.launch
# 检查TF树
rosrun tf view_frames
# 检查Cartographer是否正常发布TF
rostopic echo /tf
# 检查话题
rostopic list | grep cartographer
# 检查move_base状态
rostopic echo /move_base/status
# 检查目标是否发布
rostopic echo /move_base_simple/goal