All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CameraSensor.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 /* Desc: A persepective X11 OpenGL Camera Sensor
18  * Author: Nate Koenig
19  * Date: 15 July 2003
20  */
21 
22 #ifndef _CAMERASENSOR_HH_
23 #define _CAMERASENSOR_HH_
24 
25 #include <string>
26 
27 #include "gazebo/sensors/Sensor.hh"
28 #include "gazebo/msgs/MessageTypes.hh"
31 #include "gazebo/util/system.hh"
32 
33 namespace gazebo
34 {
35  namespace sensors
36  {
39 
45  {
47  public: CameraSensor();
48 
50  public: virtual ~CameraSensor();
51 
55  public: virtual void Load(const std::string &_worldName,
56  sdf::ElementPtr _sdf);
57 
60  public: virtual void Load(const std::string &_worldName);
61 
63  public: virtual void Init();
64 
68  public: virtual std::string GetTopic() const;
69 
70  // Documentation inherited
71  protected: virtual bool UpdateImpl(bool _force);
72 
74  protected: virtual void Fini();
75 
79  {return this->camera;}
80 
83  public: unsigned int GetImageWidth() const;
84 
87  public: unsigned int GetImageHeight() const;
88 
91  public: const unsigned char *GetImageData();
92 
96  public: bool SaveFrame(const std::string &_filename);
97 
98  // Documentation inherited
99  public: virtual bool IsActive();
100 
102  private: void Render();
103 
105  private: rendering::CameraPtr camera;
106 
108  private: transport::PublisherPtr imagePub;
109 
111  private: bool rendered;
112  };
114  }
115 }
116 #endif
Basic camera sensor.
Definition: CameraSensor.hh:44
rendering::CameraPtr GetCamera() const
Returns a pointer to the rendering::Camera.
Definition: CameraSensor.hh:78
Forward declarations for transport.
boost::shared_ptr< Camera > CameraPtr
Definition: RenderTypes.hh:80
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:44
Base class for sensors.
Definition: Sensor.hh:67
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48