Ignition Sensors

API Reference

3.1.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 
28 #include <ignition/common/PluginMacros.hh>
29 #include <ignition/common/Time.hh>
30 
31 #include <ignition/msgs.hh>
32 
33 #include <ignition/rendering/DepthCamera.hh>
34 
35 #include "ignition/sensors/depth_camera/Export.hh"
37 #include "ignition/sensors/Export.hh"
39 
40 namespace ignition
41 {
42  namespace sensors
43  {
44  // Inline bracket to help doxygen filtering.
45  inline namespace IGNITION_SENSORS_VERSION_NAMESPACE {
46  // forward declarations
47  class DepthCameraSensorPrivate;
48 
56  class IGNITION_SENSORS_DEPTH_CAMERA_VISIBLE DepthCameraSensor
57  : public CameraSensor
58  {
60  public: DepthCameraSensor();
61 
63  public: virtual ~DepthCameraSensor();
64 
68  public: virtual bool Load(const sdf::Sensor &_sdf) override;
69 
73  public: virtual bool Load(sdf::ElementPtr _sdf) override;
74 
77  public: virtual bool Init() override;
78 
82  public: virtual bool Update(const common::Time &_now) override;
83 
87  public: virtual rendering::DepthCameraPtr DepthCamera();
88 
95  public: void OnNewDepthFrame(const float *_scan,
96  unsigned int _width, unsigned int _height,
97  unsigned int /*_channels*/,
98  const std::string &/*_format*/);
99 
106  public: void OnNewRgbPointCloud(const float *_data,
107  unsigned int _width, unsigned int _height,
108  unsigned int /*_channels*/,
109  const std::string &/*_format*/);
110 
119  public: ignition::common::ConnectionPtr ConnectImageCallback(
121  void(const ignition::msgs::Image &)> _callback);
122 
125  public: virtual void SetScene(
126  ignition::rendering::ScenePtr _scene) override;
127 
130  public: virtual unsigned int ImageWidth() const override;
131 
134  public: virtual unsigned int ImageHeight() const override;
135 
138  public: virtual double FarClip() const;
139 
142  public: virtual double NearClip() const;
143 
146  private: bool CreateCamera();
147 
151  private: void OnSceneChange(ignition::rendering::ScenePtr /*_scene*/)
152  { }
153 
157  };
158  }
159  }
160 }
161 
162 #endif
Depth camera sensor class.
Definition: DepthCameraSensor.hh:56
Camera Sensor Class.
Definition: CameraSensor.hh:54
STL class.
Definition: AirPressureSensor.hh:31