CameraSensor.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_CAMERASENSOR_HH_
18 #define _GAZEBO_CAMERASENSOR_HH_
19 
20 #include <string>
21 
22 #include "gazebo/sensors/Sensor.hh"
23 #include "gazebo/msgs/MessageTypes.hh"
26 #include "gazebo/util/system.hh"
27 
28 namespace gazebo
29 {
30  namespace sensors
31  {
34 
40  {
42  public: CameraSensor();
43 
45  public: virtual ~CameraSensor();
46 
50  public: virtual void Load(const std::string &_worldName,
51  sdf::ElementPtr _sdf);
52 
55  public: virtual void Load(const std::string &_worldName);
56 
58  public: virtual void Init();
59 
63  public: virtual std::string GetTopic() const;
64 
65  // Documentation inherited
66  protected: virtual bool UpdateImpl(bool _force);
67 
69  protected: virtual void Fini();
70 
74  {return this->camera;}
75 
78  public: unsigned int GetImageWidth() const;
79 
82  public: unsigned int GetImageHeight() const;
83 
86  public: const unsigned char *GetImageData();
87 
91  public: bool SaveFrame(const std::string &_filename);
92 
93  // Documentation inherited
94  public: virtual bool IsActive();
95 
97  private: void Render();
98 
100  private: rendering::CameraPtr camera;
101 
103  private: transport::PublisherPtr imagePub;
104 
106  private: bool rendered;
107  };
109  }
110 }
111 #endif
Basic camera sensor.
Definition: CameraSensor.hh:39
rendering::CameraPtr GetCamera() const
Returns a pointer to the rendering::Camera.
Definition: CameraSensor.hh:73
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
Base class for sensors.
Definition: Sensor.hh:69
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:66