MultiCameraSensor.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2015 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 #ifndef _GAZEBO_MULTICAMERASENSOR_HH_
18 #define _GAZEBO_MULTICAMERASENSOR_HH_
19 
20 #include <string>
21 #include <vector>
22 
23 #include "gazebo/sensors/Sensor.hh"
24 #include "gazebo/msgs/MessageTypes.hh"
27 #include "gazebo/util/system.hh"
28 
29 namespace gazebo
30 {
31  namespace sensors
32  {
36 
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 bool UpdateImpl(bool _force);
96 
97  // Documentation inherited.
98  protected: virtual void Fini();
99 
101  private: void Render();
102 
104  private: std::vector<rendering::CameraPtr> cameras;
105 
107  private: mutable boost::mutex cameraMutex;
108 
110  private: transport::PublisherPtr imagePub;
111 
113  private: msgs::ImagesStamped msg;
114 
116  private: bool rendered;
117  };
119  }
120 }
121 #endif
Forward declarations for transport.
boost::shared_ptr< Camera > CameraPtr
Definition: RenderTypes.hh:87
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
Multiple camera sensor.
Definition: MultiCameraSensor.hh:40
Base class for sensors.
Definition: Sensor.hh:69
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:66