kinfu.h
Go to the documentation of this file.
00001 // -*- mode: c++ -*-
00002 /*********************************************************************
00003  * Software License Agreement (BSD License)
00004  *
00005  *  Copyright (c) 2014, JSK Lab
00006  *  All rights reserved.
00007  *
00008  *  Redistribution and use in source and binary forms, with or without
00009  *  modification, are permitted provided that the following conditions
00010  *  are met:
00011  *
00012  *   * Redistributions of source code must retain the above copyright
00013  *     notice, this list of conditions and the following disclaimer.
00014  *   * Redistributions in binary form must reproduce the above
00015  *     copyright notice, this list of conditions and the following
00016  *     disclaimer in the documentation and/o2r other materials provided
00017  *     with the distribution.
00018  *   * Neither the name of the JSK Lab nor the names of its
00019  *     contributors may be used to endorse or promote products derived
00020  *     from this software without specific prior written permission.
00021  *
00022  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00025  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00026  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00029  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00030  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00032  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00033  *  POSSIBILITY OF SUCH DAMAGE.
00034  *********************************************************************/
00035 
00036 #ifndef JSK_PCL_ROS_KINFU_H_
00037 #define JSK_PCL_ROS_KINFU_H_
00038 
00039 #include <sensor_msgs/Image.h>
00040 #include <sensor_msgs/CameraInfo.h>
00041 #include <pcl/gpu/kinfu_large_scale/kinfu.h>
00042 #include <pcl/gpu/containers/initialization.h>
00043 #include <jsk_topic_tools/diagnostic_nodelet.h>
00044 #include <message_filters/subscriber.h>
00045 #include <message_filters/time_synchronizer.h>
00046 #include <message_filters/synchronizer.h>
00047 #include "jsk_pcl_ros/tf_listener_singleton.h"
00048 #include <tf/transform_broadcaster.h>
00049 
00050 namespace jsk_pcl_ros
00051 {
00052 
00080   class Kinfu: public jsk_topic_tools::DiagnosticNodelet
00081   {
00082   public:
00083     typedef message_filters::sync_policies::ExactTime<
00084     sensor_msgs::Image, sensor_msgs::Image> SyncPolicy;
00085     Kinfu(): DiagnosticNodelet("Kinfu") {}
00086 
00087   protected:
00088     virtual void onInit();
00089     virtual void subscribe();
00090     virtual void unsubscribe();
00091     virtual void callback(const sensor_msgs::Image::ConstPtr& depth_image,
00092                           const sensor_msgs::Image::ConstPtr& rgb_image);
00093     virtual void infoCallback(const sensor_msgs::CameraInfo::ConstPtr& info_msg);
00094     
00095     pcl::gpu::kinfuLS::KinfuTracker* kinfu_;
00096     pcl::gpu::kinfuLS::KinfuTracker::DepthMap depth_device_;
00097     pcl::gpu::kinfuLS::KinfuTracker::View colors_device_;
00098     pcl::gpu::DeviceArray<pcl::PointXYZ> cloud_buffer_device_;
00099     sensor_msgs::CameraInfo::ConstPtr info_msg_;
00100     ros::Subscriber sub_info_;
00101     ros::Publisher pub_pose_;
00102     ros::Publisher pub_cloud_;
00103     message_filters::Subscriber<sensor_msgs::Image> sub_depth_image_;
00104     message_filters::Subscriber<sensor_msgs::Image> sub_color_image_;
00105     boost::shared_ptr<message_filters::Synchronizer<SyncPolicy> > sync_;
00106     boost::mutex mutex_;
00107     std::string parent_frame_id_;
00108     std::string child_frame_id_;
00109     std::string kinfu_origin_frame_id_;
00110     // transformation from odom to camera frame_id at t_0
00111     Eigen::Affine3f initial_camera_pose_;
00112     Eigen::Affine3f initial_kinfu_pose_;
00113     bool initial_camera_pose_acquired_;
00114     float volume_size_;
00115     float shift_distance_;
00116     int snapshot_rate_;
00117     bool initialized_;
00118     tf::TransformListener* tf_listener_;
00119     tf::TransformBroadcaster tf_broadcaster_;
00120   };
00121 }
00122 
00123 #endif


jsk_pcl_ros
Author(s): Yohei Kakiuchi
autogenerated on Wed Sep 16 2015 04:36:47