14#include <cmrc/cmrc.hpp>
27#define LOG_THROTTLE_PERIOD 1.0
35 bool ok = in.
read(connection);
41 if (request ==
"help")
44 out.
addString(
"No RPC commands available");
48 yCError(FRAMETRANSFORMSERVER,
"Invalid vocab received in FrameTransformServer");
55 if (returnToSender !=
nullptr)
57 out.
write(*returnToSender);
61 yCError(FRAMETRANSFORMSERVER) <<
"Invalid return to sender";
68 yCWarning(FRAMETRANSFORMSERVER) <<
"The 'FrameTransformServer' device is experimental and could be modified without any warning";
70 std::string cfg_string = config.
toString();
74 std::string configuration_to_open;
75 std::string innerFilePath=
"config_xml/fts_yarp_only.xml";
76 if(cfg.
check(
"testxml_option"))
79 std::ifstream xmlFile(innerFilePath);
80 std::stringstream stream_file;
81 stream_file << xmlFile.rdbuf();
82 configuration_to_open = stream_file.str();
86 auto fs = cmrc::frameTransformServerRC::get_filesystem();
87 if(cfg.
check(
"filexml_option")) { innerFilePath=
"config_xml/"+cfg.
find(
"filexml_option").
toString();}
88 cfg.
unput(
"filexml_option");
89 auto xmlFile =
fs.open(innerFilePath);
90 for(
const auto& lemma : xmlFile)
92 configuration_to_open += lemma;
96 std::string m_local_rpcUser =
"/ftServer/rpc";
98 cfg.
unput(
"local_rpc");
100 if (config.
check(
"FrameTransform_verbose_debug"))
103 cfg.
put(
"FrameTransform_verbose_debug", vval);
122 yCError(FRAMETRANSFORMSERVER,
"Failed to open rpc port");
134 yCDebug(FRAMETRANSFORMSERVER,
"rpc port closed");
151 yCTrace(FRAMETRANSFORMSERVER,
"Thread started");
157 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.
void askToStop()
Stop the thread.
void setReader(PortReader &reader) override
Set an external reader for port data.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
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.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
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 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 Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
A single value (typically within a Bottle).
std::string toString() const override
Return a standard text representation of the content of the object.
virtual std::string asString() const
Get string value.
bool enterPhase(yarp::robotinterface::ActionPhase phase)
Result of the parsing of yarp::robotinterface::XMLReader.
bool parsingIsSuccessful
True if the parsing was successful, false otherwise.
Robot robot
If parsingIsSuccessful is true, contains a valid robot instance.
Class to read an XML file.
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 yCDebug(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.