AutoLidarPerception / kitti_ros

A ROS-based player to replay KiTTI dataset. http://www.cvlibs.net/datasets/kitti/
http://www.cvlibs.net/datasets/kitti/
32 stars 6 forks source link

publish point cloud with intensity #4

Closed Durant35 closed 6 years ago

Durant35 commented 6 years ago

Only contains XYZ

import sensor_msgs.point_cloud2 as pc2

def publish_point_clouds(publisher, points):
    # Publish point clouds and bounding boxes
    header = std_msgs.msg.Header()
    header.stamp = rospy.Time.now()
    header.frame_id = "velodyne"
    # points.shape = (?, 4)
    # points[:, :3] ==> (?, 0...2)
    msg_points = pc2.create_cloud_xyz32(header, points[:, :3])

    publisher.publish(msg_points)

sensor_msgs/PointCloud2 Message