subscriber pointcloud
Hi, I am using perception-pcl under ros. I want to get pointcloud from two kinects. Here, I subscribe to both topics. How can I get the data, which is the "cloud_s" and "cloud_t" into my main function and compute it there? I tried to put argument on callback function like cloud_cb1(cloud_s) in:
ros::Subscriber sub_source = nh1.subscribe("camera1/depth/points", 1,cloud_cb1);
but, it did not work. below is part of my code. Thanks in advanced.
...
void cloud_cb1 (const sensor_msgs::PointCloud2ConstPtr& cloud_s)
{
if ((cloud_s->width * cloud_s->height) == 0)
return;
}
void cloud_cb2 (const sensor_msgs::PointCloud2ConstPtr& cloud_t)
{
if ((cloud_t->width * cloud_t->height) == 0)
return;
}
int main(int argc, char** argv)
{
ros::init (argc, argv, "reg_icp_ros"); //initialize ros
ros::NodeHandle nh1;
ros::NodeHandle nh2;
while (ros::ok())
{
//subscribe node
ros::Subscriber sub_source = nh1.subscribe("camera1/depth/points", 1,cloud_cb1);
ros::Subscriber sub_target = nh2.subscribe("camera2/depth/points", 1,cloud_cb2);
...
best,