20 #include <yarp/os/Network.h>
21 #include <yarp/os/Log.h>
22 #include <yarp/os/LogStream.h>
25 using namespace yarp::os;
31 Bottle &conf_group = rf.findGroup(
"GENERAL");
32 if (conf_group.isNull())
34 yWarning() <<
"Missing GENERAL group! The module uses the default values";
38 if(conf_group.check(
"portprefix")) { m_portPrefix = conf_group.find(
"portprefix").asString(); }
39 if(conf_group.check(
"period")) { _updatePeriod = conf_group.find(
"period").asFloat64(); }
40 if(conf_group.check(
"robotname")) { _robotName = conf_group.find(
"robotname").asString(); }
46 options.put(
"device",
"rawValuesPublisherClient");
47 options.put(
"remote",
"/" + _robotName + m_portPrefix);
48 options.put(
"local",
"/" + _robotName + m_portPrefix);
51 yDebug() <<
"++++ config:\n"
52 <<
"\t portprefix: " << m_portPrefix <<
"\n"
53 <<
"\t period: " << _updatePeriod <<
"\n"
54 <<
"\t robotname: " << _robotName <<
"\n";
56 _rawDataPublisherDevice.open(options);
58 if (!_rawDataPublisherDevice.isValid())
60 yError() <<
"Unable to open device driver. Aborting...";
64 if (!_rawDataPublisherDevice.view(_iravap) || _iravap==
nullptr)
66 yError() <<
"Unable to open motor raw interface. Aborting...";
71 if(!_outputPort.open(m_portPrefix +
"/rawdata_publisher:o"))
73 yError() <<
"Error opening output port for rawdata publisher";
78 _rawDataValuesMap = {};
86 yInfo() <<
"Calling close functionality\n";
98 Bottle &b = _outputPort.prepare();
101 if(!_iravap->getRawDataMap(_rawDataValuesMap))
103 yError() <<
"Map of raw values to be streamed cannot be retrieved. Unpreparing...\n";
104 _outputPort.unprepare();
109 for (
auto [key, value] : _rawDataValuesMap)
112 Bottle &bKeyContent = b.addList();
113 for (
auto el : value)
115 bKeyContent.addInt32(el);
120 _outputPort.setEnvelope(_stamp);
~FakeRawDataPublisherTester() override
bool configure(yarp::os::ResourceFinder &rf)
FakeRawDataPublisherTester()