All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CameraSensor.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2012 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 "sensors/Sensor.hh"
28 #include "msgs/MessageTypes.hh"
30 #include "rendering/RenderTypes.hh"
31 
32 namespace gazebo
33 {
34  namespace sensors
35  {
38 
43  class CameraSensor : public Sensor
44  {
46  public: CameraSensor();
47 
49  public: virtual ~CameraSensor();
50 
53  public: virtual void SetParent(const std::string &_name);
54 
58  public: virtual void Load(const std::string &_worldName,
59  sdf::ElementPtr _sdf);
60 
63  public: virtual void Load(const std::string &_worldName);
64 
66  public: virtual void Init();
67 
71  public: virtual std::string GetTopic() const;
72 
75  protected: virtual void UpdateImpl(bool _force);
76 
78  protected: virtual void Fini();
79 
83  {return this->camera;}
84 
87  public: unsigned int GetImageWidth() const;
88 
91  public: unsigned int GetImageHeight() const;
92 
95  public: const unsigned char *GetImageData();
96 
100  public: bool SaveFrame(const std::string &_filename);
101 
102  // Documentation inherited
103  public: virtual bool IsActive();
104 
105  private: rendering::CameraPtr camera;
106  private: rendering::ScenePtr scene;
107 
108  private: transport::PublisherPtr imagePub;
109  };
111  }
112 }
113 #endif