Ignition Sensors

API Reference

6.0.1
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/SuppressWarning.hh>
28 
29 #ifdef _WIN32
30 #pragma warning(push)
31 #pragma warning(disable: 4005)
32 #pragma warning(disable: 4251)
33 #endif
34 #include <ignition/msgs.hh>
35 #ifdef _WIN32
36 #pragma warning(pop)
37 #endif
38 
39 // TODO(louise) Remove these pragmas once ign-rendering is disabling the
40 // warnings
41 #ifdef _WIN32
42 #pragma warning(push)
43 #pragma warning(disable: 4251)
44 #endif
45 #include <ignition/rendering/DepthCamera.hh>
46 #ifdef _WIN32
47 #pragma warning(pop)
48 #endif
49 
50 #include "ignition/sensors/depth_camera/Export.hh"
52 #include "ignition/sensors/Export.hh"
54 
55 namespace ignition
56 {
57  namespace sensors
58  {
59  // Inline bracket to help doxygen filtering.
60  inline namespace IGNITION_SENSORS_VERSION_NAMESPACE {
61  // forward declarations
62  class DepthCameraSensorPrivate;
63 
71  class IGNITION_SENSORS_DEPTH_CAMERA_VISIBLE DepthCameraSensor
72  : public CameraSensor
73  {
75  public: DepthCameraSensor();
76 
78  public: virtual ~DepthCameraSensor();
79 
83  public: virtual bool Load(const sdf::Sensor &_sdf) override;
84 
88  public: virtual bool Load(sdf::ElementPtr _sdf) override;
89 
92  public: virtual bool Init() override;
93 
97  public: virtual bool Update(
98  const std::chrono::steady_clock::duration &_now) override;
99 
103  public: virtual rendering::DepthCameraPtr DepthCamera();
104 
111  public: void OnNewDepthFrame(const float *_scan,
112  unsigned int _width, unsigned int _height,
113  unsigned int /*_channels*/,
114  const std::string &/*_format*/);
115 
122  public: void OnNewRgbPointCloud(const float *_data,
123  unsigned int _width, unsigned int _height,
124  unsigned int /*_channels*/,
125  const std::string &/*_format*/);
126 
135  public: ignition::common::ConnectionPtr ConnectImageCallback(
137  void(const ignition::msgs::Image &)> _callback);
138 
141  public: virtual void SetScene(
142  ignition::rendering::ScenePtr _scene) override;
143 
146  public: virtual unsigned int ImageWidth() const override;
147 
150  public: virtual unsigned int ImageHeight() const override;
151 
154  public: virtual double FarClip() const;
155 
158  public: virtual double NearClip() const;
159 
162  private: bool CreateCamera();
163 
167  private: void OnSceneChange(ignition::rendering::ScenePtr /*_scene*/)
168  { }
169 
170  IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
174  IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
175  };
176  }
177  }
178 }
179 
180 #endif
Depth camera sensor class.
Definition: DepthCameraSensor.hh:71
Camera Sensor Class.
Definition: CameraSensor.hh:71
STL class.
Definition: AirPressureSensor.hh:31