Skip to content

Commit

Permalink
EigenMatToPointCloud2 - Use rows() of Eigen::MatrixX3f &points (#68)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ewak authored Jan 28, 2025
1 parent 00ccf9e commit b608129
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ros/src/Utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ inline std::unique_ptr<PointCloud2> EigenToPointCloud2(const std::vector<Eigen::

inline std::unique_ptr<PointCloud2> EigenMatToPointCloud2(const Eigen::MatrixX3f &points,
const Header &header) {
auto msg = CreatePointCloud2Msg(points.size(), header);
auto msg = CreatePointCloud2Msg(points.rows(), header);
FillPointCloud2XYZ(points, *msg);
return msg;
}
Expand Down

0 comments on commit b608129

Please sign in to comment.