YARP
Yet Another Robot Platform
yarp::dev::Lidar2DDeviceBase Class Referenceabstract

The Lidar2DDeviceBase class. More...

#include <yarp/dev/Lidar2DDeviceBase.h>

+ Inheritance diagram for yarp::dev::Lidar2DDeviceBase:

Public Member Functions

bool parseConfiguration (yarp::os::Searchable &config)
 
 Lidar2DDeviceBase ()
 
bool getRawData (yarp::sig::Vector &data, double *timestamp=nullptr) override
 Get the device measurements. More...
 
bool getLaserMeasurement (std::vector< LaserMeasurementData > &data, double *timestamp=nullptr) override
 Get the device measurements. More...
 
bool getDeviceStatus (Device_status &status) override
 get the device status More...
 
bool getDeviceInfo (std::string &device_info) override
 get the device hardware characteristics More...
 
bool getDistanceRange (double &min, double &max) override
 get the device detection range More...
 
bool getScanLimits (double &min, double &max) override
 get the scan angular range. More...
 
bool getHorizontalResolution (double &step) override
 get the angular step between two measurements. More...
 
bool getScanRate (double &rate) override
 get the scan rate (scans per seconds) More...
 
- Public Member Functions inherited from yarp::dev::IRangefinder2D
virtual ~IRangefinder2D ()
 
virtual bool getLaserMeasurement (std::vector< LaserMeasurementData > &data, double *timestamp=nullptr)=0
 Get the device measurements. More...
 
virtual bool getRawData (yarp::sig::Vector &data, double *timestamp=nullptr)=0
 Get the device measurements. More...
 
virtual bool getDeviceStatus (Device_status &status)=0
 get the device status More...
 
virtual bool getDistanceRange (double &min, double &max)=0
 get the device detection range More...
 
virtual bool setDistanceRange (double min, double max)=0
 set the device detection range. More...
 
virtual bool getScanLimits (double &min, double &max)=0
 get the scan angular range. More...
 
virtual bool setScanLimits (double min, double max)=0
 set the scan angular range. More...
 
virtual bool getHorizontalResolution (double &step)=0
 get the angular step between two measurements. More...
 
virtual bool setHorizontalResolution (double step)=0
 get the angular step between two measurements (if available) More...
 
virtual bool getScanRate (double &rate)=0
 get the scan rate (scans per seconds) More...
 
virtual bool setScanRate (double rate)=0
 set the scan rate (scans per seconds) More...
 
virtual bool getDeviceInfo (std::string &device_info)=0
 get the device hardware characteristics More...
 

Protected Member Functions

virtual bool updateLidarData ()
 This utility method calls in sequence: grabDataFromHW(), updateTimestamp and applyLimitsOnLaserData(). More...
 
virtual bool updateTimestamp ()
 By default, it automatically updates the internal timestamp with the yarp time. More...
 
virtual bool applyLimitsOnLaserData ()
 Apply the limits on the internally stored lidar measurements. More...
 
virtual bool acquireDataFromHW ()=0
 This method should be implemented by the user, and contain the logic to grab data from the hardware. More...
 

Protected Attributes

yarp::sig::Vector m_laser_data
 
yarp::os::Stamp m_timestamp
 
yarp::dev::IRangefinder2D::Device_status m_device_status
 
std::mutex m_mutex
 
std::string m_info
 
double m_scan_rate
 
size_t m_sensorsNum
 
double m_min_angle
 
double m_max_angle
 
double m_min_distance
 
double m_max_distance
 
double m_resolution
 
bool m_clip_max_enable
 
bool m_clip_min_enable
 
bool m_do_not_clip_and_allow_infinity_enable
 
std::vector< Range_tm_range_skip_vector
 

Additional Inherited Members

- Public Types inherited from yarp::dev::IRangefinder2D
enum  Device_status {
  DEVICE_OK_STANBY = 0 ,
  DEVICE_OK_IN_USE = 1 ,
  DEVICE_GENERAL_ERROR = 2 ,
  DEVICE_TIMEOUT = 3
}
 

Detailed Description

