26 yCError(FRAMETRANSFORMSETNWSYARP,
"Error! YARP Network is not initialized");
32 bool default_config =
true;
33 if(config.
check(
"default-config")) {
34 default_config = config.
find(
"default-config").
asString() ==
"true";
37 if (config.
check(
"nws_thrift_port_prefix")){
38 prefix = config.
find(
"nws_thrift_port_prefix").
asString() + (default_config ? m_defaultConfigPrefix :
"");
39 if(prefix[0] !=
'/') {prefix =
"/"+prefix;}
40 m_thriftPortName = prefix +
"/" + m_deviceName +
"/thrift";
43 prefix = default_config ? m_defaultConfigPrefix :
"";
44 m_thriftPortName = prefix +
"/" + m_deviceName +
"/thrift";
45 yCWarning(FRAMETRANSFORMSETNWSYARP) <<
"no nws_thrift_port_prefix param found. The resulting port name will be: " << m_thriftPortName;
48 if(!m_thriftPort.open(m_thriftPortName))
50 yCError(FRAMETRANSFORMSETNWSYARP,
"Could not open \"%s\" port",m_thriftPortName.c_str());
53 if(!this->
yarp().attachAsServer(m_thriftPort))
55 yCError(FRAMETRANSFORMSETNWSYARP,
"Error! Cannot attach the port as a server");
64 if(m_thriftPort.isOpen())
73 std::lock_guard <std::mutex> lg(m_pd_mutex);
80 std::lock_guard <std::mutex> lg(m_pd_mutex);
82 if(!m_iSetIf->setTransform(transform))
84 yCError(FRAMETRANSFORMSETNWSYARP,
"Unable to set transform");
93 std::lock_guard <std::mutex> lg(m_pd_mutex);
94 if(!m_iSetIf->setTransforms(transforms))
96 yCError(FRAMETRANSFORMSETNWSYARP,
"Unable to set transformations");
105 std::lock_guard <std::mutex> lg(m_pd_mutex);
106 if (!m_iSetIf->deleteTransform(src,dst))
108 yCError(FRAMETRANSFORMSETNWSYARP,
"Unable to delete transforms");
117 std::lock_guard <std::mutex> lg(m_pd_mutex);
118 if (!m_iSetIf->clearAll())
120 yCError(FRAMETRANSFORMSETNWSYARP,
"Unable to clear all transforms");
130 std::lock_guard <std::mutex> lg(m_pd_mutex);
131 m_pDriver = device2attach;
133 if(!m_pDriver->isValid() ||
134 (!m_pDriver->view(m_iSetIf) || m_iSetIf ==
nullptr) ||
135 (!m_pDriver->view(m_iUtilsIf) || m_iUtilsIf ==
nullptr))
137 yCError(FRAMETRANSFORMSETNWSYARP,
"Attach failed");
A container for a device driver.
static bool checkNetwork()
Check if the YARP Network is up and running.
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 std::string asString() const
Get string value.
#define yCError(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.
The main, catch-all namespace for YARP.