Ignition Sensors

API Reference

5.0.0
DepthCameraSensor.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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_DEPTHCAMERASENSOR_HH_
18 #define IGNITION_SENSORS_DEPTHCAMERASENSOR_HH_
19 
20 #include <memory>
21 #include <cstdint>
22 #include <string>
23 
24 #include <sdf/sdf.hh>
25 
26 #include <ignition/common/Event.hh>
27 #include <ignition/common/PluginMacros.hh>
28 #include <ignition/common/SuppressWarning.hh>
29 #include <ignition/common/Time.hh>
30 
31 #ifdef _WIN32
32 #pragma warning(push)
33 #pragma warning(disable: 4005)
34 #pragma warning(disable: 4251)
35 #endif
36 #include <ignition/msgs.hh>
37 #ifdef _WIN32
38 #pragma warning(pop)
39 #endif
40 
41 // TODO(louise) Remove these pragmas once ign-rendering is disabling the
42 // warnings
43 #ifdef _WIN32
44 #pragma warning(push)
45 #pragma warning(disable: 4251)
46 #endif
47 #include <ignition/rendering/DepthCamera.hh>
48 #ifdef _WIN32
49 #pragma warning(pop)
50 #endif
51 
52 #include "ignition/sensors/depth_camera/Export.hh"
54 #include "ignition/sensors/Export.hh"
56 
57 namespace ignition
58 {
59  namespace sensors
60  {
61  // Inline bracket to help doxygen filtering.
62  inline namespace IGNITION_SENSORS_VERSION_NAMESPACE {
63  // forward declarations
64  class DepthCameraSensorPrivate;
65 
73  class IGNITION_SENSORS_DEPTH_CAMERA_VISIBLE DepthCameraSensor
74  : public CameraSensor
75  {
77  public: DepthCameraSensor();
78 
80  public: virtual ~DepthCameraSensor();
81 
85  public: virtual bool Load(const sdf::Sensor &_sdf) override;
86 
90  public: virtual bool Load(sdf::ElementPtr _sdf) override;
91 
94  public: virtual bool Init() override;
95 
99  public: virtual bool IGN_DEPRECATED(4) Update(
100  const ignition::common::Time &_now) override;
101 
105  public: virtual bool Update(
106  const std::chrono::steady_clock::duration &_now) override;
107 
111  public: virtual rendering::DepthCameraPtr DepthCamera();
112 
119  public: void OnNewDepthFrame(const float *_scan,
120  unsigned int _width, unsigned int _height,
121  unsigned int /*_channels*/,
122  const std::string &/*_format*/);
123 
130  public: void OnNewRgbPointCloud(const float *_data,
131  unsigned int _width, unsigned int _height,
132  unsigned int /*_channels*/,
133  const std::string &/*_format*/);
134 
143  public: ignition::common::ConnectionPtr ConnectImageCallback(
145  void(const ignition::msgs::Image &)> _callback);
146 
149  public: virtual void SetScene(
150  ignition::rendering::ScenePtr _scene) override;
151 
154  public: virtual unsigned int ImageWidth() const override;
155 
158  public: virtual unsigned int ImageHeight() const override;
159 
162  public: virtual double FarClip() const;
163 
166  public: virtual double NearClip() const;
167 
170  private: bool CreateCamera();
171 
175  private: void OnSceneChange(ignition::rendering::ScenePtr /*_scene*/)
176  { }
177 
178  IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
182  IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
183  };
184  }
185  }
186 }
187 
188 #endif
Depth camera sensor class.
Definition: DepthCameraSensor.hh:73
Camera Sensor Class.
Definition: CameraSensor.hh:73
STL class.
Definition: AirPressureSensor.hh:32