The Lidar2DDeviceBase class.

This class has been designed to uniform the parsing of lidar yarp devices.

Definition at line 29 of file Lidar2DDeviceBase.h.

Constructor & Destructor Documentation

◆ Lidar2DDeviceBase()

Lidar2DDeviceBase::Lidar2DDeviceBase ( )

Definition at line 100 of file Lidar2DDeviceBase.cpp.

Member Function Documentation

◆ acquireDataFromHW()

virtual bool yarp::dev::Lidar2DDeviceBase::acquireDataFromHW ( )
protectedpure virtual

This method should be implemented by the user, and contain the logic to grab data from the hardware.

Returns
true/false if the method is successful.

Implemented in RpLidar2, RpLidar3, RpLidar4, FakeLaser, LaserFromDepth, LaserFromExternalPort, LaserFromPointCloud, and LaserFromRosTopic.

◆ applyLimitsOnLaserData()

bool Lidar2DDeviceBase::applyLimitsOnLaserData ( )
protectedvirtual

Apply the limits on the internally stored lidar measurements.

Returns
true/false if the method is successful.

Definition at line 231 of file Lidar2DDeviceBase.cpp.

◆ getDeviceInfo()

bool Lidar2DDeviceBase::getDeviceInfo ( std::string &  device_info)
overridevirtual

get the device hardware characteristics

Parameters
device_infostring containing the device infos
Returns
true/false.

Implements yarp::dev::IRangefinder2D.

Definition at line 71 of file Lidar2DDeviceBase.cpp.

◆ getDeviceStatus()

bool Lidar2DDeviceBase::getDeviceStatus ( Device_status status)
overridevirtual

get the device status

Parameters
statusthe device status
Returns
true/false.

Implements yarp::dev::IRangefinder2D.

Definition at line 46 of file Lidar2DDeviceBase.cpp.

◆ getDistanceRange()

bool Lidar2DDeviceBase::getDistanceRange ( double &  min,
double &  max 
)
overridevirtual

get the device detection range

Parameters
minthe minimum detection distance
maxthe maximum detection distance
Returns
true/false.

Implements yarp::dev::IRangefinder2D.

Definition at line 31 of file Lidar2DDeviceBase.cpp.

◆ getHorizontalResolution()

bool Lidar2DDeviceBase::getHorizontalResolution ( double &  step)
overridevirtual

get the angular step between two measurements.

Parameters
stepthe angular step between two measurements
Returns
true/false.

Implements yarp::dev::IRangefinder2D.

Definition at line 39 of file Lidar2DDeviceBase.cpp.

◆ getLaserMeasurement()

bool Lidar2DDeviceBase::getLaserMeasurement ( std::vector< LaserMeasurementData > &  data,
double *  timestamp = nullptr 
)
overridevirtual

Get the device measurements.

Parameters
dataa vector containing the measurement data, expressed in Cartesian/polar format
timestampthe timestamp of the retrieved data.
Returns
true/false

Implements yarp::dev::IRangefinder2D.

Definition at line 78 of file Lidar2DDeviceBase.cpp.

◆ getRawData()

bool Lidar2DDeviceBase::getRawData ( yarp::sig::Vector data,
double *  timestamp = nullptr 
)
overridevirtual

Get the device measurements.

Parameters
rangesthe vector containing the raw measurement data, as acquired by the device.
timestampthe timestamp of the retrieved data.
Returns
true/false.

Implements yarp::dev::IRangefinder2D.

Definition at line 53 of file Lidar2DDeviceBase.cpp.

◆ getScanLimits()

bool Lidar2DDeviceBase::getScanLimits ( double &  min,
double &  max 
)
overridevirtual

get the scan angular range.

Parameters
minstart angle of the scan
maxend angle of the scan
Returns
true/false.

Implements yarp::dev::IRangefinder2D.

Definition at line 23 of file Lidar2DDeviceBase.cpp.

◆ getScanRate()

bool Lidar2DDeviceBase::getScanRate ( double &  rate)
overridevirtual

get the scan rate (scans per seconds)

Parameters
ratethe scan rate
Returns
true/false.

