当前位置: 首页>>代码示例>>Python>>正文


Python point_cloud2.read_points方法代码示例

本文整理汇总了Python中sensor_msgs.point_cloud2.read_points方法的典型用法代码示例。如果您正苦于以下问题:Python point_cloud2.read_points方法的具体用法?Python point_cloud2.read_points怎么用?Python point_cloud2.read_points使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sensor_msgs.point_cloud2的用法示例。


在下文中一共展示了point_cloud2.read_points方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ros_to_pcl

# 需要导入模块: from sensor_msgs import point_cloud2 [as 别名]
# 或者: from sensor_msgs.point_cloud2 import read_points [as 别名]
def ros_to_pcl(ros_cloud):
    """ Converts a ROS PointCloud2 message to a pcl PointXYZRGB

        Args:
            ros_cloud (PointCloud2): ROS PointCloud2 message

        Returns:
            pcl.PointCloud_PointXYZRGB: PCL XYZRGB point cloud
    """
    points_list = []

    for data in pc2.read_points(ros_cloud, skip_nans=True):
        points_list.append([data[0], data[1], data[2], data[3]])

    pcl_data = pcl.PointCloud_PointXYZRGB()
    pcl_data.from_list(points_list)

    return pcl_data 
开发者ID:anshulpaigwar,项目名称:Attentional-PointNet,代码行数:20,代码来源:pcl_helper.py

示例2: on_point_cloud

# 需要导入模块: from sensor_msgs import point_cloud2 [as 别名]
# 或者: from sensor_msgs.point_cloud2 import read_points [as 别名]
def on_point_cloud(self, data):
        self._counter += 1
        if self._counter % self._modulo_to_send != 0:
            return
        timestamp = erdos.Timestamp(coordinates=[self._msg_cnt])
        points = []
        for data in pc2.read_points(data,
                                    field_names=('x', 'y', 'z'),
                                    skip_nans=True):
            points.append([data[0], data[1], data[2]])
        points = np.array(points)
        point_cloud = pylot.perception.point_cloud.PointCloud(
            points, self._lidar_setup)
        msg = PointCloudMessage(timestamp, point_cloud)
        self._point_cloud_stream.send(msg)
        watermark_msg = erdos.WatermarkMessage(timestamp)
        self._point_cloud_stream.send(watermark_msg)
        self._logger.debug('@{}: sent message'.format(timestamp))
        self._msg_cnt += 1 
开发者ID:erdos-project,项目名称:pylot,代码行数:21,代码来源:velodyne_driver_operator.py

示例3: get_depth

# 需要导入模块: from sensor_msgs import point_cloud2 [as 别名]
# 或者: from sensor_msgs.point_cloud2 import read_points [as 别名]
def get_depth(self, x, y):
        gen = pc2.read_points(self.pc, field_names='z', skip_nans=False, uvs=[(x, y)]) #Questionable
        print gen
        return next(gen) 
开发者ID:osrf,项目名称:baxter_demos,代码行数:6,代码来源:get_goal_poses.py

示例4: _cameraCb

# 需要导入模块: from sensor_msgs import point_cloud2 [as 别名]
# 或者: from sensor_msgs.point_cloud2 import read_points [as 别名]
def _cameraCb(self, msg):
        '''
        Parse points and fields from a pointcloud2 message. For more info:
          https://answers.ros.org/question/208834/read-colours-from-a-pointcloud2-python/

        Parameters:
        -----------
        msg: ros sensor_msgs/PointCloud2 message
        '''
        gen = pc2.read_points(msg, skip_nans=True)
        print(gen)
        raise RuntimeError('deprecated')
        pass 
开发者ID:jhu-lcsr,项目名称:costar_plan,代码行数:15,代码来源:listeners.py

示例5: load_snap_from_list

# 需要导入模块: from sensor_msgs import point_cloud2 [as 别名]
# 或者: from sensor_msgs.point_cloud2 import read_points [as 别名]
def load_snap_from_list(self, i):
        self.cones = np.zeros((0, 2))
        msg = self.list_snapshots[i]
        gen = point_cloud2.read_points(msg)
        for p in gen:
            xy = np.array([p[0], p[1]])
            self.cones = np.vstack([self.cones, xy]) 
开发者ID:AMZ-Driverless,项目名称:fssim,代码行数:9,代码来源:snapshot_handler.py


注:本文中的sensor_msgs.point_cloud2.read_points方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。