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

no message received in Rviz

asked 2012-08-20 06:40:42 -0600

David Bravo gravatar image

updated 2016-10-24 09:00:15 -0600

ngrennan gravatar image

Hi everyone, I'm using the following code to publish keypoints extracted from a kinect depth image. It compiles and runs without problems and I can select the keypoints topic in Rviz but it gives me the following errors:


Points Showing [0] points from [0] messages.

Topic No messages received.

Transform For frame[]: Frame[] does not exist.

Am I doing something wrong here? this is the code:

typedef pcl::PointCloud<pcl::PointCloud<int> > PointCloud;
typedef pcl::PointXYZ PointType;

ros::Publisher pub;

pcl::PointCloud<int> keypoint_indices;

pcl::PointCloud<pcl::PointXYZ>::Ptr keypoints_ptr (new pcl::PointCloud<pcl::PointXYZ>);
pcl::PointCloud<pcl::PointXYZ>& keypoints = *keypoints_ptr;

float angular_resolution_;
float support_size_ =0.2f;//-0.1f

image_geometry::PinholeCameraModel model_;

void cameraModelCallback(const sensor_msgs::CameraInfoConstPtr &info_msg)

void depthimage_cb(const sensor_msgs::ImageConstPtr &depth_msg)
    const uint16_t* depthImage = reinterpret_cast<const uint16_t*>(&depth_msg->data[0]);

    pcl::RangeImagePlanar range_image_;
    pcl::RangeImageBorderExtractor range_image_border_extractor_;

    // convert the depth-image to a pcl::rangeImage
    angular_resolution_ = 0.5f(float)(-1);
    /*range_image_.setDepthImage(depthImage,depth_msg->width, depth_msg->height, (depth_msg->width)/2, (depth_msg->height)/2, 600.0, 600.0, angular_resolution_);*/
    range_image_.setDepthImage(depthImage,depth_msg->width, depth_msg->height,,,model_.fx(), model_.fy(), angular_resolution_);

    pcl::NarfKeypoint keypoint_det;

    // extract the indices of the NARF-Keypoints
    keypoint_det.getParameters ().support_size =  support_size_;
    keypoint_det.setRangeImageBorderExtractor (&range_image_border_extractor_);
    keypoint_det.setRangeImage (&range_image_);
    keypoint_det.compute (keypoint_indices);

    keypoints.points.resize (keypoint_indices.points.size ());
    for (size_t i=0; i<keypoint_indices.points.size (); ++i)
    keypoints.points[i].getVector3fMap () = range_image_.points[keypoint_indices.points[i]].getVector3fMap ();
    pub.publish (keypoints);

main (int argc, char** argv)
  // Initialize ROS
  ros::init (argc, argv, "keypointsplanar");
  ros::NodeHandle nh1;

  // Create a ROS subscriber for the input point cloud
  ros::Subscriber sub1 = nh1.subscribe ("/camera/depth/image", 1, depthimage_cb);   
  ros::Subscriber sub2 = nh1.subscribe ("/camera/depth/camera_info", 1, cameraModelCallback);   

  // Create a ROS publisher for the output point cloud
  pub = nh1.advertise<pcl::PointCloud<pcl::PointXYZ> > ("keypoints", 1);

  // Spin
  ros::spin ();
edit retag flag offensive close merge delete


Thanks Lorenz! the those lines fixed the Frame[] does not exist errors, but I'm still not getting anything out, now it just shows: Status:Error.

Points Showing [0] points from [0] messages.

Topic No messages received.

David Bravo gravatar image David Bravo  ( 2012-08-22 01:25:34 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2012-08-20 07:10:50 -0600

Lorenz gravatar image

The error message indicates that your keypoints message does not contain a valid frame id in its header. RViz needs this information to correctly position the point cloud in its window. Try adding the following code right before the publish call:

keypoints.header.frame_id = depth_msg->header.frame_id;
keypoints.header.stamp = depth_msg->header.stamp;
edit flag offensive delete link more

Question Tools


Asked: 2012-08-20 06:40:42 -0600

Seen: 2,267 times

Last updated: Aug 20 '12