Implements yarp::dev::IRangefinder2D.

Definition at line 64 of file Lidar2DDeviceBase.cpp.

◆ parseConfiguration()

bool Lidar2DDeviceBase::parseConfiguration ( yarp::os::Searchable config)

Definition at line 114 of file Lidar2DDeviceBase.cpp.

◆ updateLidarData()

bool Lidar2DDeviceBase::updateLidarData ( )
protectedvirtual

This utility method calls in sequence: grabDataFromHW(), updateTimestamp and applyLimitsOnLaserData().

It is recommended that the device driver implementation calls this method to perform the aforementioned three operations.

Returns
true/false if the methods called internally are all successful

Definition at line 273 of file Lidar2DDeviceBase.cpp.

◆ updateTimestamp()

bool Lidar2DDeviceBase::updateTimestamp ( )
protectedvirtual

By default, it automatically updates the internal timestamp with the yarp time.

It can be redefined by the user if the timestamp source is for example the hardware device.

Returns
true/false if the update is successful.

Definition at line 288 of file Lidar2DDeviceBase.cpp.

Member Data Documentation

◆ m_clip_max_enable

bool yarp::dev::Lidar2DDeviceBase::m_clip_max_enable
protected

Definition at line 48 of file Lidar2DDeviceBase.h.

◆ m_clip_min_enable

bool yarp::dev::Lidar2DDeviceBase::m_clip_min_enable
protected

Definition at line 49 of file Lidar2DDeviceBase.h.

◆ m_device_status

yarp::dev::IRangefinder2D::Device_status yarp::dev::Lidar2DDeviceBase::m_device_status
protected

Definition at line 35 of file Lidar2DDeviceBase.h.

◆ m_do_not_clip_and_allow_infinity_enable

bool yarp::dev::Lidar2DDeviceBase::m_do_not_clip_and_allow_infinity_enable
protected

Definition at line 50 of file Lidar2DDeviceBase.h.

◆ m_info

std::string yarp::dev::Lidar2DDeviceBase::m_info
protected

Definition at line 40 of file Lidar2DDeviceBase.h.

◆ m_laser_data

yarp::sig::Vector yarp::dev::Lidar2DDeviceBase::m_laser_data
protected

Definition at line 33 of file Lidar2DDeviceBase.h.

◆ m_max_angle

double yarp::dev::Lidar2DDeviceBase::m_max_angle
protected

Definition at line 44 of file Lidar2DDeviceBase.h.

◆ m_max_distance

double yarp::dev::Lidar2DDeviceBase::m_max_distance
protected

Definition at line 46 of file Lidar2DDeviceBase.h.

◆ m_min_angle

double yarp::dev::Lidar2DDeviceBase::m_min_angle
protected

Definition at line 43 of file Lidar2DDeviceBase.h.

◆ m_min_distance

double yarp::dev::Lidar2DDeviceBase::m_min_distance
protected

Definition at line 45 of file Lidar2DDeviceBase.h.

◆ m_mutex

std::mutex yarp::dev::Lidar2DDeviceBase::m_mutex
protected

Definition at line 36 of file Lidar2DDeviceBase.h.

◆ m_range_skip_vector

std::vector<Range_t> yarp::dev::Lidar2DDeviceBase::m_range_skip_vector
protected

Definition at line 51 of file Lidar2DDeviceBase.h.

◆ m_resolution

double yarp::dev::Lidar2DDeviceBase::m_resolution
protected

Definition at line 47 of file Lidar2DDeviceBase.h.

◆ m_scan_rate

double yarp::dev::Lidar2DDeviceBase::m_scan_rate
protected

Definition at line 41 of file Lidar2DDeviceBase.h.

◆ m_sensorsNum

size_t yarp::dev::Lidar2DDeviceBase::m_sensorsNum
protected

Definition at line 42 of file Lidar2DDeviceBase.h.

◆ m_timestamp

yarp::os::Stamp yarp::dev::Lidar2DDeviceBase::m_timestamp
protected

Definition at line 34 of file Lidar2DDeviceBase.h.


The documentation for this class was generated from the following files: