YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
laserHokuyo.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 LASERHOKUYO_THREAD_H
7#define LASERHOKUYO_THREAD_H
8
9//#include <cstdio>
10#include <string>
11
13#include <mutex>
16#include <yarp/dev/PolyDriver.h>
18#include <yarp/sig/Vector.h>
19
20using namespace yarp::os;
21using namespace yarp::dev;
22
29{
30protected:
33
34 std::mutex mutex;
35
36 int cardId;
37 double period;
41 double min_angle;
42 double max_angle;
45 std::string info;
47
59
61
63 {
64 std::string MODL;
65 int DMIN;
66 int DMAX;
67 int ARES;
68 int AMIN;
69 int AMAX;
70 int AFRT;
71 int SCAN;
73
75
76public:
93
94
96 {
97 }
98
99 bool open(yarp::os::Searchable& config) override;
100 bool close() override;
101 bool threadInit() override;
102 void threadRelease() override;
103 void run() override;
104
105public:
106 //IRangefinder2D interface
107 yarp::dev::ReturnValue getRawData(yarp::sig::Vector &data, double* timestamp) override;
108 yarp::dev::ReturnValue getLaserMeasurement(std::vector<yarp::sig::LaserMeasurementData> &data, double* timestamp) override;
110 yarp::dev::ReturnValue getDeviceInfo (std::string &device_info) override;
111 yarp::dev::ReturnValue getDistanceRange (double& min, double& max) override;
112 yarp::dev::ReturnValue setDistanceRange (double min, double max) override;
113 yarp::dev::ReturnValue getScanLimits (double& min, double& max) override;
114 yarp::dev::ReturnValue setScanLimits (double min, double max) override;
117 yarp::dev::ReturnValue getScanRate (double& rate) override;
118 yarp::dev::ReturnValue setScanRate (double rate) override;
119
120private:
121 //laser methods
122 int calculateCheckSum(const char* buffer, int size, char actual_sum);
123 long decodeDataValue(const char* data, int data_byte);
124 int readData(const Laser_mode_type laser_mode, const char* text_data, const int lext_data_len, int current_line, yarp::sig::Vector& values);
125};
126
127#endif
define control board standard interfaces
contains the definition of a Vector type
laserHokuyo: Documentation to be added
Definition laserHokuyo.h:29
Device_status device_status
Definition laserHokuyo.h:46
yarp::dev::ReturnValue getDeviceStatus(Device_status &status) override
get the device status
yarp::dev::ReturnValue getLaserMeasurement(std::vector< yarp::sig::LaserMeasurementData > &data, double *timestamp) override
Get the device measurements.
std::string info
Definition laserHokuyo.h:45
PolyDriver driver
Definition laserHokuyo.h:31
double period
Definition laserHokuyo.h:37
int internal_status
Definition laserHokuyo.h:44
yarp::dev::ReturnValue setScanRate(double rate) override
set the scan rate (scans per seconds)
@ HOKUYO_STATUS_ERROR_INVALID_CHECKSUM
Definition laserHokuyo.h:55
@ HOKUYO_STATUS_NOT_READY
Definition laserHokuyo.h:57
@ HOKUYO_STATUS_ERROR_BUSY
Definition laserHokuyo.h:53
@ HOKUYO_STATUS_ERROR_INVALID_COMMAND
Definition laserHokuyo.h:54
@ HOKUYO_STATUS_ERROR_NOTHING_RECEIVED
Definition laserHokuyo.h:56
@ HOKUYO_STATUS_ACQUISITION_COMPLETE
Definition laserHokuyo.h:51
yarp::dev::ReturnValue setHorizontalResolution(double step) override
get the angular step between two measurements (if available)
ISerialDevice * pSerial
Definition laserHokuyo.h:32
yarp::dev::ReturnValue setScanLimits(double min, double max) override
set the scan angular range.
void run() override
Loop function.
std::mutex mutex
Definition laserHokuyo.h:34
yarp::dev::ReturnValue getRawData(yarp::sig::Vector &data, double *timestamp) override
Get the device measurements.
yarp::dev::ReturnValue getScanRate(double &rate) override
get the scan rate (scans per seconds)
laserHokuyo(double period=0.02)
Definition laserHokuyo.h:77
yarp::dev::ReturnValue getScanLimits(double &min, double &max) override
get the scan angular range.
void threadRelease() override
Release method.
int start_position
Definition laserHokuyo.h:39
yarp::sig::Vector laser_data
Definition laserHokuyo.h:74
double min_angle
Definition laserHokuyo.h:41
struct laserHokuyo::sensor_property_struct sensor_properties
bool threadInit() override
Initialization method.
bool close() override
Close the DeviceDriver.
yarp::dev::ReturnValue getDistanceRange(double &min, double &max) override
get the device detection range
yarp::dev::ReturnValue setDistanceRange(double min, double max) override
set the device detection range.
double max_angle
Definition laserHokuyo.h:42
yarp::dev::ReturnValue getHorizontalResolution(double &step) override
get the angular step between two measurements.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
Laser_mode_type laser_mode
Definition laserHokuyo.h:60
yarp::dev::ReturnValue getDeviceInfo(std::string &device_info) override
get the device hardware characteristics
Interface implemented by all device drivers.
A generic interface for planar laser range finders.
A generic interface to serial port devices.
A container for a device driver.
Definition PolyDriver.h:23
A mini-server for performing network communication in the background.
An abstraction for a periodic thread.
void step()
Call this to "step" the thread rather than starting it.
A base class for nested structures that can be searched.
Definition Searchable.h:31
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.