Yarp: Module ignores `YARP_CLOCK` depending on where the yarp::os::Network is defined

Created on 3 May 2018  路  5Comments  路  Source: robotology/yarp

I wanted to run a module in Gazebo and synchronize it through the Network clock instead of the System clock. To do so, I run Gazebo with the option -slibgazebo_yarp_clock.so and the module with YARP_CLOCK=/clock, but the module ignored completely this setting and used the System clock (the output of isNetworkClock() was always false).

After discussing with @traversaro and @pattacini, we found out that the Yarp Network was defined after some manipulation on the Resource Finder.

yarp::os::ResourceFinder &rf = yarp::os::ResourceFinder::getResourceFinderSingleton();
...
yarp::os::Network yarp;
if (!yarp::os::Network::checkNetwork(5.0))
{
    yError() << " YARP server not available!";
    return EXIT_FAILURE;
}

The problem was solved by defining the Yarp Network before the code related to the Resource Finder. Nevertheless, I think it would be beneficial to get an error message to avoid this kind of mistake.

Reminder - Documentation Needed

Most helpful comment

We have a label :label: for that! :laughing:

All 5 comments

@barbalberto

Guess it's all kind of related with PR #1277, similar to issue #1595.

As discussed, yarp::os::Network is mandatory for using YARP classes.
We will add documentation soon.

What about keeping this issue open until the documentation is ready?

We have a label :label: for that! :laughing:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xEnVrE picture xEnVrE  路  3Comments

jeljaik picture jeljaik  路  3Comments

abolfazlzaraki picture abolfazlzaraki  路  3Comments

Nicogene picture Nicogene  路  4Comments

drdanz picture drdanz  路  3Comments