CameraSensor.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2016 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_SENSORS_CAMERASENSOR_HH_
18 #define _GAZEBO_SENSORS_CAMERASENSOR_HH_
19 
20 #include <memory>
21 #include <string>
22 
23 #include "gazebo/sensors/Sensor.hh"
26 #include "gazebo/util/system.hh"
27 
28 namespace gazebo
29 {
30  namespace sensors
31  {
32  // Forward declare private data class
33  class CameraSensorPrivate;
34 
37 
43  {
45  public: CameraSensor();
46 
48  public: virtual ~CameraSensor();
49 
53  public: virtual void Load(const std::string &_worldName,
54  sdf::ElementPtr _sdf);
55 
58  public: virtual void Load(const std::string &_worldName);
59 
61  public: virtual void Init();
62 
65  public: virtual std::string Topic() const;
66 
70  public: rendering::CameraPtr GetCamera() const GAZEBO_DEPRECATED(7.0);
71 
74  public: rendering::CameraPtr Camera() const;
75 
79  public: unsigned int GetImageWidth() const GAZEBO_DEPRECATED(7.0);
80 
84  public: unsigned int ImageWidth() const;
85 
89  public: unsigned int GetImageHeight() const GAZEBO_DEPRECATED(7.0);
90 
93  public: unsigned int ImageHeight() const;
94 
98  public: const unsigned char *GetImageData() GAZEBO_DEPRECATED(7.0);
99 
102  public: const unsigned char *ImageData() const;
103 
107  public: bool SaveFrame(const std::string &_filename);
108 
109  // Documentation inherited
110  public: virtual bool IsActive() const;
111 
112  // Documentation inherited
113  protected: virtual bool UpdateImpl(const bool _force);
114 
116  protected: virtual void Fini();
117 
119  protected: virtual void Render();
120 
122  protected: bool Rendered() const;
123 
126  protected: void SetRendered(const bool _value);
127 
130 
133 
136  private: std::unique_ptr<CameraSensorPrivate> dataPtr;
137  };
139  }
140 }
141 #endif
Basic camera sensor.
Definition: CameraSensor.hh:42
transport::PublisherPtr imagePub
Publisher of image messages.
Definition: CameraSensor.hh:132
Forward declarations for transport.
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
#define GAZEBO_DEPRECATED(version)
Definition: CommonTypes.hh:48
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
Base class for sensors.
Definition: Sensor.hh:50
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:59
boost::shared_ptr< Camera > CameraPtr
Definition: RenderTypes.hh:88
rendering::CameraPtr camera
Pointer to the camera.
Definition: CameraSensor.hh:129