Skip to content

Commit

Permalink
fix write of rgba field in flatbuffers point cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Arkenau committed Oct 20, 2022
1 parent f077a9f commit c44fd92
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/python/gRPC/pointcloud/gRPC_fb_sendPointCloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

def createPointCloud(builder, header, height=960, width=1280):
'''Creates a flatbuffers point cloud message'''
pointFields = createPointFields(builder, ['x', 'y', 'z', 'rgb'], 7, 4, 1)
pointFields = createPointFields(builder, ['x', 'y', 'z', 'rgba'], 7, 4, 1)
pointFieldsVector = addToPointFieldVector(builder, pointFields)

# create general labels
Expand Down
9 changes: 5 additions & 4 deletions seerep-hdf5/seerep-hdf5-fb/src/hdf5-fb-pointcloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ void Hdf5FbPointCloud::writePointCloud2(const std::string& id, const seerep::fb:

if (info.has_rgb)
{
writeColorsRGBA(id, getOffsets(cloud, std::vector<std::string>{ "r", "g", "b" }), cloud.data()->data(),
cloud.point_step(), cloud.height(), cloud.width());
writeColorsRGB(id, getOffsets(cloud, std::vector<std::string>{ "r", "g", "b" }), cloud.data()->data(),
cloud.point_step(), cloud.height(), cloud.width());
}

if (info.has_rgba)
Expand Down Expand Up @@ -283,8 +283,8 @@ Hdf5FbPointCloud::readPointCloud2(const std::string& id, const bool withoutData)

if (info.has_rgba)
{
readPoints(id, getOffsets(names, offsets, isBigendian, std::vector<std::string>{ "r", "g", "b", "a" }), data,
pointStep, height, width);
readColorsRGBA(id, getOffsets(names, offsets, isBigendian, std::vector<std::string>{ "r", "g", "b", "a" }), data,
pointStep, height, width);
}
}

Expand Down Expand Up @@ -697,6 +697,7 @@ uint32_t Hdf5FbPointCloud::rgbaOffset(const std::string& fieldName, uint32_t off
return offset + 3;
}
}
throw std::runtime_error("Field " + fieldName + " does not exist!");
}

} // namespace seerep_hdf5_fb

0 comments on commit c44fd92

Please sign in to comment.