Gazebo Sensors

API Reference

6.8.1
gz/sensors/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 GZ_SENSORS_DEPTHCAMERASENSOR_HH_
18 #define GZ_SENSORS_DEPTHCAMERASENSOR_HH_
19 
20 #include <memory>
21 #include <cstdint>
22 #include <string>
23 
24 #include <sdf/sdf.hh>
25 
26 #include <gz/common/Event.hh>
27 #include <gz/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 <gz/rendering/DepthCamera.hh>
46 #ifdef _WIN32
47 #pragma warning(pop)
48 #endif
49 
50 #include "gz/sensors/depth_camera/Export.hh"
52 #include "gz/sensors/Export.hh"
53 #include "gz/sensors/Sensor.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: gz::common::ConnectionPtr ConnectImageCallback(
137  void(const gz::msgs::Image &)> _callback);
138 
141  public: virtual void SetScene(
142  gz::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 
163  public: bool HasConnections() const;
164 
168  public: bool HasDepthConnections() const;
169 
173  public: bool HasPointConnections() const;
174 
177  private: bool CreateCamera();
178 
182  private: void OnSceneChange(gz::rendering::ScenePtr /*_scene*/)
183  { }
184 
185  IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
189  IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
190  };
191  }
192  }
193 }
194 
195 #endif
Definition: gz/sensors/AirPressureSensor.hh:31
STL class.
Depth camera sensor class.
Definition: gz/sensors/DepthCameraSensor.hh:71
Camera Sensor Class.
Definition: gz/sensors/CameraSensor.hh:71