Ignition Sensors

API Reference

3.1.0
CameraSensor.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 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 IGNITION_SENSORS_CAMERASENSOR_HH_
18 #define IGNITION_SENSORS_CAMERASENSOR_HH_
19 
20 #include <cstdint>
21 #include <memory>
22 #include <string>
23 
24 #include <sdf/sdf.hh>
25 
26 #include <ignition/common/PluginMacros.hh>
27 #include <ignition/common/Time.hh>
28 
29 #include <ignition/msgs.hh>
30 #include <ignition/rendering/Camera.hh>
31 
32 #include "ignition/sensors/camera/Export.hh"
33 #include "ignition/sensors/config.hh"
34 #include "ignition/sensors/Export.hh"
36 
37 namespace ignition
38 {
39  namespace sensors
40  {
41  // Inline bracket to help doxygen filtering.
42  inline namespace IGNITION_SENSORS_VERSION_NAMESPACE {
43  //
45  class CameraSensorPrivate;
46 
54  class IGNITION_SENSORS_CAMERA_VISIBLE CameraSensor : public RenderingSensor
55  {
57  public: CameraSensor();
58 
60  public: virtual ~CameraSensor();
61 
65  public: virtual bool Load(const sdf::Sensor &_sdf) override;
66 
70  public: virtual bool Load(sdf::ElementPtr _sdf) override;
71 
74  public: virtual bool Init() override;
75 
79  public: virtual bool Update(const common::Time &_now) override;
80 
89  public: ignition::common::ConnectionPtr ConnectImageCallback(
91  void(const ignition::msgs::Image &)> _callback);
92 
95  public: virtual void SetScene(
96  ignition::rendering::ScenePtr _scene) override;
97 
100  public: virtual unsigned int ImageWidth() const;
101 
104  public: virtual unsigned int ImageHeight() const;
105 
108  public: rendering::CameraPtr RenderingCamera() const;
109 
112  public: std::string InfoTopic() const;
113 
117  public: void SetBaseline(double _baseline);
118 
121  public: double Baseline() const;
122 
125  protected: bool AdvertiseInfo();
126 
132  protected: bool AdvertiseInfo(const std::string &_topic);
133 
137  protected: void PopulateInfo(const sdf::Camera *_cameraSdf);
138 
141  protected: void PublishInfo(const ignition::common::Time &_now);
142 
145  private: bool CreateCamera();
146 
150  private: void OnSceneChange(ignition::rendering::ScenePtr /*_scene*/);
151 
154  private: std::unique_ptr<CameraSensorPrivate> dataPtr;
155  };
156  }
157  }
158 }
159 
160 #endif
a rendering sensor class
Definition: RenderingSensor.hh:42
Camera Sensor Class.
Definition: CameraSensor.hh:54
STL class.
Definition: AirPressureSensor.hh:31