Это базовый c скелет:
std_msgs::Float64MultiArray map_info;
tf::matrixEigenToMsg(map,map_info );
sensor_msgs::PointCloud2 cloud;
cloud.header.stamp = ros::Time::now();
cloud.width = map_info.end()+1;
cloud.height = 1;
cloud.is_bigendian = false;
cloud.is_dense = false;
sensor_msgs::PointCloud2Modifier modifier(cloud);
modifier.setPointCloud2FieldsByString(1,"xy");
modifier.resize(map_info.end()+1);
sensor_msgs::PointCloud2Iterator<float> out_x(cloud, "x");
sensor_msgs::PointCloud2Iterator<float> out_y(cloud, "y");
for (double i=0;i<map_info.end();i++)
{
*out_x = i;
*out_y = map_info.data[i];
++out_x;
++out_y;
}