What does "Assertion `cloud.points.size () == cloud.width * cloud.height' failed" mean?
Hello, after storing each points' coordinates of a point cloud in an array, then converting them to a ROSmessage and publishing them I get the following error message while running:
array: /opt/ros/fuerte/include/pcl-1.5/pcl/ros/conversions.h:248: void pcl::toROSMsg(const pcl::PointCloud<pointt>&, sensor_msgs::PointCloud2&) [with PointT = pcl::PointXYZ, sensor_msgs::PointCloud2 = sensor_msgs::PointCloud2_<std::allocator<void> >]: Assertion `cloud.points.size () == cloud.width * cloud.height' failed. Aborted (core dumped)
What does the last part about size, width and height mean?
Here's the part that might be the source of the error. The array's declared as 'field' with x,y,z as its elements.
msg->header.frame_id = "some_tf_frame";
msg->height = 1;
msg->width = pc.points.size();
//Storing the vector values in msg->points
for(i = msg->points.begin();i != msg->points.end();++i){
j=distance(i,msg->points.begin());
msg->points.push_back (pcl::PointXYZ(field[j].x,field[j].y,field[j].z));
}
sensor_msgs::PointCloud2 output;
pcl::toROSMsg(*msg,output);
pub.publish(output);