hii,
I am trying to publish message on topic point cloud 2.
The value of x is in double.
The value of y is in double.
The value of z is in double .
The value of intensity in in Uchar.
Can some one suggest a way to do it .
I wrote a sample source code . I am getting segmentation fault.
is there bug in my code.
http://docs.ros.org/indigo/api/sensor_msgs/html/namespacesensor__msgs.html
sensor_msgs::PointCloud2 lidarscan;
sensor_msgs::PointCloud2Modifier modifier(lidarscan);
modifier.setPointCloud2Fields(4, "x", 1, sensor_msgs::PointField::FLOAT64,
"y", 1, sensor_msgs::PointField::FLOAT64,
"z", 1, sensor_msgs::PointField::FLOAT64,
"i", 1, sensor_msgs::PointField::INT8);
sensor_msgs::PointCloud2Iterator iter_x(lidarscan, "x");
sensor_msgs::PointCloud2Iterator iter_y(lidarscan, "y");
sensor_msgs::PointCloud2Iterator iter_z(lidarscan, "z");
sensor_msgs::PointCloud2Iterator iter_i(lidarscan, "i");
ros::init(argc, argv, "simdata_publisher");
ros::NodeHandle n;
while (true)
{
std::cout<<__LINE__<<" Printing the 2d lidar data "<
↧