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的配置如下

Q1. 如何確定 Global Options的屬性Fixed Frame: https://blog.csdn.net/sunyoop/article/details/78804941

Q2. 如何使用rosbag回放激光數據:https://blog.csdn.net/wutao1201/article/details/88225649


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM