robotology-legacy / codyco-modules

Whole-body Compliant Dynamical Contacts in Cognitive Humanoids
www.codyco.eu
Other
20 stars 13 forks source link

WholeBodyDynamics device not launched when running launch-wholebodydynamics.xml #277

Closed gabrielenava closed 5 years ago

gabrielenava commented 5 years ago

The wholebodydynamics device that should be launched by the launch-wholebodydynamics.xml file is actually not launched. Namely, I am talking about this line: https://github.com/robotology/codyco-modules/blob/master/src/devices/wholeBodyDynamics/app/launch-wholebodydynamics-icub-six-fts-sim.xml#L95

Here there are no errors: the line is simply skipped and I have no idea why. But the file exists, and if I substitute the path to the file with the content of the file inside launch-wholebodydynamics.xml` I am finally able to run the Yoga demo. But this is not a good solution.

traversaro commented 5 years ago

Did you fixed the problem in https://github.com/robotology/codyco-modules/issues/276 ? What is location of the files that you are trying to run in the yarprobotinterface?

gabrielenava commented 5 years ago

I fixed the invalid DTD problem locally on my laptop, see https://github.com/robotology/codyco-modules/issues/276#issue-463294649. I will open a PR for fixing the remote branch too.

the launch-wholebodydynamics.xml file is located in $PATH_TO_SUPERBUILD_INSTALL/share/codyco/robots/iCubGazeboV2_5/ and the wholebodydynamics-external.xml is located in $PATH_TO_SUPERBUILD_INSTALL/share/codyco/robots/iCubGazeboV2_5/estimators. Superbuild paths seem to be set correctly an I set them by sourcing the setup.sh file.

traversaro commented 5 years ago

Have you tried to test it with another devices file to check if that is loaded instead?

gabrielenava commented 5 years ago

All the other devices in the file are correctly loaded: https://github.com/robotology/codyco-modules/blob/master/src/devices/wholeBodyDynamics/app/launch-wholebodydynamics-icub-six-fts-sim.xml#L89

The wholebodydynamics device itself is loaded without any problem if I copy the content of wholebodydynamics-external.xml instead of using the path to the xml file as specified currently in the launch-wholebodydynamics.xml file: https://github.com/robotology/codyco-modules/blob/master/src/devices/wholeBodyDynamics/app/launch-wholebodydynamics-icub-six-fts-sim.xml#L95

traversaro commented 5 years ago

I got it. I asked if you could load any other devices files, similar to wholebodydynamics-external.xml but with less devices or something similar.

gabrielenava commented 5 years ago

I did now the following test:

I run YARP_ROBOT_NAME=iCubgazeboV2_5 yarprobotinterface --config launch-wholebodydynamics.xml. The last device loaded is the left foot FT:

[INFO]created device <analogsensorclient>. See C++ class AnalogSensorClient for documentation.
yarp: Port /wholeBodyDynamics/l_foot_ft_sensor active at tcp://140.93.4.152:10079/
yarp: Port /wholeBodyDynamics/l_foot_ft_sensor/rpc:o active at tcp://140.93.4.152:10080/
yarp: Receiving input from /icubSim/left_foot/analog:o to /wholeBodyDynamics/l_foot_ft_sensor using udp
yarp: Sending output from /wholeBodyDynamics/l_foot_ft_sensor/rpc:o to /icubSim/left_foot/analog:o/rpc:i using tcp
[INFO]created device <analogsensorclient>. See C++ class AnalogSensorClient for documentation.

Therefore it seems the problem is not in the wholebodydynamics-external.xml file.

prashanthr05 commented 5 years ago

I also experience this issue.

prashanthr05 commented 5 years ago

I made the following quick hack and it apparently works,

In the launch-wholebodydynamics-icub-six-fts-sim.xml I changed https://github.com/robotology/codyco-modules/blob/75a681590889a13967351911f694dd7a0a9c14df/src/devices/wholeBodyDynamics/app/launch-wholebodydynamics-icub-six-fts-sim.xml#L2 to

<robot name="@WBD_YARP_ROBOT_NAME" portprefix="icubSim" build="1"  xmlns:xi="http://www.w3.org/2001/XInclude">

Then I changed https://github.com/robotology/codyco-modules/blob/75a681590889a13967351911f694dd7a0a9c14df/src/devices/wholeBodyDynamics/app/launch-wholebodydynamics-icub-six-fts-sim.xml#L95 to

    <xi:include href="estimators/wholebodydynamics-external.xml" />

In the wholebodydynamics-icub-external-six-fts-sim.xml, I commented the lines , https://github.com/robotology/codyco-modules/blob/75a681590889a13967351911f694dd7a0a9c14df/src/devices/wholeBodyDynamics/app/wholebodydynamics-icub-external-six-fts-sim.xml#L4 and https://github.com/robotology/codyco-modules/blob/75a681590889a13967351911f694dd7a0a9c14df/src/devices/wholeBodyDynamics/app/wholebodydynamics-icub-external-six-fts-sim.xml#L75

then finally changed, https://github.com/robotology/codyco-modules/blob/75a681590889a13967351911f694dd7a0a9c14df/src/devices/wholeBodyDynamics/app/wholebodydynamics-icub-external-six-fts-sim.xml#L5 to

<device xmlns:xi="http://www.w3.org/2001/XInclude" name="wholebodydynamics" type="wholebodydynamics">
prashanthr05 commented 5 years ago

Were there any recent changes in the parsing done by yarprobotinterface?

The only change as listed in the changelog of YARP 3.2 release seems to be,

Tools
yarprobotinterface
YARP//DTD yarprobotinterface 3.0//EN is now the default parser for robot xml configuration files.
yarprobotinterface will not run anymore deprecated DTD format v1.0
GiulioRomualdi commented 5 years ago

Same problem with the latest version of YARP

GiulioRomualdi commented 5 years ago

Thanks to @prashanthr05 suggestion the problem is solved. I open a PR

traversaro commented 5 years ago

Guys, do you have any idea why this is now necessary? I am a bit out of time to check this out, but it could be interesting.

prashanthr05 commented 5 years ago

Guys, do you have any idea why this is now necessary? I am a bit out of time to check this out, but it could be interesting.

I faced this problem after updating YARP to 3.2, specifically to this commit https://github.com/robotology/yarp/commit/7ee03f8e042d31dcad271b6782dc1de8398a8b12. and this line

<devices file="estimators/wholebodydynamics-external.xml" />

in the configuration file was not being parsed by the yarprobotinterface.

traversaro commented 5 years ago

Yes, I was asking because I fear that we are actually doing a workaround but the actual bug is in YARP, but if no one has bandwidth to investigate that I am ok to merge Giulio's PR. Opening a bug in YARP without a minimun working example is probably just creating noise.

nunoguedelha commented 5 years ago

I just experienced the same issue. Actually the issue is solved by using the current format supported by YARP for including device config files (we are more familiar with it now). I just replaced

<!-- estimators -->
<devices file="estimators/wholebodydynamics-external.xml" />

by

<!-- estimators -->
<devices>
<xi:include href="estimators/wholebodydynamics-external.xml" />
</devices>

As it is done in for any other inclusion. @prashanthr05 had already done this more or less, but I didn't need the other workarounds:

I'm pushing a fix in the same PR opened by @GiulioRomualdi https://github.com/robotology/codyco-modules/pull/280.

nunoguedelha commented 5 years ago

CC @CarlottaSartore

traversaro commented 5 years ago

Thanks @nunoguedelha

nunoguedelha commented 5 years ago

Fixed by by #280 .

traversaro commented 5 years ago

Thanks @nunoguedelha .