Skip to content

Commit b608129

Browse files
authored
EigenMatToPointCloud2 - Use rows() of Eigen::MatrixX3f &points (#68)
The usage of points.size() in EigenMatToPointCloud2 to CreatePointCloudMsg() was incorrect, it should have been points.rows(). Using points.size() leads 3x more points being allocated in the point cloud than necessary which bloats the message slowing things down. These extra points are at the origin of the pointcloud. This can manifest as an artificial hump directly under the origin of the point cloud. Signed-off-by: Mike Wake <[email protected]>
1 parent 00ccf9e commit b608129

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ros/src/Utils.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ inline std::unique_ptr<PointCloud2> EigenToPointCloud2(const std::vector<Eigen::
189189

190190
inline std::unique_ptr<PointCloud2> EigenMatToPointCloud2(const Eigen::MatrixX3f &points,
191191
const Header &header) {
192-
auto msg = CreatePointCloud2Msg(points.size(), header);
192+
auto msg = CreatePointCloud2Msg(points.rows(), header);
193193
FillPointCloud2XYZ(points, *msg);
194194
return msg;
195195
}

0 commit comments

Comments
 (0)