posts - 38,comments - 0,views - 8376

首先给出该类型包含的字段

std_msgs/Header header #ros标头,包含了时间戳、frame_id等信息
uint32 seq
time stamp
string frame_id
uint32 height #高度,表示设备具有的垂直通道数量
uint32 width #宽度,表示每个垂直通道的点数
sensor_msgs/PointField[] fields #类似C++中的结构体,每个字段对应一个点云的特定属性
uint8 INT8=1
uint8 UINT8=2
uint8 INT16=3
uint8 UINT16=4
uint8 INT32=5
uint8 UINT32=6
uint8 FLOAT32=7
uint8 FLOAT64=8
string name #属性的名字,比如点云包含‘x’,'y','z'这些,具体看实例
uint32 offset #由于实际点在PointCloud2消息中排列是一维数组的形式,偏移量有助于区分点之间的信息
uint8 datatype #属性的数据类型,可选的是上面的8个枚举类型
uint32 count #属性的个数,这里我也没有完全搞懂(TODO...)
bool is_bigendian #大端模式
uint32 point_step #点的长度(以字节为单位),计算方式是:point_step=len(fields)*datatype
uint32 row_step #通过一下公式计算:total_number_of_points = height * width,row_step = total_number_of_points * point_step
uint8[] data #是一个一维数组,二进制点云流,不直观,需解析
bool is_dense #若设定为True,则假定所有点均有效

关于offset可以看下动画:

再给出一个实例

header:
seq: 0
stamp:
secs: 1317359783
nsecs: 484827041
frame_id: "velodyne"
height: 1
width: 127931
fields:
-
name: "x"
offset: 0
datatype: 7
count: 1
-
name: "y"
offset: 4
datatype: 7
count: 1
-
name: "z"
offset: 8
datatype: 7
count: 1
-
name: "intensity"
offset: 12
datatype: 7
count: 1
-
name: "ring"
offset: 16
datatype: 4
count: 1
is_bigendian: False
point_step: 18
row_step: 2302758
data: [二进制流]
is_dense: True

point_step=4(有四个属性都是FLOAT32类型)* 4(FLOAT32包含4个字节)+1 * 2=18
row_step=1 * 127931 * 18=2302758

参考资料:https://medium.com/@tonyjacob_/pointcloud2-message-explained-853bd9907743

posted on   房东的猫hhhh  阅读(856)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 没有源码,如何修改代码逻辑?
· PowerShell开发游戏 · 打蜜蜂
· 在鹅厂做java开发是什么体验
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

点击右上角即可分享
微信分享提示