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

Alright, I have gotten it. :)

void cloud_cb (const sensor_msgs::PointCloud2ConstPtr& input)
{
  // Create a container for the data.
  sensor_msgs::PointCloud2 output;
  output = *input;

  // Publishing the camera frame id
  ROS_INFO("Frame ID is: [%s]", output.header.frame_id.c_str());

  // Publishing the name string in PointField array 
  for(int i = 0; i < output.fields.size(); ++i) {
    ROS_INFO("PointField array consists of: [%s]", output.fields[i].name.c_str());
  }

  pub.publish (output);
}

Alright, I have gotten it. figured it out! :)

void cloud_cb (const sensor_msgs::PointCloud2ConstPtr& input)
{
  // Create a container for the data.
  sensor_msgs::PointCloud2 output;
  output = *input;

  // Publishing the camera frame id
  ROS_INFO("Frame ID is: [%s]", output.header.frame_id.c_str());

  // Publishing the name string in PointField array 
  for(int i = 0; i < output.fields.size(); ++i) {
    ROS_INFO("PointField array consists of: [%s]", output.fields[i].name.c_str());
  }

  pub.publish (output);
}