自动驾驶系列(四)激光雷达的点云转成二维

        利用pointcloud_to_laserscan将robosense三维激光雷达的点云转成二维,采用hector_slam包进行建图。

一、安装pointcloud_to_laserscan包

cd ~/catkin_ws/src
git clone https://github.com/ros-perception/pointcloud_to_laserscan.git
cd ~/catkin_ws
catkin_make

第一次编译报错,如下:

查看源码说明,默认居然是ROS2的代码!不能使用。

 删除gitclone的代码,手动下载lunar版本,解压在src文件夹下。

 catkin_make编译成功!

二,创建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>

保存后打开两个终端,分别输入如下指令:

#新开一个终端,启动3d雷达驱动
cd ~/catkin_ws
source devel/setup.bash
roslaunch rslidar_pointcloud rs_lidar_16.launch

#新开一个终端,启动pointcloud_to_laserscan节点
cd ~/catkin_ws
source devel/setup.bash
roslaunch pointcloud_to_laserscan point_to_scan.launch

终端运行结果如下:

三、通过rviz可以观察pointcloud和laserscan

其中绿色部分为三维点云,白色部分为三维点云转化的平面雷达扫描图形。

 

  • 2
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值