ROSBAG使用(二):使用python提取bag中的图像和点云

1.1 载入

ROS提供了解析 bag 的python API,载入一个 bag 文件可以:

import rosbag

bag_file = 'test.bag'
bag = rosbag.Bag(bag_file, "r")

1.2 读取信息

info = bag.get_type_and_topic_info()
print(info)

可以得到类似如下的信息:

TypesAndTopicsTuple(
	msg_types={
   
		'sensor_msgs/PointCloud2': '1158d486dd51d683ce2f1be655c3c181', 
		'sensor_msgs/CompressedImage': '8f7a12909da2c9d3332d540a0977563f'
		}, 
    topics={
   
        '/pandora/sensor/pandora/hesai40/PointCloud2': 		
        TopicTuple(
            msg_type='sensor_msgs/PointCloud2', 
            message_count=1183, 
            connections=1, 
            frequency=10.071482170278314), 	
        '/pa
  • 23
    点赞
  • 116
    收藏
    觉得还不错? 一键收藏
  • 9
    评论
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值