All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MultiCameraSensor.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2014 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef _MULTICAMERASENSOR_HH_
19 #define _MULTICAMERASENSOR_HH_
20 
21 #include <string>
22 #include <vector>
23 
24 #include "gazebo/sensors/Sensor.hh"
25 #include "gazebo/msgs/MessageTypes.hh"
28 
29 namespace gazebo
30 {
31  namespace sensors
32  {
36 
40  class MultiCameraSensor : public Sensor
41  {
43  public: MultiCameraSensor();
44 
46  public: virtual ~MultiCameraSensor();
47 
48  // Documentation inherited
49  public: virtual void Load(const std::string &_worldName);
50 
51  // Documentation inherited
52  public: virtual void Init();
53 
54  // Documentation inherited
55  public: virtual std::string GetTopic() const;
56 
59  public: unsigned int GetCameraCount() const;
60 
65  public: rendering::CameraPtr GetCamera(unsigned int _index) const;
66 
71  public: unsigned int GetImageWidth(unsigned int _index) const;
72 
77  public: unsigned int GetImageHeight(unsigned int _index) const;
78 
83  public: const unsigned char *GetImageData(unsigned int _index);
84 
89  public: bool SaveFrame(const std::vector<std::string> &_filenames);
90 
91  // Documentation inherited.
92  public: virtual bool IsActive();
93 
94  // Documentation inherited.
95  protected: virtual void UpdateImpl(bool _force);
96 
97  // Documentation inherited.
98  protected: virtual void Fini();
99 
101  private: std::vector<rendering::CameraPtr> cameras;
102 
104  private: mutable boost::mutex cameraMutex;
105 
107  private: transport::PublisherPtr imagePub;
108 
109  private: rendering::ScenePtr scene;
110  };
112  }
113 }
114 #endif