6 #define _USE_MATH_DEFINES
24 #define DEG2RAD M_PI/180.0
34 m_info =
"LaserFromDepth device";
35 m_device_status = DEVICE_OK_STANBY;
44 if (this->parseConfiguration(config) ==
false)
51 if(!config.check(
"RGBD_SENSOR_CLIENT"))
56 prop.
fromString(config.findGroup(
"RGBD_SENSOR_CLIENT").toString());
57 prop.
put(
"device",
"RGBDSensorClient");
60 if (!driver.isValid())
72 m_depth_width = iRGBD->getDepthWidth();
73 m_depth_height = iRGBD->getDepthHeight();
76 iRGBD->getDepthFOV(hfov, vfov);
77 m_sensorsNum = m_depth_width;
78 m_resolution = hfov / m_depth_width;
79 m_laser_data.resize(m_sensorsNum, 0.0);
80 m_max_angle = +hfov / 2;
81 m_min_angle = -hfov / 2;
82 PeriodicThread::start();
90 PeriodicThread::stop();
102 std::lock_guard<std::mutex> guard(
m_mutex);
110 std::lock_guard<std::mutex> guard(
m_mutex);
117 std::lock_guard<std::mutex> guard(
m_mutex);
124 std::lock_guard<std::mutex> guard(
m_mutex);
161 double angle, distance, angleShift;
169 distance = *(pointer + elem);
170 distance /= cos((angle - angleShift) *
DEG2RAD);
laserFromDepth: Documentation to be added
void run() override
Loop function.
bool acquireDataFromHW() override final
This method should be implemented by the user, and contain the logic to grab data from the hardware.
bool close() override
Close the DeviceDriver.
bool setScanLimits(double min, double max) override
set the scan angular range.
bool setScanRate(double rate) override
set the scan rate (scans per seconds)
void threadRelease() override
Release method.
bool threadInit() override
Initialization method.
bool setDistanceRange(double min, double max) override
set the device detection range.
bool setHorizontalResolution(double step) override
get the angular step between two measurments (if available)
yarp::sig::ImageOf< float > m_depth_image
virtual bool getDepthImage(yarp::sig::ImageOf< yarp::sig::PixelFloat > &depthImage, yarp::os::Stamp *timeStamp=nullptr)=0
Get the depth frame from the device.
virtual bool updateLidarData()
This utility method calls in sequence: grabDataFromHW(), updateTimestamp and applyLimitsOnLaserData()...
yarp::sig::Vector m_laser_data
bool close() override
Close the DeviceDriver.
bool isValid() const
Check if device is valid.
A class for storing options and configuration information.
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
A base class for nested structures that can be searched.
unsigned char * getPixelAddress(size_t x, size_t y) const
Get address of a pixel in memory.
size_t width() const
Gets width of image in pixels.
unsigned char * getRawImage() const
Access to the internal image buffer.
size_t height() const
Gets height of image in pixels.
const yarp::os::LogComponent & LASER_FROM_DEPTH()
#define yCInfo(component,...)
#define yCError(component,...)
#define yCWarning(component,...)
#define yCDebug(component,...)
#define YARP_LOG_COMPONENT(name,...)
double now()
Return the current time in seconds, relative to an arbitrary starting point.
The main, catch-all namespace for YARP.