6#define _USE_MATH_DEFINES
24#define DEG2RAD M_PI/180.0
27#define DEFAULT_THREAD_PERIOD 20
59 double tmpDT=now-prev;
61 if (
tmpDT > deltaTMax) {
64 if (
tmpDT < deltaTMin) {
221 if (timestamp !=
nullptr)
239 return ReturnValue::return_code::return_value_error_method_failed;
242 for (
size_t i = 0; i < size; i++)
245 double value = scan.
scans[i];
246 data[i].set_polar(value,
angle);
248 if (timestamp!=
nullptr)
352 std::lock_guard <std::mutex>
lg(
m_mutex);
366 device_info =
ret.device_info;
virtual return_getScanRate getScanRate_RPC()
virtual return_getHorizontalResolution getHorizontalResolution_RPC()
virtual yarp::dev::ReturnValue setScanRate_RPC(const double rate)
virtual return_getScanLimits getScanLimits_RPC()
virtual return_getDeviceInfo getDeviceInfo_RPC()
virtual yarp::dev::ReturnValue setScanLimits_RPC(const double min, const double max)
virtual return_getDistanceRange getDistanceRange_RPC()
virtual yarp::dev::ReturnValue setDistanceRange_RPC(const double min, const double max)
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
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
A mini-server for performing network communication in the background.
bool getEnvelope(PortReader &envelope) override
void close() override
Stop port activity.
void disableCallback() override
Remove a callback set up with useCallback()
BufferedPort()
Constructor.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
void useCallback(TypedReaderCallback< T > &callback) override
Set an object whose onRead method will be called when data is available.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
A base class for nested structures that can be searched.
An abstraction for a time stamp and/or sequence number.
double getTime() const
Get the time stamp.
bool isValid() const
Check if this Stamp is valid.
static double nowSystem()
bool attachAsClient(yarp::os::UnbufferedContactable &port)
Tag this WireLink as a client, sending data via the specified port.
yarp::os::WireLink & yarp()
Get YARP state associated with this object.
yarp::sig::Vector scans
the scan data, measured in [m].
std::int32_t status
the status of the device.
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.