moped_handler_alg_node.h
Go to the documentation of this file.
00001 // Copyright (C) 2010-2011 Institut de Robotica i Informatica Industrial, CSIC-UPC.
00002 // Author 
00003 // All rights reserved.
00004 //
00005 // This file is part of iri-ros-pkg
00006 // iri-ros-pkg is free software: you can redistribute it and/or modify
00007 // it under the terms of the GNU Lesser General Public License as published by
00008 // the Free Software Foundation, either version 3 of the License, or
00009 // at your option) any later version.
00010 //
00011 // This program is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public License
00017 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018 // 
00019 // IMPORTANT NOTE: This code has been generated through a script from the 
00020 // iri_ros_scripts. Please do NOT delete any comments to guarantee the correctness
00021 // of the scripts. ROS topics can be easly add by using those scripts. Please
00022 // refer to the IRI wiki page for more information:
00023 // http://wikiri.upc.es/index.php/Robotics_Lab
00024 
00025 #ifndef _moped_handler_alg_node_h_
00026 #define _moped_handler_alg_node_h_
00027 
00028 #include <iri_base_algorithm/iri_base_algorithm.h>
00029 #include "moped_handler_alg.h"
00030 
00031 // [publisher subscriber headers]
00032 #include <pr_msgs/ObjectPoseList.h>
00033 #include <sensor_msgs/Image.h>
00034 #include <sensor_msgs/PointCloud2.h>
00035 
00036 // [service client headers]
00037 #include <iri_moped_handler/enable.h>
00038 
00039 // [action server client headers]
00040 #include <actionlib/client/simple_action_client.h>
00041 #include <actionlib/client/terminal_state.h>
00042 #include <iri_moped_actionserver/mopedAction.h>
00043 
00044 // Time synchronizer libs
00045 #include <message_filters/subscriber.h>
00046 #include <message_filters/synchronizer.h>
00047 #include <message_filters/sync_policies/approximate_time.h>
00048 #include <message_filters/time_synchronizer.h>
00049 
00050 using namespace sensor_msgs;
00051 using namespace message_filters;
00052 
00053 // PCL specific includes
00054 #include <pcl/ros/conversions.h>
00055 #include <pcl/point_cloud.h>
00056 #include <pcl/point_types.h>
00057 
00062 class MopedHandlerAlgNode : public algorithm_base::IriBaseAlgorithm<MopedHandlerAlgorithm>
00063 {
00064   private:
00065     // [publisher attributes]
00066     ros::Publisher outputOPL_publisher_;
00067     pr_msgs::ObjectPoseList ObjectPoseList_msg_;
00068 
00069     // [subscriber attributes]
00070         message_filters::Subscriber<sensor_msgs::Image> subImage_;
00071         message_filters::Subscriber<sensor_msgs::PointCloud2> subPointCloud_;
00072 
00073         // NOTE: When using "ApproximateTime" getting images from different moments may happen.
00074         typedef message_filters::sync_policies::ApproximateTime<sensor_msgs::Image, sensor_msgs::PointCloud2> MySyncPolicy;
00075         message_filters::Synchronizer<MySyncPolicy> *sync_;
00076 
00077     // [service attributes]
00078     ros::ServiceServer enable_server_;
00079     bool enableCallback(iri_moped_handler::enable::Request &req, iri_moped_handler::enable::Response &res);
00080     CMutex enable_mutex_;
00081 
00082     // [client attributes]
00083 
00084     // [action server attributes]
00085 
00086     // [action client attributes]
00087     actionlib::SimpleActionClient<iri_moped_actionserver::mopedAction> moped_client_;
00088     iri_moped_actionserver::mopedGoal moped_goal_;
00089     void mopedMakeActionRequest();
00090     void mopedDone(const actionlib::SimpleClientGoalState& state,  const iri_moped_actionserver::mopedResultConstPtr& result);
00091     void mopedActive();
00092     void mopedFeedback(const iri_moped_actionserver::mopedFeedbackConstPtr& feedback);
00093 
00094 
00095   public:
00102     MopedHandlerAlgNode(void);
00103 
00110     ~MopedHandlerAlgNode(void);
00111 
00112   protected:
00125     void mainNodeThread(void);
00126 
00139     void node_config_update(Config &config, uint32_t level);
00140 
00147     void addNodeDiagnostics(void);
00148 
00149     // [diagnostic functions]
00150     
00151     // [test functions]
00152 
00153         // Other functions
00154         void callback(const ImageConstPtr& image, const PointCloud2ConstPtr& pcl);
00155 
00156         // Attributes
00157         sensor_msgs::Image inputImage;
00158         sensor_msgs::PointCloud2 inputPointCloud;
00159         pcl::PointCloud<pcl::PointXYZ> pcl_;
00160 
00161         // Control variables.
00162         bool working;
00163 };
00164 
00165 #endif


iri_moped_handler
Author(s): frigual
autogenerated on Fri Dec 6 2013 20:55:45