scan_unifier_node.h
Go to the documentation of this file.
00001 
00059 #ifndef SCAN_UNIFIER_NODE_H
00060 #define SCAN_UNIFIER_NODE_H
00061 
00062 //##################
00063 //#### includes ####
00064 
00065 // standard includes
00066 #include <pthread.h>
00067 #include <boost/lexical_cast.hpp>
00068 #include <XmlRpc.h>
00069 #include <math.h>
00070 
00071 // ROS includes
00072 #include <ros/ros.h>
00073 #include <tf/transform_listener.h>
00074 #include <tf/tf.h>
00075 #include <tf/transform_datatypes.h>
00076 #include <sensor_msgs/PointCloud.h>
00077 #include <laser_geometry/laser_geometry.h>
00078 
00079 // ROS message includes
00080 #include <sensor_msgs/LaserScan.h>
00081 
00082 
00083 //####################
00084 //#### node class ####
00085 class scan_unifier_node
00086 {
00087   private:
00097     struct config_struct{
00098       int number_input_scans;
00099       double loop_rate;
00100       std::vector<std::string> input_scan_topics;
00101     };
00102 
00116     struct laser_scan_struct{
00117       bool new_msg_received;
00118       int scan_id;
00119       std::string scan_topic;
00120       ros::Subscriber laser_sub;
00121       sensor_msgs::LaserScan current_scan_msg;
00122     };
00123 
00124     pthread_mutex_t m_mutex;
00125 
00126     config_struct config_;
00127 
00128     std::vector<laser_scan_struct> vec_laser_struct_;
00129   public:
00130 
00131     // constructor
00132     scan_unifier_node();
00133 
00134     // destructor
00135     ~scan_unifier_node();
00136 
00137     /* ----------------------------------- */
00138     /* --------- ROS Variables ----------- */
00139     /* ----------------------------------- */
00140 
00141     // create node handles
00142     ros::NodeHandle nh_, pnh_;
00143 
00144     // declaration of ros publishers
00145     ros::Publisher topicPub_LaserUnified_;
00146 
00147     // tf listener
00148     tf::TransformListener listener_;
00149 
00150     // laser geometry projector
00151     laser_geometry::LaserProjection projector_;
00152 
00153     /* ----------------------------------- */
00154     /* ----------- functions ------------- */
00155     /* ----------------------------------- */
00156 
00164     void getParams();
00165 
00174     void set_new_msg_received(bool received, int scan_id);
00175 
00184     bool get_new_msg_received(int scan_id);
00185 
00194     double getLoopRate();
00195 
00204     void initLaserScanStructs();
00205 
00215     void topicCallbackLaserScan(const sensor_msgs::LaserScan::ConstPtr& scan_in, int scan_id);
00216 
00225     void checkUnifieCondition();
00226 
00235     sensor_msgs::LaserScan unifieLaserScans();
00236 
00237 };
00238 #endif


cob_scan_unifier
Author(s): Florian Mirus
autogenerated on Wed Sep 2 2015 01:39:22