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);
Originally posted by szokei on ROS Answers with karma: 80 on 2011-06-02
Post score: 1
Original comments
Comment by Ivan Dryanovski on 2011-06-07:
I don't get the logic behind int32_t total = countX * countY * countZ; If you have 24120 points, shouldn't it be cloud.points.resize(24120); ?
Comment by Asomerville on 2011-06-02:
The format is important. You should probably include the format info in your question in case someone has already parsed it before.