Ignition Sensors

API Reference

5.0.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/SuppressWarning.hh>
28 #include <ignition/common/Time.hh>
29 
30 #ifdef _WIN32
31 #pragma warning(push)
32 #pragma warning(disable: 4005)
33 #pragma warning(disable: 4251)
34 #endif
35 #include <ignition/msgs.hh>
36 #ifdef _WIN32
37 #pragma warning(pop)
38 #endif
39 
40 // TODO(louise) Remove these pragmas once ign-rendering is disabling the
41 // warnings
42 #ifdef _WIN32
43 #pragma warning(push)
44 #pragma warning(disable: 4251)
45 #endif
46 #include <ignition/rendering/Camera.hh>
47 #ifdef _WIN32
48 #pragma warning(pop)
49 #endif
50 
51 #include "ignition/sensors/camera/Export.hh"
52 #include "ignition/sensors/config.hh"
53 #include "ignition/sensors/Export.hh"
55 
56 namespace ignition
57 {
58  namespace sensors
59  {
60  // Inline bracket to help doxygen filtering.
61  inline namespace IGNITION_SENSORS_VERSION_NAMESPACE {
62  //
64  class CameraSensorPrivate;
65 
73  class IGNITION_SENSORS_CAMERA_VISIBLE CameraSensor : public RenderingSensor
74  {
76  public: CameraSensor();
77 
79  public: virtual ~CameraSensor();
80 
84  public: virtual bool Load(const sdf::Sensor &_sdf) override;
85 
89  public: virtual bool Load(sdf::ElementPtr _sdf) override;
90 
93  public: virtual bool Init() override;
94 
98  public: virtual bool IGN_DEPRECATED(4) Update(
99  const ignition::common::Time &_now) override;
100 
104  public: virtual bool Update(
105  const std::chrono::steady_clock::duration &_now) override;
106 
115  public: ignition::common::ConnectionPtr ConnectImageCallback(
117  void(const ignition::msgs::Image &)> _callback);
118 
121  public: virtual void SetScene(
122  ignition::rendering::ScenePtr _scene) override;
123 
126  public: virtual unsigned int ImageWidth() const;
127 
130  public: virtual unsigned int ImageHeight() const;
131 
134  public: rendering::CameraPtr RenderingCamera() const;
135 
138  public: std::string InfoTopic() const;
139 
143  public: void SetBaseline(double _baseline);
144 
147  public: double Baseline() const;
148 
151  protected: bool AdvertiseInfo();
152 
158  protected: bool AdvertiseInfo(const std::string &_topic);
159 
163  protected: void PopulateInfo(const sdf::Camera *_cameraSdf);
164 
167  protected: void IGN_DEPRECATED(4) PublishInfo(
168  const ignition::common::Time &_now);
169 
172  protected: void PublishInfo(
173  const std::chrono::steady_clock::duration &_now);
174 
177  private: bool CreateCamera();
178 
182  private: void OnSceneChange(ignition::rendering::ScenePtr /*_scene*/);
183 
184  IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
187  private: std::unique_ptr<CameraSensorPrivate> dataPtr;
188  IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
189  };
190  }
191  }
192 }
193 
194 #endif
a rendering sensor class
Definition: RenderingSensor.hh:52
Camera Sensor Class.
Definition: CameraSensor.hh:73
STL class.
Definition: AirPressureSensor.hh:32