< >
Home » ROS与激光雷达教程 » ROS与激光雷达入门教程-RS-lidar-16雷达的rosbag包制作

ROS与激光雷达入门教程-RS-lidar-16雷达的rosbag包制作

ROS与激光雷达入门教程-RS-lidar-16雷达的rosbag包制作

说明:

  • 介绍如何制作和播放多线雷达rosbag包
  • 测试环境:Turbot-DL + 多线雷达

准备:

  • 安装rslidar驱动,参考:https://www.ncnynl.com/archives/201807/2552.html

  • 安装pointcloud_to_laserscan包,参考:https://www.ncnynl.com/archives/201807/2554.html

  • 更改ros_rslidar/rslidar_pointcloud/launch下的rs_lidar_16.launch

  • 我们不启动rviz,屏蔽rviz,注释如下行:

<!--<node name="rviz" pkg="rviz" type="rviz"  args="-d $(find rslidar_pointcloud)/rviz_cfg/rslidar.rviz" />-->
  • 新增加turtlebot_rslidar.launch
roscd pointcloud_to_laserscan/launch
vim turtlebot_rslidar.launch
  • 内容如下:
<?xml version="1.0"?>    
<launch>    
    <!-- run pointcloud_to_laserscan node -->
    <node pkg="pointcloud_to_laserscan" type="pointcloud_to_laserscan_node" name="pointcloud_to_laserscan">

        <remap from="cloud_in" to="/rslidar_points"/>
        <remap from="scan" to="/scan"/>
        <rosparam>
            # target_frame: rslidar # Leave disabled to output scan in pointcloud frame
            transform_tolerance: 0.01
            min_height: -0.4
            max_height: 1.0

            angle_min: -3.1415926 # -M_PI
            angle_max: 3.1415926 # M_PI
            angle_increment: 0.003 # 0.17degree
            scan_time: 0.1
            range_min: 0.2
            range_max: 100
            use_inf: true
            inf_epsilon: 1.0

            # Concurrency level, affects number of pointclouds queued for processing and number of threads used
            # 0 : Detect number of cores
            # 1 : Single threaded
            # 2->inf : Parallelism level
            concurrency_level: 1
        </rosparam>
    </node>
</launch>

rosbag包录制:

  • 新终端,启动turlebot2底盘
roslaunch turtlebot_bringup minimal.launch
  • 新终端,启动rslidar雷达
roslaunch rslidar_pointcloud rs_lidar_16.launch
  • 新终端,启动点云转换
roslaunch pointcloud_to_laserscan  turtlebot_rslidar.launch
  • 新终端,启动键盘控制
roslaunch turtlebot_teleop keyboard_teleop.launch
  • 开始录制ros包
cd ~
rosbag record /scan /rslidar_points /mobile_base/sensors/imu_data  /odom 
  • 执行后显示
 rosbag record /scan /rslidar_points /mobile_base/sensors/imu_data  /odom 

[ WARN] [1539683153.404219091]: --max-splits is ignored without --split
[ INFO] [1539683153.415072121]: Subscribing to /mobile_base/sensors/imu_data
[ INFO] [1539683153.423859370]: Subscribing to /odom
[ INFO] [1539683153.430501735]: Subscribing to /scan
[ INFO] [1539683153.438030846]: Subscribing to /rslidar_points
[ INFO] [1539683153.445980372]: Recording to 2018-10-16-17-45-53.bag.
  • 执行之后通过键盘控制小车运动,收集相关数据

  • 话题说明:

/scan 对应雷达的2d数据
/rslidar_points 对应雷达的3d数据
/mobile_base/sensors/imu_data turtlebot2小车对应的IMU数据
/odom  turtlebot2小车的底盘里程计
  • 数据收集差不多了,关闭rosbag录制线程后,按ctrl+c
  • 在home目录会自动生成一个2018-10-16-17-45-53.bag
  • 录制中,这个包会增加非常快,需要保证你的主机有足够的空间。

rosbag包回放

  • 关闭所有启动的终端
  • 新终端,启动roscore
roscore 
  • 新终端,启动回放
rosbag play 2018-10-16-17-45-53.bag
  • 新终端,列出话题:
 $rostopic list

/clock
/mobile_base/sensors/imu_data
/odom
/rosout
/rosout_agg
/rslidar/scan
/rslidar_points
  • 新终端,显示话题内容:
rostopic echo /rslidar/scan

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: ros与激光雷达入门教程