ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This is what works. It not runs without crashing but the crashing was due to an unrelated issue: ROS_ERROR being used to pring out information during runtime. I commented out all my ROS_ERROR's called for printing out variable information and it runs gread with the code given below.

 sensor_msgs::convertPointCloudToPointCloud2 (cloud_out, cloud2_out);
 pcl::fromROSMsg(cloud2_out,cloud_a);
    for (int i=0;i<953;i++)
    {
      cloud_b.points[posindex/5*953+i]=cloud_a.points[i];
    }
    pcl::toROSMsg(cloud_b,cloud2_out);
    cloud2_pub.publish(cloud2_out);

This is what works. It not now runs without crashing but the crashing was due to an unrelated issue: ROS_ERROR being used to pring print out information during runtime. I commented out all my ROS_ERROR's called for printing out variable information and it runs gread great with the code given below.

 sensor_msgs::convertPointCloudToPointCloud2 (cloud_out, cloud2_out);
 pcl::fromROSMsg(cloud2_out,cloud_a);
    for (int i=0;i<953;i++)
    {
      cloud_b.points[posindex/5*953+i]=cloud_a.points[i];
    }
    pcl::toROSMsg(cloud_b,cloud2_out);
    cloud2_pub.publish(cloud2_out);