How to add a point to sensor_msgs::PointCloud2?
I declare a point as
Eigen::Vector2f point;
However, I cannot add this point to my PointCloud2 with this code:
sensor_msgs::PointCloud2 filteredPoints;
filteredPoints.data.push_back(point);
The issue is the data is a type of std::vector<uint8_t, std::allocator<uint8_t>>
. The eror shows clearly: error: no matching function for call to ‘std::vector<unsigned char, std::allocator<unsigned char> >::push_back(Eigen::Vector2f&)
I never work with such a vector type with allocator as the second template.