6#define _USE_MATH_DEFINES
27#define DEG2RAD M_PI/180.0
31#define RAD2DEG 180/M_PI
76 m_contains_data=
false;
93 m_lastScan.
scans[
i] = b.ranges[
i];
97 m_port_mutex.unlock();
104 while (m_contains_data==
false)
107 if (counter++ > 100) {
yDebug() <<
"Waiting for incoming data..."; counter=0;}
113 m_port_mutex.unlock();
121 m_info =
"LaserFromRosTopic device";
208 if (config.
check(
"TRANSFORMS") && config.
check(
"TRANSFORM_CLIENT"))
246 tcprop.put(
"device",
"transformClient");
276 yInfo(
"LaserFromRosTopic: Sensor ready");
347#ifdef DO_NOTHING_DEBUG
359 if (
distance == std::numeric_limits<double>::infinity())
440 if (
m_iTc ==
nullptr)
double constrainAngle(double x)
const yarp::os::LogComponent & LASER_FROM_ROS_TOPIC()
void calculate(yarp::sig::LaserScan2D scan, yarp::sig::Matrix m)
bool close() override
Close the DeviceDriver.
std::vector< InputPortProcessor > m_input_ports
bool setDistanceRange(double min, double max) override
set the device detection range.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
std::vector< yarp::os::Stamp > m_last_stamp
std::vector< std::string > m_port_names
bool setHorizontalResolution(double step) override
get the angular step between two measurements (if available)
void run() override
Loop function.
yarp::os::Node * m_ros_node
yarp::dev::PolyDriver m_tc_driver
bool setScanLimits(double min, double max) override
set the scan angular range.
bool threadInit() override
Initialization method.
yarp::sig::Vector m_empty_laser_data
bool acquireDataFromHW() override final
This method should be implemented by the user, and contain the logic to grab data from the hardware.
std::vector< yarp::sig::LaserScan2D > m_last_scan_data
void threadRelease() override
Release method.
std::vector< std::string > m_src_frame_id
yarp::dev::IFrameTransform * m_iTc
std::string m_dst_frame_id
bool m_option_override_limits
bool setScanRate(double rate) override
set the scan rate (scans per seconds)
bool view(T *&x)
Get an interface to the device driver.
virtual bool updateLidarData()
This utility method calls in sequence: grabDataFromHW(), updateTimestamp and applyLimitsOnLaserData()...
bool parseConfiguration(yarp::os::Searchable &config)
yarp::sig::Vector m_laser_data
bool isValid() const
Check if device is valid.
bool open(const std::string &txt)
Construct and configure a device by its common name.
A simple collection of objects that can be described and transmitted in a portable way.
A mini-server for performing network communication in the background.
void close() override
Stop port activity.
void useCallback(TypedReaderCallback< T > &callback) override
Set an object whose onRead method will be called when data is available.
bool start()
Call this to start the thread.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
A class for storing options and configuration information.
A base class for nested structures that can be searched.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
virtual Bottle & findGroup(const std::string &key) const =0
Gets a list corresponding to a given keyword.
An abstraction for a time stamp and/or sequence number.
double angle_min
first angle of the scan [deg]
yarp::sig::Vector scans
the scan data, measured in [m].
double angle_max
last angle of the scan [deg]
double range_max
the maximum distance of the scan [m]
double range_min
the minimum distance of the scan [m]
void resize(size_t size) override
Resize the vector.
double constrainAngle(double x)
#define yCInfo(component,...)
#define yCError(component,...)
#define yCWarning(component,...)
#define yCDebug(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
yarp::sig::Vector dcm2rpy(const yarp::sig::Matrix &R)
Converts a dcm (direction cosine matrix) rotation matrix to roll-pitch-yaw angles (defined in Math....
double now()
Return the current time in seconds, relative to an arbitrary starting point.
void delay(double seconds)
Wait for a certain number of seconds.
An interface to the operating system, including Port based communication.