YARP
Yet Another Robot Platform
Lidar2DDeviceBase.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 #include <vector>
10 
11 #include <yarp/os/Searchable.h>
13 #include <yarp/dev/api.h>
14 #include <mutex>
15 
16 #ifndef YARP_DEV_2DLIDARDEVICETEMPLATE_H
17 #define YARP_DEV_2DLIDARDEVICETEMPLATE_H
18 
19 namespace yarp {
20 namespace dev {
21 
22 struct Range_t
23 {
24  double min;
25  double max;
26 };
27 
33 {
34 
35 protected:
36  //internal data
39  std::mutex m_mutex;
40 
41 protected:
42  //internal parameters
43  std::string m_info;
44  double m_scan_rate;
45  size_t m_sensorsNum;
46  double m_min_angle;
47  double m_max_angle;
50  double m_resolution;
54  std::vector <Range_t> m_range_skip_vector;
55 
56 public:
57  // the main parse function
58  bool parseConfiguration(yarp::os::Searchable& config);
59 
60 public:
61  //constructor
63 
64 public:
65  //IRangefinder2D interface
66  bool getRawData(yarp::sig::Vector& data) override;
67  bool getLaserMeasurement(std::vector<LaserMeasurementData>& data) override;
68  bool getDeviceStatus(Device_status& status) override;
69  bool getDeviceInfo(std::string& device_info) override;
70  bool getDistanceRange(double& min, double& max) override;
71  bool getScanLimits(double& min, double& max) override;
72  bool getHorizontalResolution(double& step) override;
73  bool getScanRate(double& rate) override;
74 
75 protected:
76  //utility methods called by laser devices
77  void applyLimitsOnLaserData();
78 
79 private:
80  //utility methods called internally by Lidar2DDeviceBase
81  bool checkSkipAngle(const double& angle, double& distance);
82 };
83 
84 } // dev
85 } // yarp
86 
87 #endif
yarp::dev::Lidar2DDeviceBase::m_laser_data
yarp::sig::Vector m_laser_data
Definition: Lidar2DDeviceBase.h:37
yarp::os::Searchable
A base class for nested structures that can be searched.
Definition: Searchable.h:69
IRangefinder2D.h
yarp::dev::Lidar2DDeviceBase::m_device_status
yarp::dev::IRangefinder2D::Device_status m_device_status
Definition: Lidar2DDeviceBase.h:38
yarp::dev::Lidar2DDeviceBase::m_resolution
double m_resolution
Definition: Lidar2DDeviceBase.h:50
yarp::dev::IRangefinder2D
A generic interface for planar laser range finders.
Definition: IRangefinder2D.h:38
yarp::dev::IRangefinder2D::Device_status
Device_status
Definition: IRangefinder2D.h:41
Searchable.h
yarp::dev::Lidar2DDeviceBase::m_min_angle
double m_min_angle
Definition: Lidar2DDeviceBase.h:46
yarp::dev::Lidar2DDeviceBase
The DLidarDeviceTemplate class.
Definition: Lidar2DDeviceBase.h:33
yarp::dev::Range_t::min
double min
Definition: Lidar2DDeviceBase.h:24
yarp::dev::Lidar2DDeviceBase::m_do_not_clip_and_allow_infinity_enable
bool m_do_not_clip_and_allow_infinity_enable
Definition: Lidar2DDeviceBase.h:53
yarp::sig::VectorOf< double >
yarp::dev::Lidar2DDeviceBase::m_sensorsNum
size_t m_sensorsNum
Definition: Lidar2DDeviceBase.h:45
yarp::dev::Lidar2DDeviceBase::m_clip_max_enable
bool m_clip_max_enable
Definition: Lidar2DDeviceBase.h:51
yarp::dev::Lidar2DDeviceBase::m_max_distance
double m_max_distance
Definition: Lidar2DDeviceBase.h:49
yarp::dev::Range_t
Definition: Lidar2DDeviceBase.h:23
yarp::dev::Lidar2DDeviceBase::m_info
std::string m_info
Definition: Lidar2DDeviceBase.h:43
yarp::dev::Lidar2DDeviceBase::m_clip_min_enable
bool m_clip_min_enable
Definition: Lidar2DDeviceBase.h:52
YARP_dev_API
#define YARP_dev_API
Definition: api.h:19
yarp::dev::Range_t::max
double max
Definition: Lidar2DDeviceBase.h:25
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::dev::Lidar2DDeviceBase::m_min_distance
double m_min_distance
Definition: Lidar2DDeviceBase.h:48
yarp::dev::Lidar2DDeviceBase::m_range_skip_vector
std::vector< Range_t > m_range_skip_vector
Definition: Lidar2DDeviceBase.h:54
yarp::dev::Lidar2DDeviceBase::m_scan_rate
double m_scan_rate
Definition: Lidar2DDeviceBase.h:44
api.h
yarp::dev::Lidar2DDeviceBase::m_max_angle
double m_max_angle
Definition: Lidar2DDeviceBase.h:47
yarp::dev::Lidar2DDeviceBase::m_mutex
std::mutex m_mutex
Definition: Lidar2DDeviceBase.h:39