ROS2与turtlebot4仿真入门教程-测试雷达和相机
ROS2与turtlebot4仿真入门教程-测试雷达和相机
说明:
- 介绍如何仿真下测试雷达和相机
- 如果没有雷达或相机数据,可以查看issue,确认模型的传感器引擎是否是ogre2
- 模型名是:irobot_create_common/irobot_create_description/urdf/create3.urdf.xacro
- 更改为
<gazebo>
<plugin filename="libgz-sim-sensors-system.so" name="gz::sim::systems::Sensors">
<render_engine>ogre2</render_engine>
</plugin>
</gazebo>
步骤:
- 启动仿真
ros2 launch turtlebot4_ignition_bringup turtlebot4_ignition.launch.py
- 点一下左下角的三角图标开始仿真, 并按一下右上角的开关键右边的unlock按钮(两个点的图标),让机器人离开充电桩
测试雷达:
- 通过topic命令行,查看话题内容
ros2 topic echo /scan
- 效果如下:
---
header:
stamp:
sec: 172
nanosec: 816000000
frame_id: turtlebot4/rplidar_link/rplidar
angle_min: -3.1415927410125732
angle_max: 3.1415927410125732
angle_increment: 0.009832840412855148
time_increment: 0.0
scan_time: 0.0
range_min: 0.164000004529953
range_max: 12.0
ranges:
- 7.365904331207275
- 3.948739528656006
- 3.907142400741577
- 8.883407592773438
- 8.94767951965332
- 9.012924194335938
- 9.079118728637695
- 9.146242141723633
- 9.214299201965332
- 9.82641887664795
- 9.902118682861328
- 9.978501319885254
- 10.055573463439941
- .inf
- .inf
- '...'
intensities:
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- '...'
---
- 通过rviz查看雷达数据
- 打开rviz
ros2 launch turtlebot3_viz view_robot.launch.py
- 设置Fixed Frame为base_link, LaserScan的style为Boxes, Size为0.1
- 效果如图:
测试相机:
- 通过topic命令行,查看话题内容
ros2 topic echo /color/image
ros2 topic echo /color/
- 通过image_view查看
ros2 run rqt_image_view rqt_image_view
- 选择图像话题/color/image
- 效果图:
- 选择深度图话题/stereo/depth
- 效果图:
- 通过rviz查看雷达数据
- 打开rviz
ros2 launch turtlebot4_viz view_robot.launch.py
- 设置Fixed Frame为base_link, 添加通过image话题,选择话题/color/image
- 效果图:
演示视频
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号