00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Copyright (c) 2015, IAV Automotive Engineering 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions are met: 00009 * 00010 * 1. Redistributions of source code must retain the above copyright notice, 00011 * this list of conditions and the following disclaimer. 00012 * 00013 * 2. Redistributions in binary form must reproduce the above copyright notice, 00014 * this list of conditions and the following disclaimer in the documentation 00015 * and/or other materials provided with the distribution. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00018 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00019 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00020 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00021 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00022 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00023 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 00024 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00025 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 00026 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00027 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00028 * 00029 */ 00030 /* 00031 * IAV Team 00032 * http://www.iav.com 00033 * 00034 */ 00035 00036 00037 #include <image_transport/image_transport.h> 00038 #include <boost/thread/mutex.hpp> 00039 00040 #include <tf/transform_broadcaster.h> 00041 #include <tf/tf.h> 00042 #include <tf/transform_listener.h> 00043 00044 #include "../include/DepthImage_to_Laserscan.h" 00045 00046 namespace iav_depthimage_to_laserscan 00047 { 00048 /* 00049 * These class is like a interface with ROS. Here are all the publishes and subscribers, this means that these 00050 * Class is the Receiver and Sender the daten of the camera(s) to the virtual Laserscan respectively. 00051 * 00052 * Furthermore, it creates a "general" Laserscan joining the daten from the cameras (when there are two cameras) or 00053 * just use the results from the first camera. 00054 * 00055 * The class updates the TFs to the actual angles as well. 00056 */ 00057 class DTL_ROS 00058 { 00059 00060 public: 00061 00062 DTL_ROS(ros::NodeHandle& n, CParam& Param_1, CParam& Param_2, LSParam& laser_param); 00063 ~DTL_ROS(); 00064 00065 private: 00066 00067 void image_callback(const sensor_msgs::ImageConstPtr& depth_msg, const sensor_msgs::CameraInfoConstPtr& info_msg); 00068 00069 void image_callback_2(const sensor_msgs::ImageConstPtr& depth_msg, const sensor_msgs::CameraInfoConstPtr& info_msg); 00070 00071 iav_depthimage_to_laserscan::DepthImage_to_Laserscan itl; // Instance of the Depthimage_to_Laserscan conversion class 00072 00073 iav_depthimage_to_laserscan::CParam Param1; // Parameters of the first camera 00074 iav_depthimage_to_laserscan::CParam Param2; // Parameters of the second camera 00075 iav_depthimage_to_laserscan::LSParam lsparam; // Parameters of the laser 00076 00077 // First camera 00078 image_transport::ImageTransport it_; // Subscribes to synchronized Image CameraInfo pairs. Subscribe to image topics. 00079 image_transport::CameraSubscriber sub_; // Subscriber for image_transport 00080 00081 // Second camera 00082 image_transport::CameraSubscriber sub_2; 00083 00084 ros::Publisher pub_; // Publisher for output LaserScan messages 00085 00086 boost::mutex connect_mutex_; // Prevents the publish and subscriber from being called until everything is initialized. 00087 00088 tf::TransformBroadcaster m_TB; //< Broadcaster to send TFs 00089 00090 sensor_msgs::LaserScanPtr scan_msg_united; // General Laser Scan (here the combination between the lasers from the first and second camera) 00091 00092 }; 00093 00094 }; //iav_depthimage_to_laserscan 00095