Gazebo Sensors

API Reference

6.8.1
gz/sensors/GpuLidarSensor.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_GPULIDARSENSOR_HH_
18 #define GZ_SENSORS_GPULIDARSENSOR_HH_
19 
20 #include <memory>
21 #include <string>
22 
23 #include <sdf/sdf.hh>
24 
25 #include <gz/common/SuppressWarning.hh>
26 
27 // TODO(louise) Remove these pragmas once ign-rendering is disabling the
28 // warnings
29 #ifdef _WIN32
30 #pragma warning(push)
31 #pragma warning(disable: 4251)
32 #endif
33 #include <gz/rendering/GpuRays.hh>
34 #ifdef _WIN32
35 #pragma warning(pop)
36 #endif
37 
38 #include "gz/sensors/gpu_lidar/Export.hh"
40 #include "gz/sensors/Lidar.hh"
41 
42 namespace ignition
43 {
44  namespace sensors
45  {
46  // Inline bracket to help doxygen filtering.
47  inline namespace IGNITION_SENSORS_VERSION_NAMESPACE {
48  //
50  class GpuLidarSensorPrivate;
51 
61  class IGNITION_SENSORS_GPU_LIDAR_VISIBLE GpuLidarSensor : public Lidar
62  {
64  public: GpuLidarSensor();
65 
67  public: virtual ~GpuLidarSensor();
68 
72  public: virtual bool Update(
73  const std::chrono::steady_clock::duration &_now) override;
74 
77  public: virtual bool Init() override;
78 
82  public: virtual bool Load(const sdf::Sensor &_sdf) override;
83 
87  public: virtual bool Load(sdf::ElementPtr _sdf) override;
88 
90  public: virtual bool CreateLidar() override;
91 
94  public: bool IsHorizontal() const;
95 
98  public: void SetScene(gz::rendering::ScenePtr _scene) override;
99 
102  public: void RemoveGpuRays(gz::rendering::ScenePtr _scene);
103 
106  public: gz::rendering::GpuRaysPtr GpuRays() const;
107 
114  public: double RayCountRatio() const;
115 
118  public: gz::math::Angle HFOV() const;
119 
122  public: gz::math::Angle VFOV() const;
123 
127  public: bool HasConnections() const;
128 
131  public: virtual gz::common::ConnectionPtr ConnectNewLidarFrame(
132  std::function<void(const float *_scan, unsigned int _width,
133  unsigned int _heighti, unsigned int _channels,
134  const std::string &/*_format*/)> _subscriber) override;
135 
138  private: void OnNewLidarFrame(const float *_scan, unsigned int _width,
139  unsigned int _heighti, unsigned int _channels,
140  const std::string &_format);
141 
142  IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
146  IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
147  };
148  }
149  }
150 }
151 
152 #endif
Definition: gz/sensors/AirPressureSensor.hh:31
STL class.
GpuLidar Sensor Class.
Definition: gz/sensors/GpuLidarSensor.hh:61
Lidar Sensor Class.
Definition: gz/sensors/Lidar.hh:49