31 yCError(FRAMETRANSFORGETNWCROS,
"Error! YARP Network is not initialized");
35 bool okGeneral = config.
check(
"GENERAL");
39 if (general_config.
check(
"period"))
44 if (general_config.
check(
"refresh_interval")) {m_refreshInterval = general_config.
find(
"refresh_interval").
asFloat64();}
46 m_ftContainer.
m_timeout = m_refreshInterval;
49 if (config.
check(
"ROS"))
51 yCInfo(FRAMETRANSFORGETNWCROS,
"Configuring ROS params");
53 if (ROS_config.
check(
"ft_topic")) {
56 if (ROS_config.
check(
"ft_topic_static")) {
57 m_topic_static = ROS_config.
find(
"ft_topic_static").
asString();
59 if (ROS_config.
check(
"ft_node")) {
64 if (m_rosNode ==
nullptr)
68 if (!m_rosSubscriberPort_tf_timed.
topic(m_topic))
70 yCError(FRAMETRANSFORGETNWCROS) <<
"Unable to publish data on " << m_topic <<
" topic, check your yarp-ROS network configuration";
74 if (!m_rosSubscriberPort_tf_static.
topic(m_topic_static))
76 yCError(FRAMETRANSFORGETNWCROS) <<
"Unable to publish data on " << m_topic_static <<
" topic, check your yarp-ROS network configuration";
79 m_rosSubscriberPort_tf_static.
setStrict();
84 yCWarning(FRAMETRANSFORGETNWCROS) <<
"ROS Group not configured";
95 yCTrace(FRAMETRANSFORGETNWCROS,
"Close");
96 if (PeriodicThread::isRunning())
98 PeriodicThread::stop();
100 m_rosSubscriberPort_tf_timed.
close();
101 m_rosSubscriberPort_tf_static.
close();
108 std::lock_guard <std::mutex> lg(m_trf_mutex);
111 yCError(FRAMETRANSFORGETNWCROS,
"Unable to remove expired transforms");
119 std::lock_guard<std::mutex> lock(m_trf_mutex);
122 yCError(FRAMETRANSFORGETNWCROS,
"Unable to remove expired transforms");
127 yCError(FRAMETRANSFORGETNWCROS,
"Unable to retrieve transforms");
138 sec_part = (double)rosTime.
sec;
139 nsec_part = ((
double)rosTime.
nsec)/1000000000.0;
140 yarpTime = sec_part+nsec_part;
165 rosInData_timed = m_rosSubscriberPort_tf_timed.
read(
false);
166 if (rosInData_timed !=
nullptr)
168 std::vector <yarp::rosmsg::geometry_msgs::TransformStamped> tfs = rosInData_timed->
transforms;
176 }
while (rosInData_timed !=
nullptr);
180 rosInData_static = m_rosSubscriberPort_tf_static.
read(
false);
181 if (rosInData_static !=
nullptr)
183 std::vector <yarp::rosmsg::geometry_msgs::TransformStamped> tfs = rosInData_static->
transforms;
191 }
while (rosInData_static !=
nullptr);
A simple collection of objects that can be described and transmitted in a portable way.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
static bool checkNetwork()
Check if the YARP Network is up and running.
An abstraction for a periodic thread.
bool setPeriod(double period)
Set the (new) period of the thread.
bool start()
Call this to start the thread.
A base class for nested structures that can be searched.
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
virtual Bottle & findGroup(const std::string &key) const =0
Gets a list corresponding to a given keyword.
void close() override
Stop port activity.
T * read(bool shouldWait=true)
Read a message from the port.
void setStrict(bool strict=true)
bool topic(const std::string &name)
Set topic to subscribe to.
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
virtual std::string asString() const
Get string value.
std::vector< yarp::rosmsg::geometry_msgs::TransformStamped > transforms
#define yCInfo(component,...)
#define yCError(component,...)
#define yCTrace(component,...)
#define yCWarning(component,...)
#define YARP_LOG_COMPONENT(name,...)
An interface for the device drivers.
An interface to the operating system, including Port based communication.