Gazebo Sensors

API Reference

3.6.0
gz/sensors/Lidar.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_LIDAR_HH_
18 #define GZ_SENSORS_LIDAR_HH_
19 
20 #include <memory>
21 #include <string>
22 #include <vector>
23 
24 #include <gz/common/SuppressWarning.hh>
25 #include <gz/common/Event.hh>
26 
27 #include "gz/sensors/lidar/Export.hh"
29 
30 namespace ignition
31 {
32  namespace sensors
33  {
34  // Inline bracket to help doxygen filtering.
35  inline namespace IGNITION_SENSORS_VERSION_NAMESPACE {
36  //
38  class LidarPrivate;
39 
49  class IGNITION_SENSORS_LIDAR_VISIBLE Lidar : public RenderingSensor
50  {
52  public: Lidar();
53 
55  public: virtual ~Lidar();
56 
60  public: virtual bool Update(const common::Time &_now) override;
61 
65  public: void ApplyNoise();
66 
70  public: virtual bool PublishLidarScan(const common::Time &_now);
71 
75  public: virtual bool Load(const sdf::Sensor &_sdf) override;
76 
80  public: virtual bool Load(sdf::ElementPtr _sdf) override;
81 
84  public: virtual bool Init() override;
85 
88  public: void SetParent(const std::string &_parent) override;
89 
91  public: virtual bool CreateLidar();
92 
94  protected: virtual void Fini();
95 
98  public: gz::math::Angle AngleMin() const;
99 
102  public: void SetAngleMin(const double _angle);
103 
106  public: gz::math::Angle AngleMax() const;
107 
110  public: void SetAngleMax(const double _angle);
111 
114  public: double AngleResolution() const;
115 
118  public: double RangeMin() const;
119 
122  public: double RangeMax() const;
123 
131  public: double RangeResolution() const;
132 
135  public: unsigned int RayCount() const;
136 
139  public: unsigned int RangeCount() const;
140 
143  public: unsigned int VerticalRayCount() const;
144 
147  public: unsigned int VerticalRangeCount() const;
148 
151  public: gz::math::Angle VerticalAngleMin() const;
152 
155  public: void SetVerticalAngleMin(const double _angle);
156 
159  public: gz::math::Angle VerticalAngleMax() const;
160 
163  public: void SetVerticalAngleMax(const double _angle);
164 
167  public: double VerticalAngleResolution() const;
168 
178  public: double Range(const int _index) const;
179 
182  public: void Ranges(std::vector<double> &_ranges) const;
183 
193  public: double Retro(const int _index) const;
194 
204  public: int Fiducial(const unsigned int _index) const;
205 
208  public: bool IsHorizontal() const;
209 
216  public: double RayCountRatio() const;
217 
224  public: double RangeCountRatio() const;
225 
228  public: double HorzFOV() const;
229 
232  public: double VertFOV() const;
233 
234  // Documentation inherited
235  public: virtual bool IsActive() const;
236 
237  IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
239  public: mutable std::mutex lidarMutex;
240  IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
241 
243  public: float *laserBuffer = nullptr;
244 
246  public: bool initialized = false;
247 
255  public: virtual gz::common::ConnectionPtr ConnectNewLidarFrame(
256  std::function<void(const float *_scan, unsigned int _width,
257  unsigned int _heighti, unsigned int _channels,
258  const std::string &/*_format*/)> _subscriber);
259 
260  IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
263  private: std::unique_ptr<LidarPrivate> dataPtr;
264  IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
265  };
266  }
267  }
268 }
269 
270 #endif
a rendering sensor class
Definition: gz/sensors/RenderingSensor.hh:52
Definition: gz/sensors/AirPressureSensor.hh:32
STL class.
STL class.
std::mutex lidarMutex
Just a mutex for thread safety.
Definition: gz/sensors/Lidar.hh:239
Lidar Sensor Class.
Definition: gz/sensors/Lidar.hh:49
STL class.