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 #include "gazebo/util/system.hh"
29 
30 namespace gazebo
31 {
32  namespace sensors
33  {
37 
42  {
44  public: MultiCameraSensor();
45 
47  public: virtual ~MultiCameraSensor();
48 
49  // Documentation inherited
50  public: virtual void Load(const std::string &_worldName);
51 
52  // Documentation inherited
53  public: virtual void Init();
54 
55  // Documentation inherited
56  public: virtual std::string GetTopic() const;
57 
60  public: unsigned int GetCameraCount() const;
61 
66  public: rendering::CameraPtr GetCamera(unsigned int _index) const;
67 
72  public: unsigned int GetImageWidth(unsigned int _index) const;
73 
78  public: unsigned int GetImageHeight(unsigned int _index) const;
79 
84  public: const unsigned char *GetImageData(unsigned int _index);
85 
90  public: bool SaveFrame(const std::vector<std::string> &_filenames);
91 
92  // Documentation inherited.
93  public: virtual bool IsActive();
94 
95  // Documentation inherited.
96  protected: virtual bool UpdateImpl(bool _force);
97 
98  // Documentation inherited.
99  protected: virtual void Fini();
100 
102  private: void Render();
103 
105  private: std::vector<rendering::CameraPtr> cameras;
106 
108  private: mutable boost::mutex cameraMutex;
109 
111  private: transport::PublisherPtr imagePub;
112 
114  private: msgs::ImagesStamped msg;
115 
117  private: bool rendered;
118  };
120  }
121 }
122 #endif