publishing camera point clouds in rviz [closed]
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.
void
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);
clusterPub.publish(*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);<="" p="">
ros::spin ();
}