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 <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 <core/threading/thread.h>
31 #include <fvutils/ipc/shm_image.h>
32 #include <plugins/gazebo/aspect/gazebo.h>
33 
34 #include <boost/circular_buffer.hpp>
35 #include <string.h>
36 
37 //from Gazebo
38 #include "gazsim_webcam.h"
39 
40 #include <gazebo/msgs/MessageTypes.hh>
41 #include <gazebo/transport/TransportTypes.hh>
42 #include <gazebo/transport/transport.hh>
43 
45  public fawkes::ClockAspect,
46  public fawkes::LoggingAspect,
51 {
52 public:
54 
55  virtual void init();
56  virtual void loop();
57  virtual void finalize();
58 
59 private:
60  std::vector<GazsimWebcam *> webcams_;
61 
62  //config values
63  std::vector<std::string> shm_ids_;
64 };
65 
66 #endif
WebcamSimThread::init
virtual void init()
Initialize the thread.
Definition: gazsim_webcam_thread.cpp:51
fawkes::GazeboAspect
Thread aspect to get access to a Gazebo node handle.
Definition: gazebo.h:37
WebcamSimThread::WebcamSimThread
WebcamSimThread()
Constructor.
Definition: gazsim_webcam_thread.cpp:44
fawkes::BlockedTimingAspect
Thread aspect to use blocked timing.
Definition: blocked_timing.h:51
WebcamSimThread::loop
virtual void loop()
Code to execute in the thread.
Definition: gazsim_webcam_thread.cpp:70
fawkes::BlackBoardAspect
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
fawkes::LoggingAspect
Thread aspect to log output.
Definition: logging.h:33
WebcamSimThread
Thread simulates a number of webcams in Gazebo.
Definition: gazsim_webcam_thread.h:51
fawkes::Thread
Thread class encapsulation of pthreads.
Definition: thread.h:46
fawkes::ConfigurableAspect
Thread aspect to access configuration data.
Definition: configurable.h:33
WebcamSimThread::finalize
virtual void finalize()
Finalize the thread.
Definition: gazsim_webcam_thread.cpp:62
fawkes::ClockAspect
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:34