Fawkes API  Fawkes Development Version
pcl_db_roscomm_thread.h
1 
2 /***************************************************************************
3  * pcl_db_roscomm_thread.h - ROS communication for pcl-db-merge
4  *
5  * Created: Thu Dec 06 13:52:27 2012
6  * Copyright 2012-2013 Tim Niemueller [www.niemueller.de]
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Library General Public License for more details.
18  *
19  * Read the full text in the LICENSE.GPL file in the doc directory.
20  */
21 
22 #ifndef __PLUGINS_PERCEPTION_PCL_DB_ROS_PCL_DB_ROSCOMM_THREAD_H_
23 #define __PLUGINS_PERCEPTION_PCL_DB_ROS_PCL_DB_ROSCOMM_THREAD_H_
24 
25 #include <core/threading/thread.h>
26 #include <aspect/configurable.h>
27 #include <aspect/logging.h>
28 #include <aspect/blackboard.h>
29 #include <aspect/blocked_timing.h>
30 #include <aspect/pointcloud.h>
31 #include <plugins/ros/aspect/ros.h>
32 
33 #include <hybris_c1_msgs/MergePointClouds.h>
34 #include <hybris_c1_msgs/RetrievePointCloud.h>
35 #include <hybris_c1_msgs/StorePointCloud.h>
36 #include <hybris_c1_msgs/RecordData.h>
37 
38 namespace fawkes {
39  class PclDatabaseMergeInterface;
40  class PclDatabaseRetrieveInterface;
41  class PclDatabaseStoreInterface;
42  class BlackBoardOnUpdateWaker;
43  class WaitCondition;
44 }
45 namespace ros {
46  class ServiceServer;
47 }
48 
49 
51 : public fawkes::Thread,
52  public fawkes::LoggingAspect,
56  public fawkes::ROSAspect,
58 {
59  public:
61  virtual ~PointCloudDBROSCommThread();
62 
63  virtual void init();
64  virtual void loop();
65  virtual void finalize();
66 
67  private:
68  bool merge_cb(hybris_c1_msgs::MergePointClouds::Request &req,
69  hybris_c1_msgs::MergePointClouds::Response &resp);
70  bool retrieve_cb(hybris_c1_msgs::RetrievePointCloud::Request &req,
71  hybris_c1_msgs::RetrievePointCloud::Response &resp);
72  bool store_cb(hybris_c1_msgs::StorePointCloud::Request &req,
73  hybris_c1_msgs::StorePointCloud::Response &resp);
74  bool record_cb(hybris_c1_msgs::RecordData::Request &req,
75  hybris_c1_msgs::RecordData::Response &resp);
76 
77 
78  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
79  protected: virtual void run() { Thread::run(); }
80 
81  private: // members
85 
86  fawkes::BlackBoardOnUpdateWaker *merge_update_waker_;
87  fawkes::WaitCondition *merge_waitcond_;
88 
89  fawkes::BlackBoardOnUpdateWaker *retrieve_update_waker_;
90  fawkes::WaitCondition *retrieve_waitcond_;
91 
92  fawkes::BlackBoardOnUpdateWaker *store_update_waker_;
93  fawkes::WaitCondition *store_waitcond_;
94 
95  ros::ServiceServer *srv_merge_;
96  ros::ServiceServer *srv_retrieve_;
97  ros::ServiceServer *srv_store_;
98  ros::ServiceServer *srv_record_;
99 
100  unsigned int merge_msg_id_;
101  unsigned int retrieve_msg_id_;
102  unsigned int store_msg_id_;
103 
104  std::string cfg_store_pcl_id_;
105 };
106 
107 #endif
PclDatabaseMergeInterface Fawkes BlackBoard Interface.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Wait until a given condition holds.
Thread aspect to get access to a ROS node handle.
Definition: ros.h:39
Wake threads when a blackboard interface is updated.
PclDatabaseRetrieveInterface Fawkes BlackBoard Interface.
Fawkes library namespace.
Thread aspect to provide and access point clouds.
Definition: pointcloud.h:40
virtual void run()
Code to execute in the thread.
Definition: thread.cpp:939
Thread class encapsulation of pthreads.
Definition: thread.h:42
Thread to merge point clouds from database on request.
Thread aspect to use blocked timing.
Definition: act_thread.h:37
Thread aspect to log output.
Definition: logging.h:35
virtual void run()
Stub to see name in backtrace for easier debugging.
Thread aspect to access configuration data.
Definition: configurable.h:35
PclDatabaseStoreInterface Fawkes BlackBoard Interface.