其他分享
首页 > 其他分享> > ROS 三维激光数据转化为二位激光数据

ROS 三维激光数据转化为二位激光数据

作者:互联网

博客转自:https://blog.csdn.net/weixin_42005898/article/details/102498358 和 ros-perception

1. 安装pointcloud_to_laserscan包

cd /home/ke/ros/pointcloud_to_laserscan_ws/src
git clone https://github.com/ros-perception/pointcloud_to_laserscan.git
 
cd ..
catkin_make

2. 创建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="/velodyne_points"/>
        
        <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>

这里需要注意的是这句代码:<remap from="cloud_in" to="/velodyne_points"/>。因为激光雷达节点发布的信息是/velodyne_points,因此需要将pointcloud_to_laserscan的订阅信息从默认的cloud_in改为/velodyne_points。我使用的是如下的包,可从网络上下载

发布的是/velodyne_points消息,类型为sensor_msgs/PointCloud2

3.启动pointcloud_to_laserscan节点和利用rosbag回放激光数据

#terminal 1
rocore
#terminal 2
rosbag plag out.bag

之后启动rviz 和 pointcloud_to_laserscan节点

#terminal 3
rosrun rviz rviz
#terminal 4
roslaunch pointcloud_to_laserscan point_to_scan.launch

效果如下,分别为三维点云,二维点云和混合效果

rviz的配置如下

标签:ROS,rviz,level,ros,激光,laserscan,terminal,pointcloud,数据
来源: https://www.cnblogs.com/flyinggod/p/12759160.html