yarp
yarp copied to clipboard
Yarpmanager RPC dependency feature does not work with strings
Describe the bug
Yarpmanager allows the application to use the response of RPC as a dependency for running modules (source: https://www.yarp.it/latest/yarpmanager.html):
It is also possible to send a specific RPC request to a port to get status about the internal state of a module. This is useful when launching a module should be postponed until other modules get launched and ready. This can be done by specifying the request using "request" property and the expected reply using "reply" property in a
tag. The manager sends the request to the relevant port and check if the received reply matches the one indicated in the "reply" property before launching the module. If the reply does not match the expected one, the corresponding module will not launched.
However, the feature does not seem to work with RPC replying with strings.
To Reproduce
Below, a simple yarpmanager test application to reproduce the issue:
:warning:
.txtextension was used for uploading the file on GitHub.
Expected behavior
When launching the application with "Run all", both the modules are expected to be running.
Screenshots

Configuration (please complete the following information):
- OS: Ubuntu 20.04.3 LTS
- yarp version: 3.5.1
- compiler: GNU GCC 9.3
Additional context
-
Apparently the issue is due to this line. Here, the method returns the underlying C-string of a
std::stringbuilt from aBottlevariable local to the method itself.
In https://github.com/RiccardoGrieco/yarp/tree/fix-yarpmanager_request_rpc I was able to fix the issue by changing the return type tostd::string. However, the check on the RPC reply passes only if the double quotes are added to reply in the XML with the special character":<port timeout="15.0" request="set_static_transform_rad frame_1 frame_2 0.1 0 0.5 1.5708 0 -1.5708" reply=""set_static_transform done"">/transformServer/rpc</port> -
The feature seem to work when using RPCs returning
intorbool.
For the latter, the values to be put inside the reply attribute are[ok]and[fail]. This is not documented in https://www.yarp.it/latest/yarpmanager.html.
cc @drdanz @randaz81 @Nicogene