Parsing 3D txt data set
Hello!I've obtained a 3D data set and its stored in a txt file, the question would be how it is possible to load it into RViz? Thank you.
Im trying to build up a PointCloud message, the 3D data set is loaded from a vector, im stucked how to insert the values of pC into cloud.channels.values. In this way there is no msg reeived in RViz.
sensor_msgs::PointCloud cloud;
cloud.header.stamp = ros::Time::now();
cloud.header.frame_id = "/base_link";
cloud.channels.resize(1);
int32_t countX = 24120;
int32_t countY = 24120;
int32_t countZ = 24120;
int32_t total = countX * countY * countZ;
cloud.points.resize(total);
cloud.channels[0].values.resize(total);
cloud.channels[0].name = "rgb";
while (it < myvector.end())
{
geometry_msgs::Point32& pC = cloud.points[i];
pC.y = *(it) * 0.001;
myfile2 << *(it++) * 0.001 <<"\n";
pC.x = *(it) * 0.001;
myfile2 << *(it++) * 0.001 <<"\n";
pC.z = *(it) * 0.001;
myfile2 << *(it++) * 0.001 <<"\n";
cloud.channels[0].values[i++] = 1.0f;
}
myfile2.close();
cloud_pub.publish(cloud);