Gazebo Sensors

API Reference

3.6.0
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/PluginMacros.hh>
28 #include <gz/common/SuppressWarning.hh>
29 #include <gz/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 <gz/rendering/DepthCamera.hh>
48 #ifdef _WIN32
49 #pragma warning(pop)
50 #endif
51 
52 #include "gz/sensors/depth_camera/Export.hh"
54 #include "gz/sensors/Export.hh"
55 #include "gz/sensors/Sensor.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 Update(const common::Time &_now) override;
100 
104  public: virtual rendering::DepthCameraPtr DepthCamera();
105 
112  public: void OnNewDepthFrame(const float *_scan,
113  unsigned int _width, unsigned int _height,
114  unsigned int /*_channels*/,
115  const std::string &/*_format*/);
116 
123  public: void OnNewRgbPointCloud(const float *_data,
124  unsigned int _width, unsigned int _height,
125  unsigned int /*_channels*/,
126  const std::string &/*_format*/);
127 
136  public: gz::common::ConnectionPtr ConnectImageCallback(
138  void(const gz::msgs::Image &)> _callback);
139 
142  public: virtual void SetScene(
143  gz::rendering::ScenePtr _scene) override;
144 
147  public: virtual unsigned int ImageWidth() const override;
148 
151  public: virtual unsigned int ImageHeight() const override;
152 
155  public: virtual double FarClip() const;
156 
159  public: virtual double NearClip() const;
160 
163  private: bool CreateCamera();
164 
168  private: void OnSceneChange(gz::rendering::ScenePtr /*_scene*/)
169  { }
170 
171  IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
175  IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
176  };
177  }
178  }
179 }
180 
181 #endif
Definition: gz/sensors/AirPressureSensor.hh:32
STL class.
Depth camera sensor class.
Definition: gz/sensors/DepthCameraSensor.hh:73
Camera Sensor Class.
Definition: gz/sensors/CameraSensor.hh:73