27 yCError(FRAMETRANSFORMSETNWCYARP,
"Error! YARP Network is not initialized");
32 bool default_config =
true;
33 if(config.
check(
"default-client")) {
34 default_config = config.
find(
"default-client").
asString() ==
"true";
36 bool default_server =
true;
37 if(config.
check(
"default-server")) {
38 default_server = config.
find(
"default-server").
asString() ==
"true";
41 if (config.
check(
"nwc_thrift_port_prefix")){
42 prefix = config.
find(
"nwc_thrift_port_prefix").
asString() + (default_config ? m_defaultConfigPrefix :
"");
43 if(prefix[0] !=
'/') {prefix =
"/"+prefix;}
44 m_thriftPortName = prefix +
"/" + m_deviceName +
"/thrift";
47 prefix = default_config ? m_defaultConfigPrefix :
"";
48 m_thriftPortName = prefix +
"/" + m_deviceName +
"/thrift";
49 yCWarning(FRAMETRANSFORMSETNWCYARP) <<
"no nwc_thrift_port_prefix param found. The resulting port name will be: " << m_thriftPortName;
53 if (config.
check(
"nws_thrift_port_prefix")){
54 prefix = config.
find(
"nws_thrift_port_prefix").
asString() + (default_server ? m_defaultServerPrefix :
"");
55 if(prefix[0] !=
'/') {prefix =
"/"+prefix;}
56 m_thrift_server_rpcPort_Name = prefix +
"/thrift";
59 prefix = default_server ? m_defaultServerPrefix :
"";
60 m_thrift_server_rpcPort_Name = prefix +
"/thrift";
61 yCWarning(FRAMETRANSFORMSETNWCYARP) <<
"no nws_thrift_port_prefix param found. The resulting port name will be: " << m_thrift_server_rpcPort_Name;
65 if(!m_thriftPort.open(m_thriftPortName))
67 yCError(FRAMETRANSFORMSETNWCYARP,
"Could not open \"%s\" port",m_thriftPortName.c_str());
73 yCError(FRAMETRANSFORMSETNWCYARP,
"Could not connect \"%s\" to \"%s\" port",m_thriftPortName.c_str(), m_thrift_server_rpcPort_Name.c_str());
76 if (!m_setRPC.yarp().attachAsClient(m_thriftPort))
78 yCError(FRAMETRANSFORMSETNWCYARP,
"Error! Cannot attach the port as a client");
87 if(m_thriftPort.isOpen())
96 std::lock_guard <std::mutex> lg(m_pd_mutex);
97 if(!m_setRPC.setTransformRPC(transform))
99 yCError(FRAMETRANSFORMSETNWCYARP,
"Unable to set transformation");
107 std::lock_guard <std::mutex> lg(m_pd_mutex);
108 if(!m_setRPC.setTransformsRPC(transforms))
110 yCError(FRAMETRANSFORMSETNWCYARP,
"Unable to set transformations");
118 std::lock_guard <std::mutex> lg(m_pd_mutex);
119 if (!m_setRPC.deleteTransformRPC(t1,t2))
121 yCError(FRAMETRANSFORMSETNWCYARP,
"Unable to delete transformation");
129 std::lock_guard <std::mutex> lg(m_pd_mutex);
130 if (!m_setRPC.clearAllRPC())
132 yCError(FRAMETRANSFORMSETNWCYARP,
"Unable to clear all transformations");
static bool connect(const std::string &src, const std::string &dest, const std::string &carrier="", bool quiet=true)
Request that an output port connect to an input port.
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.