使用pointcloud_to_laserscan包实现三维转二维

有效解决catkin_make报错,roslaunch找不到包的问题

1,安装pointcloud_to_laserscan包

cd ~/catkin_ws/src
git clone https://github.com/BluewhaleRobot/pointcloud_to_laserscan.git

cd ~/catkin_ws
catkin_make

2,创建launch文件

cd ~/catkin_ws/src/pointcloud_to_laserscan/launch
gedit point_to_scan.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"/>
        
        <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="/rslidar_points"/>。因为激光雷达节点发布的信息是/rslidar_points,因此需要将pointcloud_to_laserscan的订阅信息从默认的cloud_in改为/rslidar_points。
3,启动pointcloud_to_laserscan节点

roslaunch pointcloud_to_laserscan point_to_scan.launch

如果roslaunch不到节点,则:

rospack find pointcloud_to_laser 

然后接可以了,亲测有效!!!!!!!!!!!!

上一篇:Redis基础篇——布隆过滤器


下一篇:three.js学习笔记二:导入外部gltf模型