My program slows down while operating with a loop in pointcloud
Hi everyone. So I'm in the process of writing my own library for pointcloud . Now I'm stuck on a path. I have a function that I'm currently designing to give out x,y, and z values of the points in pointcould and then publish the same pointcloud after the iteration of the current pointcloud is over. But because there is a loop inside the function because of which the rate at which the pointcloud is published after its iteration is slowed down..Could you please find me a way to increase the published rate of the pointcloud than you? thanks in advance ..
int i;
sensor_msgs::PointCloud2 dummy;
sensor_msgs::PointCloud2 &outputpass =dummy;
outputpass=cloud_msg;
for ( sensor_msgs::PointCloud2ConstIterator<float> it(outputpass, "x"); it != it.end(); ++it)
{
cout <<" POINT CLOUD :"<< endl;
cout<<" "<<endl;
cout << "z " << it[2] << '\n';
i++;
}
pubpass.publish(outputpass);
Can you please elaborate the following? I have a function that I'm currently designing to give out x,y, and z values of the points in pointcould and then publish the same pointcloud after the iteration of the current pointcloud is over.