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

Revision history [back]

Have you checked if the topic is published via

rostopic hz your_topic_name.

Also make sure the check that the fields are not empty.

I am asking this because there is a possibility that your topic is publishing but it isn't displayed in rviz. You are missing the 'header' part of the message which is quite crucial for displaying on rviz.

After the lines:

// Convert the pcl/PointCloud to sensor_msgs/PointCloud2
sensor_msgs::PointCloud2 output;
pcl::toROSMsg( *cloud2_in, output );

add the lines:

output.header.stamp = ros::Time::now();
output.header.frame_id = "fixed_frame"; // You can change this for your needs

and setting the fixed_frame in rviz to fixed_frame have to display your message if your message isn't empty.

Just a final note, you are converting your input to output at the lines below, I am guessing you want to publish aligned pointCloud.

pcl::toROSMsg( *cloud2_in, output );

Have you checked if the topic is published via

rostopic hz your_topic_name.

Also make sure the check that the fields are not empty.empty (Data part of the message).

I am asking this because there is a possibility that your topic is publishing but it isn't displayed in rviz. You are missing the 'header' part of the message which is quite crucial for displaying on rviz.

After the lines:

// Convert the pcl/PointCloud to sensor_msgs/PointCloud2
sensor_msgs::PointCloud2 output;
pcl::toROSMsg( *cloud2_in, output );

add the lines:

output.header.stamp = ros::Time::now();
output.header.frame_id = "fixed_frame"; // You can change this for your needs

and setting the fixed_frame in rviz to fixed_frame have to display your message if your message isn't empty.

Just a final note, you are converting your input to output at the lines below, I am guessing you want to publish aligned pointCloud.

pcl::toROSMsg( *cloud2_in, output );

Have you checked if the topic is published via

rostopic hz your_topic_name.

Also make sure that the fields are not empty (Data part of the message).

I am asking this because there is a possibility that your topic is publishing but it isn't displayed in rviz. You are missing the 'header' part of the message which is quite crucial for displaying on rviz.

After the lines:

// Convert the pcl/PointCloud to sensor_msgs/PointCloud2
sensor_msgs::PointCloud2 output;
pcl::toROSMsg( *cloud2_in, output );

add the lines:

output.header.stamp = ros::Time::now();
output.header.frame_id = "fixed_frame"; // You can change this for your needs

and setting the fixed_frame in rviz to fixed_frame have to display your message if your message isn't empty.

Just a final note, you are converting your input to output at the lines below, I am guessing you want to publish aligned pointCloud.

pcl::toROSMsg( *cloud2_in, output );

Another possible issue might arise due to cloud_in container being empty. This can happen if camera_frame_cb is called before fixed_frame_cb(You are filling the container at the fixed_frame_cb). It might be a good idea to check the size of the data in the cloud_in container, or just keep a boolean to indicate that it is initialized.

Have you checked if the topic is published via

rostopic hz your_topic_name.

Also make sure that the fields are not empty (Data part of the message).

I am asking this because there is a possibility that your topic is publishing but it isn't displayed in rviz. You are missing the 'header' part of the message which is quite crucial for displaying on rviz.

After the lines:

// Convert the pcl/PointCloud to sensor_msgs/PointCloud2
sensor_msgs::PointCloud2 output;
pcl::toROSMsg( *cloud2_in, output );

add the lines:

output.header.stamp = ros::Time::now();
output.header.frame_id = "fixed_frame"; // You can change this for your needs

and setting the fixed_frame in rviz to fixed_frame have to display your message if your message isn't empty.

Another possible issue might arise due to cloud_in container being empty. This can happen if camera_frame_cb is called before fixed_frame_cb(You are filling the container at the fixed_frame_cb). It might be a good idea to check the size of the data in the cloud_in container, or just keep a boolean to indicate that it is initialized.

Just a final note, you are converting your input to output at the lines below, I am guessing you want to publish aligned pointCloud.

pcl::toROSMsg( *cloud2_in, output );

Another possible issue might arise due to cloud_in container being empty. This can happen if camera_frame_cb is called before fixed_frame_cb(You are filling the container at the fixed_frame_cb). It might be a good idea to check the size of the data in the cloud_in container, or just keep a boolean to indicate that it is initialized.