YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Lidar2DDeviceBase.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#include <vector>
7
8#include <yarp/os/Stamp.h>
11#include <yarp/dev/api.h>
12#include <mutex>
13
14#ifndef YARP_DEV_2DLIDARDEVICETEMPLATE_H
15#define YARP_DEV_2DLIDARDEVICETEMPLATE_H
16
17namespace yarp::dev {
18
19struct Range_t
20{
21 double min;
22 double max;
23};
24
30{
31protected:
32 //internal data
36 std::mutex m_mutex;
37
38protected:
39 //internal parameters
40 std::string m_info;
51 std::vector <Range_t> m_range_skip_vector;
52
53public:
54 // the main parse function
55 bool parseConfiguration(yarp::os::Searchable& config);
56
57public:
58 //constructor
60
61protected:
62 //This section contains utility methods called by laser devices
63
70 virtual bool updateLidarData();
71
77 virtual bool updateTimestamp();
78
83 virtual bool applyLimitsOnLaserData();
84
89 virtual bool acquireDataFromHW() = 0;
90
91public:
92 //IRangefinder2D interface
93 bool getRawData(yarp::sig::Vector& data, double* timestamp = nullptr) override;
94 bool getLaserMeasurement(std::vector<LaserMeasurementData>& data, double* timestamp = nullptr) override;
95 bool getDeviceStatus(Device_status& status) override;
96 bool getDeviceInfo(std::string& device_info) override;
97 bool getDistanceRange(double& min, double& max) override;
98 bool getScanLimits(double& min, double& max) override;
99 bool getHorizontalResolution(double& step) override;
100 bool getScanRate(double& rate) override;
101
102private:
103 //utility methods called internally by Lidar2DDeviceBase
104 virtual bool checkSkipAngle(const double& angle, double& distance);
105};
106
107} // namespace yarp::dev
108
109#endif
A generic interface for planar laser range finders.
The Lidar2DDeviceBase class.
virtual bool acquireDataFromHW()=0
This method should be implemented by the user, and contain the logic to grab data from the hardware.
std::vector< Range_t > m_range_skip_vector
yarp::dev::IRangefinder2D::Device_status m_device_status
A base class for nested structures that can be searched.
Definition Searchable.h:31
An abstraction for a time stamp and/or sequence number.
Definition Stamp.h:21
For streams capable of holding different kinds of content, check what they actually have.
#define YARP_dev_API
Definition api.h:18