Fawkes API  Fawkes Development Version
gazsim_webcam_thread.h
1 /***************************************************************************
2  * gazsim_webcam_plugin.cpp - Plugin simulates Webcams in Gazebo and
3  * provides a shared memory buffer
4  *
5  * Created: Sat Sep 21 17:35:27 2013
6  * Copyright 2013 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_WEBCAM_THREAD_H_
23 #define __PLUGINS_GAZSIM_WEBCAM_THREAD_H_
24 
25 #include <core/threading/thread.h>
26 #include <aspect/clock.h>
27 #include <aspect/configurable.h>
28 #include <aspect/logging.h>
29 #include <aspect/blackboard.h>
30 #include <aspect/blocked_timing.h>
31 #include <plugins/gazebo/aspect/gazebo.h>
32 #include <string.h>
33 
34 #include <fvutils/ipc/shm_image.h>
35 #include <boost/circular_buffer.hpp>
36 
37 //from Gazebo
38 #include <gazebo/transport/TransportTypes.hh>
39 #include <gazebo/msgs/MessageTypes.hh>
40 #include <gazebo/transport/transport.hh>
41 
42 #include "gazsim_webcam.h"
43 
45 : public fawkes::Thread,
46  public fawkes::ClockAspect,
47  public fawkes::LoggingAspect,
52 {
53  public:
55 
56  virtual void init();
57  virtual void loop();
58  virtual void finalize();
59 
60  private:
61  std::vector<GazsimWebcam*> webcams_;
62 
63  //config values
64  std::vector<std::string> shm_ids_;
65 };
66 
67 #endif
WebcamSimThread()
Constructor.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:36
Thread aspect to get access to a Gazebo node handle.
Definition: gazebo.h:37
virtual void finalize()
Finalize the thread.
Thread class encapsulation of pthreads.
Definition: thread.h:42
Thread aspect to use blocked timing.
virtual void init()
Initialize the thread.
virtual void loop()
Code to execute in the thread.
Thread simulates a number of webcams in Gazebo.
Thread aspect to log output.
Definition: logging.h:35
Thread aspect to access configuration data.
Definition: configurable.h:35