YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Rangefinder2D_nwc_yarp.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6#ifndef YARP_DEV_RANGEFINDER2D_NWC_YARP_H
7#define YARP_DEV_RANGEFINDER2D_NWC_YARP_H
8
9
10#include <yarp/os/Network.h>
11#include <yarp/os/Stamp.h>
17#include <yarp/sig/Vector.h>
18#include <yarp/os/Time.h>
19#include <yarp/dev/PolyDriver.h>
20
21#include <mutex>
22
23#include "IRangefinder2DMsgs.h"
25
27 public yarp::os::BufferedPort<yarp::sig::LaserScan2D>
28{
30 std::mutex mutex;
31 yarp::os::Stamp lastStamp;
32 double deltaT;
33 double deltaTMax;
34 double deltaTMin;
35 double prev;
36 double now;
37
38 int state;
39 int count;
40
41public:
42
43 inline void resetStat();
44
46
48 void onRead(yarp::sig::LaserScan2D& v) override;
49
51
52 inline int getIterations();
53
54 // time is in ms
55 void getEstFrequency(int &ite, double &av, double &min, double &max);
56
58
59};
60
73{
74protected:
77 std::mutex m_mutex;
78
81 std::string m_deviceId;
82
83 double m_scan_angle_min = std::nan("1");
84 double m_scan_angle_max = std::nan("1");
85 std::string m_laser_frame_name;
86 std::string m_robot_frame_name;
87
88public:
89 /* DeviceDriver methods */
90 bool open(yarp::os::Searchable& config) override;
91 bool close() override;
92
93 /* IRangefinder2D methods */
94 yarp::dev::ReturnValue getLaserMeasurement(std::vector<yarp::sig::LaserMeasurementData> &data, double* timestamp = nullptr) override;
95 yarp::dev::ReturnValue getRawData(yarp::sig::Vector &data, double* timestamp = nullptr) override;
97 yarp::dev::ReturnValue getDistanceRange(double& min, double& max) override;
98 yarp::dev::ReturnValue setDistanceRange(double min, double max) override;
99 yarp::dev::ReturnValue getScanLimits(double& min, double& max) override;
100 yarp::dev::ReturnValue setScanLimits(double min, double max) override;
101 yarp::dev::ReturnValue getHorizontalResolution(double& step) override;
103 yarp::dev::ReturnValue getScanRate(double& rate) override;
104 yarp::dev::ReturnValue setScanRate(double rate) override;
105 yarp::dev::ReturnValue getDeviceInfo(std::string &device_info) override;
106};
107
108#endif // YARP_DEV_RANGEFINDER2D_NWC_YARP_H
define control board standard interfaces
contains the definition of a Vector type
void getEstFrequency(int &ite, double &av, double &min, double &max)
int getLast(yarp::sig::LaserScan2D &data, yarp::os::Stamp &stmp)
void onRead(yarp::sig::LaserScan2D &v) override
yarp::dev::IRangefinder2D::Device_status getStatus()
This class is the parameters parser for class Rangefinder2D_nwc_yarp.
Rangefinder2D_nwc_yarp: The client side of any ILaserRangefinder2D capable device.
yarp::dev::ReturnValue getScanRate(double &rate) override
get the scan rate (scans per seconds)
yarp::dev::ReturnValue getDeviceInfo(std::string &device_info) override
get the device hardware characteristics
bool close() override
Close the DeviceDriver.
yarp::dev::ReturnValue setScanRate(double rate) override
set the scan rate (scans per seconds)
yarp::dev::ReturnValue getLaserMeasurement(std::vector< yarp::sig::LaserMeasurementData > &data, double *timestamp=nullptr) override
Get the device measurements.
yarp::dev::ReturnValue getDistanceRange(double &min, double &max) override
get the device detection range
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
yarp::dev::ReturnValue getHorizontalResolution(double &step) override
get the angular step between two measurements.
yarp::dev::ReturnValue setHorizontalResolution(double step) override
get the angular step between two measurements (if available)
yarp::dev::ReturnValue getScanLimits(double &min, double &max) override
get the scan angular range.
yarp::dev::ReturnValue getDeviceStatus(Device_status &status) override
get the device status
yarp::dev::ReturnValue setScanLimits(double min, double max) override
set the scan angular range.
yarp::dev::ReturnValue setDistanceRange(double min, double max) override
set the device detection range.
yarp::dev::ReturnValue getRawData(yarp::sig::Vector &data, double *timestamp=nullptr) override
Get the device measurements.
Rangefinder2D_InputPortProcessor m_inputPort
Interface implemented by all device drivers.
A generic interface for planar laser range finders.
A mini-server for performing network communication in the background.
A mini-server for network communication.
Definition Port.h:46
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