Rosanswers logo

Hi all! I used "roslaunch openni_launch openni.launch" and I am trying to subscribe to the "/camera/depth/points" of pointcloud2 datatype, do something to it in the callback function, which is a member function, and then publish it to rviz.

Problem that I am facing is regarding the fixed and target frames under global options of rviz. All the available frames do not work.

I am receiving this error:"For frame[]: Frame[] does not exist" under "Transform[sender=/MyNodeName]" under "Status:Error" under "PointCloud2" of Rviz.

I believe I need to subscribe to the tf of the camera and publish it in my program, and rviz will use the publish frame as the fixed frame, and the processed point cloud can be visualised.

Not sure how to do this though, or if this is even the coorect approach. Appreciate any help thx! I a on Ubuntu 12.04, fuerte btw!

My source code is as below.

Listener::callback (const sensor_msgs::PointCloud2::ConstPtr& input)
    boost::mutex::scoped_lock lock (mtx_);

    pcl17::fromROSMsg(*input, *scene);
            //did some EuclideanClusterExtraction 
    pcl17::toROSMsg(*cloud_cluster, *clusteredScene);

int main (int argc, char** argv)


ros::init (argc, argv, "MyNodeName");

ros::NodeHandle nh;

Listener listener;

ros::Subscriber sub = nh.subscribe ("/camera/depth/points", 1000, &Listener::callback, &listener);

clusterPub = nh.advertise<sensor_msgs::PointCloud2> ("/cluster", 1000);

ros::spin ();


Originally posted by VicL on ROS Answers with karma: 17 on 2013-06-21

Post score: 0


1 Answer 1


Rosanswers logo

Have you set the frame_id of the header of the pointcloud-message?

clusteredScene->header.frame_id = "my_frame" should probably do the trick.

See pointcloud2 message definition and header message definition for further details on the datatypes.

Originally posted by Philip with karma: 990 on 2013-06-23

This answer was ACCEPTED on the original site

Post score: 3

Original comments

Comment by Philip on 2013-06-24:
Glad to hear :-) As usual, please mark the answer as "accepted" (round check mark on the left) so it can be closed. Thanks!

Comment by VicL on 2013-06-24:
it works! thanks Philip!

I placed

clusteredScene->header.frame_id = "my_frame"



and broadcasted the transformation with parent frame as "camera_depth_optical_frame" and child frame as "clusteredScene_frame"


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.