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
Thread simulates a number of depthcams in Gazebo.
virtual void finalize()
Finalize the thread.
virtual void loop()
Code to execute in the thread.
virtual void init()
Initialize the thread.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Thread aspect to use blocked timing.
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:34
Thread aspect to access configuration data.
Definition: configurable.h:33
Thread aspect to get access to a Gazebo node handle.
Definition: gazebo.h:37
Thread aspect to log output.
Definition: logging.h:33
Thread aspect to provide and access point clouds.
Definition: pointcloud.h:38
RefPtr<> is a reference-counting shared smartpointer.
Definition: refptr.h:50
Thread class encapsulation of pthreads.
Definition: thread.h:46