Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check on carriers for yarpserver --ros #1679

Merged
merged 2 commits into from
May 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/release/v2_3_72_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ Bug Fixes
* Fixed `RGBDSensorWrapper` compatibilty with `frameGrabberGui2`.
* Fixed joint remapping in method `getRefVelocity()`.

#### `YARP_serversql`

* Added check if `rossrv`, `tcpros` and `xmlrpc` are installed when
yarpserver is launched with `--ros` option. (#722)


#### `YARP_OS`

* Added timeout parameter in `TcpConnector::connect()` to unify behaviour with the
Expand Down
12 changes: 12 additions & 0 deletions src/libYARP_serversql/src/yarpserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <yarp/os/all.h>
#include <yarp/os/Os.h>
#include <yarp/os/RosNameSpace.h>
#include <yarp/os/Carriers.h>

#include <yarp/name/NameServerManager.h>
#include <yarp/name/BootstrapServer.h>
Expand Down Expand Up @@ -166,6 +167,17 @@ class NameServerContainer : public ComposedNameService
}

if (options.check("ros") || NetworkBase::getEnvironment("YARP_USE_ROS")!="") {
yarp::os::Bottle lst = yarp::os::Carriers::listCarriers();
std::string lstStr(lst.toString().c_str());
if (lstStr.find("rossrv") == std::string::npos ||
lstStr.find("tcpros") == std::string::npos ||
lstStr.find("xmlrpc") == std::string::npos) {
fprintf(stderr,"Missing one or more required carriers ");
fprintf(stderr,"for yarpserver --ros (rossrv, tcpros, xmlrpc).\n");
fprintf(stderr,"Run 'yarp connect --list-carriers' to see carriers on your machine\n");
fprintf(stderr,"Aborting.\n");
return false;
}
ConstString addr = NetworkBase::getEnvironment("ROS_MASTER_URI");
Contact c = Contact::fromString(addr.c_str());
if (c.isValid()) {
Expand Down