17PeriodicThread (0.010),
18m_thrift_rpcPort_Name("/frameTransformGet/rpc")
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_thrift_rpcPort_Name = prefix +
"/" + m_deviceName +
"/thrift";
43 prefix = default_config ? m_defaultConfigPrefix :
"";
44 m_thrift_rpcPort_Name = prefix +
"/" + m_deviceName +
"/thrift";
47 if(config.
check(
"streaming_enabled")) {
48 m_streaming_port_enabled = config.
find(
"streaming_enabled").asString() ==
"true";
50 if (config.
check(
"period")) {
51 double period = config.
find(
"period").asFloat64();
56 if(!m_thrift_rpcPort.
open(m_thrift_rpcPort_Name))
61 if(!this->
yarp().attachAsServer(m_thrift_rpcPort))
70 if (m_streaming_port_enabled)
72 if (config.
check(
"output_streaming_port_prefix")){
73 prefix = config.
find(
"output_streaming_port_prefix").asString() + (default_config ? m_defaultConfigPrefix :
"");
74 if(prefix[0] !=
'/') {prefix =
"/"+prefix;}
75 m_streaming_port_name = prefix +
"/" + m_deviceName +
"/tf:o";
78 prefix = default_config ? m_defaultConfigPrefix :
"";
79 m_streaming_port_name = prefix +
"/" + m_deviceName +
"/tf:o";
83 if (!m_streaming_port.
open(m_streaming_port_name))
117 m_thrift_rpcPort.
close();
119 m_streaming_port.
close();
126 std::lock_guard<std::mutex> m_lock(m_mutex);
127 m_iFrameTransformStorageGet =
nullptr;
134 std::lock_guard<std::mutex> m_lock(m_mutex);
135 deviceToAttach->
view(m_iFrameTransformStorageGet);
137 if ( m_iFrameTransformStorageGet==
nullptr){
147 std::lock_guard<std::mutex> m_lock(m_mutex);
150 if (m_iFrameTransformStorageGet !=
nullptr)
152 std::vector<yarp::math::FrameTransform> localTransform;
153 if (m_iFrameTransformStorageGet->
getTransforms(localTransform))
161 ret.transforms_list = std::vector<yarp::math::FrameTransform>();
162 ret.retvalue = ReturnValue::return_code::return_value_error_method_failed;
169 std::lock_guard<std::mutex> m_lock(m_mutex);
171 if (m_iFrameTransformStorageGet !=
nullptr)
173 std::vector<yarp::math::FrameTransform> localTransform;
174 if (m_iFrameTransformStorageGet->
getTransforms(localTransform))
179 m_streaming_port.
write(rgt);
bool view(T *&x)
Get an interface to the device driver.
A container for a device driver.
static bool checkNetwork()
Check if the YARP Network is up and running.
bool setPeriod(double period)
Set the (new) period of the thread.
bool isRunning() const
Returns true when the thread is started, false otherwise.
bool start()
Call this to start the thread.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
bool write(const PortWriter &writer, const PortWriter *callback=nullptr) const override
Write an object to the port.
void interrupt() override
Interrupt any current reads or writes attached to the port.
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 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.
yarp::os::WireLink & yarp()
Get YARP state associated with this object.
#define yCInfo(component,...)
#define yCError(component,...)
#define yCTrace(component,...)
#define yCWarning(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.