@[TOC](ROS2-V3.5 (Humble) 常用命令手册)


一、远程登录与文件挂载

1️ SSH 登录机器人

ssh -Y wheeltec@192.168.0.100
密码 :dongguan
  • -Y:开启图形界面转发(支持运行 RViz、rqt 等 GUI 程序)

2️ NFS 网络文件系统

🔹 挂载远程目录
sudo mount -t nfs 192.168.0.100:/home/wheeltec/wheeltec_ros2 /mnt
🔹 解除挂载
sudo umount -t nfs 192.168.0.100:/home/wheeltec/wheeltec_ros2 /mnt

二、基础功能启动

功能 启动命令
打开底盘 ros2 launch turn_on_wheeltec_robot turn_on_wheeltec_robot.launch.py
打开底盘控制 ros2 launch turn_on_wheeltec_robot turn_on_wheeltec_robot.launch.py
打开相机 ros2 launch turn_on_wheeltec_robot wheeltec_camera.launch.py
打开雷达 ros2 launch turn_on_wheeltec_robot wheeltec_lidar.launch.py
同时打开雷达+相机+底盘 ros2 launch turn_on_wheeltec_robot wheeltec_sensors.launch.py

三、编译与构建

1️ 标准构建

colcon build

2️ 忽略示例包构建(推荐)

colcon build --event-handlers console_direct+ --cmake-args -DCMAKE_BUILD_TYPE=Release --packages-ignore Samples

3️仅编译指定功能包

colcon build --packages-select turn_on_wheeltec_robot

4️ 启用环境变量

source install/setup.bash

四、相机与图像可视化

启动相机节点

ros2 launch astra_camera astra_mini.launch.py

启动 RViz2 查看图像话题

rviz2

在 RViz2 中添加 Image 显示模块,并选择 /camera/depth/image_raw 话题。
确保 三个 Policy 均设置为 System Default,否则图像无法显示。

使用 rqt 查看图像

rqt

菜单路径:

Plugins → Visualization → Image View

选择话题 /camera/color/image_raw


五、控制与跟随功能

功能 启动命令
键盘控制 ros2 run wheeltec_robot_keyboard wheeltec_keyboard
雷达跟随 ros2 launch simple_follower_ros2 laser_follower.launch.py
视觉巡线 ros2 launch simple_follower_ros2 line_follower.launch.py
视觉跟踪 ros2 launch simple_follower_ros2 visual_follower.launch.py
KCF 跟随 ros2 launch wheeltec_robot_kcf wheeltec_robot_kcf.launch.py

六、2D 建图与导航

🔹 建图方法

建图类型 启动命令
GMapping ros2 launch slam_gmapping slam_gmapping.launch.py
SLAM Toolbox ros2 launch wheeltec_slam_toolbox online_async_launch.py
Cartographer ros2 launch wheeltec_cartographer cartographer.launch.py
保存地图
ros2 launch wheeltec_nav2 save_map.launch.py

🔹 2D 导航(含多点导航)

ros2 launch wheeltec_nav2 wheeltec_nav2.launch.py

七、RTAB-Map 与 ORB-SLAM

RTAB-Map 建图与导航

# 建图
ros2 launch wheeltec_robot_rtab wheeltec_slam_rtab.launch.py
ros2 launch wheeltec_nav2 save_map.launch.py

# 导航
ros2 launch wheeltec_robot_rtab rtabmap_localization.launch.py
ros2 launch wheeltec_robot_rtab wheeltec_nav2_rtab.launch.py

ORB-SLAM 启动

ros2 launch orb_slam2_ros orb_slam2_Astra_rgbd_launch.py

八、自主探索与路径跟踪

🔹 RRT 自主探索建图

ros2 launch wheeltec_slam_toolbox online_async_launch.py
ros2 launch wheeltec_robot_rrt wheeltec_rrt_slam.launch.py

发布四个探索点(顺时针/逆时针),最后一个点发布在已知地图中。


🔹 路径跟踪功能

设计路径并保存
# Step1: 启动导航
ros2 launch wheeltec_nav2 wheeltec_nav2.launch.py

# Step2: 保存路径
ros2 launch wheeltec_path_follow save_path.launch.py

# Step3: 键盘控制设计路径
ros2 run wheeltec_robot_keyboard wheeltec_keyboard
启动路径跟踪
ros2 launch wheeltec_path_follow follow_path.launch.py

九、多机编队

# 主车端运行编队导航程序
ros2 launch wheeltec_multi navigation.launch.py

# 从机运行编队程序
ros2 launch wheeltec_multi wheeltec_slave.launch.py

# 主车使用键盘控制
ros2 run wheeltec_robot_keyboard wheeltec_keyboard

💬 十、TTS 与语音控制

1️ TTS 文本转语音

ros2 launch tts tts_make.launch.py

转换内容可在 tts_make.launch.py 文件中修改。

2️ 语音控制

ros2 launch wheeltec_mic_ros2 mic_init.launch.py   # 开启麦克风阵列
ros2 launch wheeltec_mic_ros2 base.launch.py       # 开启小车控制

十一、人体识别与控制

功能 启动命令
姿态控制 ros2 launch bodyreader bodyinteraction.launch.py
骨架跟随 ros2 launch bodyreader bodyfollow.launch.py
姿态控制 + 跟随 ros2 launch bodyreader final.launch.py

双手胸前交叉可切换模式。


十二、Web 视频流显示

# Step1: 启动相机
ros2 launch turn_on_wheeltec_robot wheeltec_camera.launch.py

# Step2: 启动 web_video_server
ros2 run web_video_server web_video_server

# Step3: 浏览器查看实时视频
http://192.168.0.100:8080/

十三、USB 手柄控制

ros2 launch wheeltec_joy wheeltec_joy.launch.py

十四、自动回充功能

# Step1: 建图并保存
ros2 launch slam_gmapping slam_gmapping.launch.py
ros2 launch wheeltec_nav2 save_map.launch.py

# Step2: 启动导航
ros2 launch wheeltec_nav2 wheeltec_nav2.launch.py

# Step3: 开启自动回充
ros2 run auto_recharge_ros2 auto_recharge

在 RViz 中使用话题 charger_position_update 标定充电桩位置。


十五、AR 标签识别与跟随

# AR 识别
ros2 launch aruco_ros aruco_recognize.launch.py

# AR 跟随
ros2 launch simple_follower_ros2 aruco_follower.launch.py

十六、常用系统命令汇总

功能 命令
打开地图路径 cd /home/wheeltec/wheeltec_ros2/src/wheeltec_robot_nav2/map
手动保存地图 ros2 run nav2_map_server map_saver_cli -f ~/map
查看图像话题 rqt_image_view
查看节点关系图 rqt_graph
生成 TF 树 PDF ros2 run tf2_tools view_frames
调整 VNC 分辨率 xrandr --fb 1024x768
修改系统时间 sudo date -s "2022-06-15 09:00:00"
修改文件权限 sudo chmod -R 777 文件夹
更新文件修改时间 find ./* -exec touch {} \;
安装依赖 rosdep install --from-paths src --ignore-src -r -y
使用豆瓣源安装 pip 包 pip install -i https://pypi.doubanio.com/simple/ 包名
Logo

中国智能体开发者社区,聚焦智能体与大模型开发,提供前沿资讯、实用工具链、开源项目及行业案例。通过技术沙龙、开发者大赛等活动,促进经验交流与协作,助力开发者快速构建创新智能应用。

更多推荐