Fawkes API  Fawkes Development Version
gazsim_depthcam_thread.h
1 /***************************************************************************
2  * gazsim_depthcam_plugin.cpp - Plugin simulates a depthcam in Gazebo and
3  * provides a point cloud
4  *
5  * Created: Fri Feb 19 20:58:32 2016
6  * Copyright 2016 Frederik Zwilling
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_GAZSIM_DEPTHCAM_THREAD_H_
23 #define _PLUGINS_GAZSIM_DEPTHCAM_THREAD_H_
24 
25 #include <aspect/blackboard.h>
26 #include <aspect/blocked_timing.h>
27 #include <aspect/clock.h>
28 #include <aspect/configurable.h>
29 #include <aspect/logging.h>
30 #include <aspect/pointcloud.h>
31 #include <core/threading/thread.h>
32 #include <pcl/point_cloud.h>
33 #include <pcl/point_types.h>
34 #include <plugins/gazebo/aspect/gazebo.h>
35 
36 #include <string.h>
37 
38 //from Gazebo
39 #include <gazebo/msgs/MessageTypes.hh>
40 #include <gazebo/transport/TransportTypes.hh>
41 #include <gazebo/transport/transport.hh>
42 
44  public fawkes::ClockAspect,
45  public fawkes::LoggingAspect,
49  public fawkes::GazeboAspect,
51 {
52 public:
54 
55  virtual void init();
56  virtual void loop();
57  virtual void finalize();
58 
59 private:
60  gazebo::transport::SubscriberPtr depthcam_sub_;
61 
62  //handler function for incoming depthcam data messages
63  void on_depthcam_data_msg(ConstPointCloudPtr &msg);
64 
65  //config values
66  //topic name of the gazebo message publisher
67  std::string topic_name_;
68  unsigned int width_;
69  unsigned int height_;
70  //id of the shared memory object
71  std::string shm_id_;
72  std::string frame_;
73  std::string pcl_id_;
74 
76 };
77 
78 #endif
DepthcamSimThread
Definition: gazsim_depthcam_thread.h:43
fawkes::GazeboAspect
Definition: gazebo.h:42
fawkes::RefPtr
RefPtr<> is a reference-counting shared smartpointer.
Definition: refptr.h:57
fawkes::BlockedTimingAspect
Definition: blocked_timing.h:56
DepthcamSimThread::finalize
virtual void finalize()
Finalize the thread.
Definition: gazsim_depthcam_thread.cpp:74
DepthcamSimThread::init
virtual void init()
Initialize the thread.
Definition: gazsim_depthcam_thread.cpp:50
fawkes::BlackBoardAspect
Definition: blackboard.h:38
fawkes::PointCloudAspect
Definition: pointcloud.h:37
fawkes::LoggingAspect
Definition: logging.h:38
DepthcamSimThread::DepthcamSimThread
DepthcamSimThread()
Constructor.
Definition: gazsim_depthcam_thread.cpp:43
fawkes::Thread
Definition: thread.h:45
DepthcamSimThread::loop
virtual void loop()
Code to execute in the thread.
Definition: gazsim_depthcam_thread.cpp:80
fawkes::ConfigurableAspect
Definition: configurable.h:38
fawkes::ClockAspect
Definition: clock.h:40