#include "ros/ros.h"
#include <pluginlib/class_list_macros.h>
#include "openni_camera/openni_device_kinect.h"
#include "openni_camera/openni_image.h"
#include "openni_camera/openni_depth_image.h"
#include <sensor_msgs/image_encodings.h>
#include <pcl_ros/point_cloud.h>
#include <pcl/point_types.h>
#include <sensor_msgs/CameraInfo.h>
#include <stereo_msgs/DisparityImage.h>
#if ROS_VERSION_MINIMUM(1, 3, 0)
#include <sensor_msgs/distortion_models.h>
#endif
#define QUEUE_SIZE 15
#define LOOP_RATE 33
//using namespace openni_wrapper;
typedef pcl::PointCloud<pcl::PointXYZ> DepthPoints; // depth/points
typedef sensor_msgs::Image DepthImage; // depth/image
typedef sensor_msgs::Image RGBImageColor; // rgb/image_color
typedef sensor_msgs::Image RGBImageMono; // rgb/image_mono
typedef pcl::PointCloud<pcl::PointXYZRGB> RGBPoints; // rgb/points
typedef sensor_msgs::CameraInfo DepthCamInfo; // depth/camera_info
typedef sensor_msgs::CameraInfo RGBCamInfo; // rgb/camera_info
typedef stereo_msgs::DisparityImage DisparityImage; // depth/disparity
const char depth_points_topicStr[] = "/camera/depth/points",
depth_image_topicStr[] = "/camera/depth/image",
rgb_image_color_topicStr[] = "/camera/rgb/image_color",
rgb_image_mono_topicStr[] = "/camera/rgb/image_mono",
rgb_points_topicStr[] = "/camera/rgb/points",
depthcamera_info_topicStr[] = "depth/camera_info",
camera_info_topicStr[] = "rgb/camera_info",
disparity_topicStr[] = "depth/disparity",
depth_points_topicStr1[] = "/kinect1/depth/points",
depth_image_topicStr1[] = "/kinect1/depth/image",
rgb_image_color_topicStr1[] = "/kinect1/rgb/image_color",
rgb_image_mono_topicStr1[] = "/kinect1/rgb/image_mono",
rgb_points_topicStr1[] = "/kinect1/rgb/points";
int ii=0;
void cb_depth_points(const DepthPoints::ConstPtr& d){
ROS_INFO("Depth Points: [%d]", ii);++ii;
}
void cb_depth_image(const DepthImage::ConstPtr& d){
ROS_INFO("Depth Image: [%d]", 2);
}
void cb_rgb_image_color(const RGBImageColor::ConstPtr& d){
ROS_INFO("RGB Image: [%d]", 3);
}
void cb_rgb_image_mono(const RGBImageMono::ConstPtr& d){
ROS_INFO("Mono Image: [%d]", 4);
}
void cb_depth_points1(const DepthPoints::ConstPtr& d){
ROS_INFO("Kinect1 Depth Points: [%d]",5);
}
void cb_depth_image1(const DepthImage::ConstPtr& d){
ROS_INFO("Kinect1 Depth Image: [%d]",6);
}
void cb_rgb_image_color1(const RGBImageColor::ConstPtr& d){
ROS_INFO("Kinect1 RGB Image: [%d]",7);
}
void cb_rgb_image_mono1(const RGBImageMono::ConstPtr& d){
ROS_INFO("Kinect1 Mono Image: [%d]", 8);
}
int main(int argc, char **argv)
{
//Initialize the ROS system
ros::init(argc, argv, "listener");
ros::NodeHandle n;
//Subscribe to the topic
ros::Subscriber depthPointsSub1 = n.subscribe(depth_points_topicStr1, QUEUE_SIZE , cb_depth_points1);
ros::Subscriber depthImageSub1 = n.subscribe(depth_image_topicStr1, QUEUE_SIZE , cb_depth_image1);
ros::Subscriber depthPointsSub = n.subscribe(depth_points_topicStr, QUEUE_SIZE , cb_depth_points);
ros::Subscriber depthImageSub = n.subscribe(depth_image_topicStr, QUEUE_SIZE , cb_depth_image);
ros::Subscriber rgbImageSub1 = n.subscribe(rgb_image_color_topicStr1, QUEUE_SIZE , cb_rgb_image_color1);
ros::Subscriber monoImageSub1 = n.subscribe(rgb_image_mono_topicStr1, QUEUE_SIZE , cb_rgb_image_mono1);
ros::Subscriber rgbImageSub = n.subscribe(rgb_image_color_topicStr, QUEUE_SIZE , cb_rgb_image_color);
ros::Subscriber monoImageSub = n.subscribe(rgb_image_mono_topicStr, QUEUE_SIZE , cb_rgb_image_mono);
//Spin, waiting for messages to arrive
ros::spin();
return 0;
}