14 #include <cmrc/cmrc.hpp>
26 #define LOG_THROTTLE_PERIOD 1.0
31 std::lock_guard<std::mutex> lock (m_rpc_mutex);
34 bool ok = in.
read(connection);
40 if (request ==
"help")
43 out.
addString(
"No RPC commands available");
47 yCError(FRAMETRANSFORMSERVER,
"Invalid vocab received in FrameTransformServer");
54 if (returnToSender !=
nullptr)
56 out.
write(*returnToSender);
60 yCError(FRAMETRANSFORMSERVER) <<
"Invalid return to sender";
67 yCWarning(FRAMETRANSFORMSERVER) <<
"The 'FrameTransformServer' device is experimental and could be modified without any warning";
72 std::string configuration_to_open;
73 std::string innerFilePath=
"config_xml/fts_yarp_only.xml";
74 auto fs = cmrc::frameTransformServerRC::get_filesystem();
75 if(cfg.
check(
"filexml_option")) { innerFilePath=
"config_xml/"+cfg.
find(
"filexml_option").
toString();}
76 cfg.
unput(
"filexml_option");
77 auto xmlFile =
fs.open(innerFilePath);
78 for(
const auto& lemma : xmlFile)
80 configuration_to_open += lemma;
83 std::string m_local_rpcUser =
"/ftServer/rpc";
85 cfg.
unput(
"local_rpc");
91 m_robot = std::move(result.
robot);
101 if (!m_rpc_InterfaceToUser.open(m_local_rpcUser))
103 yCError(FRAMETRANSFORMSERVER,
"Failed to open rpc port");
106 m_rpc_InterfaceToUser.setReader(*
this);
115 m_rpc_InterfaceToUser.close();
128 yCTrace(FRAMETRANSFORMSERVER,
"Thread started");
134 yCTrace(FRAMETRANSFORMSERVER,
"Thread stopped");
constexpr yarp::conf::vocab32_t VOCAB_ERR
A simple collection of objects that can be described and transmitted in a portable way.
void addVocab32(yarp::conf::vocab32_t x)
Places a vocabulary item in the bottle, at the end of the list.
bool read(ConnectionReader &reader) override
Set the bottle's value based on input from a network connection.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
void clear()
Empties the bottle of any objects it contains.
bool write(ConnectionWriter &writer) const override
Output a representation of the bottle to a network connection.
void addString(const char *str)
Places a string in the bottle, at the end of the list.
An interface for reading from a network connection.
virtual ConnectionWriter * getWriter()=0
Gets a way to reply to the message, if possible.
An interface for writing to a network connection.
An abstraction for a periodic thread.
A class for storing options and configuration information.
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
void unput(const std::string &key)
Remove the association from the given key to a value, if present.
A base class for nested structures that can be searched.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
std::string toString() const override
Return a standard text representation of the content of the object.
virtual std::string asString() const
Get string value.
Result of the parsing of XMLReader.
bool parsingIsSuccessful
True if the parsing was successful, false otherwise.
Robot robot
If parsingIsSuccessful is true, contains a valid robot instance.
XMLReaderResult getRobotFromString(const std::string &filename, const yarp::os::Searchable &config=yarp::os::Property())
Parse the XML description of a robotinterface from a string.
#define yCError(component,...)
#define yCAssert(component, x)
#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.