Gepetto / example-robot-data

Set of robot URDFs for benchmarking and developed examples.
BSD 3-Clause "New" or "Revised" License
130 stars 48 forks source link

icub is not correctly loaded in the gepetto viewer #105

Open GiulioRomualdi opened 2 years ago

GiulioRomualdi commented 2 years ago

Hi all, I'm trying to visualize the icub stored in this repo. I installed the gepetto gui and the example-robot-data from conda. When I try to spawn icub with the following command python -m example_robot_data icub I got this result

2021-10-12 18-14-58

This is the output of conda list command

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                      1_llvm    conda-forge
alsa-lib                  1.2.3                h516909a_0    conda-forge
assimp                    5.0.1                hedfc422_6    conda-forge
boost                     1.74.0           py39h5472131_3    conda-forge
boost-cpp                 1.74.0               h312852a_4    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
c-ares                    1.17.2               h7f98852_0    conda-forge
ca-certificates           2021.10.8            ha878542_0    conda-forge
collada-dom               2.5.0                h1713cda_4    conda-forge
console_bridge            1.0.1                h4bd325d_0    conda-forge
dbus                      1.13.6               h48d8840_2    conda-forge
eigen                     3.4.0                h4bd325d_0    conda-forge
eigenpy                   2.6.8           py39h5aed9d1_10    conda-forge
example-robot-data        3.11.0           py39h1a9c180_0    conda-forge
expat                     2.4.1                h9c3ff4c_0    conda-forge
ffmpeg                    4.3.2                hca11adc_0    conda-forge
fontconfig                2.13.1            hba837de_1005    conda-forge
freetype                  2.10.4               h0708190_1    conda-forge
gepetto-viewer            4.11.0               h02473c3_1    conda-forge
gepetto-viewer-corba      5.5.1            py39he0596dd_5    conda-forge
gettext                   0.19.8.1          h73d1719_1008    conda-forge
glib                      2.68.4               h9c3ff4c_1    conda-forge
glib-tools                2.68.4               h9c3ff4c_1    conda-forge
gmp                       6.2.1                h58526e2_0    conda-forge
gnutls                    3.6.13               h85f3911_1    conda-forge
gst-plugins-base          1.18.5               hf529b03_0    conda-forge
gstreamer                 1.18.5               h76c114f_0    conda-forge
hpp-fcl                   1.7.7            py39hbcdfc36_2    conda-forge
icu                       68.1                 h58526e2_0    conda-forge
jbig                      2.1               h7f98852_2003    conda-forge
jpeg                      9d                   h36c2ea0_0    conda-forge
krb5                      1.19.2               hcc1bbae_2    conda-forge
lame                      3.100             h7f98852_1001    conda-forge
ld_impl_linux-64          2.36.1               hea4e1c9_2    conda-forge
lerc                      2.2.1                h9c3ff4c_0    conda-forge
libblas                   3.9.0           11_linux64_openblas    conda-forge
libcblas                  3.9.0           11_linux64_openblas    conda-forge
libclang                  11.1.0          default_ha53f305_1    conda-forge
libcurl                   7.79.1               h2574ce0_1    conda-forge
libdeflate                1.7                  h7f98852_5    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libevent                  2.1.10               h9b69904_4    conda-forge
libffi                    3.4.2                h9c3ff4c_4    conda-forge
libgcc-ng                 11.2.0              h1d223b6_10    conda-forge
libgfortran-ng            11.2.0              h69a702a_10    conda-forge
libgfortran5              11.2.0              h5c6108e_10    conda-forge
libglib                   2.68.4               h174f98d_1    conda-forge
libiconv                  1.16                 h516909a_0    conda-forge
libjpeg-turbo             2.1.1                h7f98852_0    conda-forge
liblapack                 3.9.0           11_linux64_openblas    conda-forge
libllvm11                 11.1.0               hf817b99_2    conda-forge
libnghttp2                1.43.0               h812cca2_1    conda-forge
libogg                    1.3.4                h7f98852_1    conda-forge
libopenblas               0.3.17          pthreads_h8fe5266_1    conda-forge
libopus                   1.3.1                h7f98852_1    conda-forge
libpng                    1.6.37               h21135ba_2    conda-forge
libpq                     13.3                 hd57d9b9_1    conda-forge
libssh2                   1.10.0               ha56f1ee_2    conda-forge
libstdcxx-ng              11.2.0              he4da1e4_10    conda-forge
libtiff                   4.3.0                hf544144_1    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libvorbis                 1.3.7                h9c3ff4c_0    conda-forge
libwebp-base              1.2.1                h7f98852_0    conda-forge
libxcb                    1.13              h7f98852_1003    conda-forge
libxkbcommon              1.0.3                he3ba5ed_0    conda-forge
libxml2                   2.9.12               h72842e0_0    conda-forge
libzlib                   1.2.11            h36c2ea0_1013    conda-forge
llvm-openmp               12.0.1               h4bd325d_1    conda-forge
lz4-c                     1.9.3                h9c3ff4c_1    conda-forge
mysql-common              8.0.25               ha770c72_2    conda-forge
mysql-libs                8.0.25               hfa10184_2    conda-forge
ncurses                   6.2                  h58526e2_4    conda-forge
nettle                    3.6                  he412f7d_0    conda-forge
nspr                      4.30                 h9c3ff4c_0    conda-forge
nss                       3.69                 hb5efdd6_1    conda-forge
numpy                     1.21.2           py39hdbf815f_0    conda-forge
octomap                   1.9.7                h4bd325d_0    conda-forge
omniorb                   4.2.4            py39hff7568b_5    conda-forge
omniorb-libs              4.2.4                h812cca2_5    conda-forge
omniorbpy                 4.2.4            py39he3720c4_2    conda-forge
openh264                  2.1.1                h780b84a_0    conda-forge
openscenegraph            3.6.5               h605fd04_11    conda-forge
openscenegraph-osgqt      3.5.7                h9ba741d_3    conda-forge
openssl                   1.1.1l               h7f98852_0    conda-forge
pcre                      8.45                 h9c3ff4c_0    conda-forge
pinocchio                 2.6.3            py39hbcdfc36_2    conda-forge
pip                       21.3               pyhd8ed1ab_0    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
python                    3.9.7           hb7a2778_3_cpython    conda-forge
python_abi                3.9                      2_cp39    conda-forge
qhull                     2020.2               h4bd325d_2    conda-forge
qt                        5.12.9               hda022c4_4    conda-forge
readline                  8.1                  h46c0cb4_0    conda-forge
setuptools                58.2.0           py39hf3d152e_0    conda-forge
sqlite                    3.36.0               h9cd32fc_2    conda-forge
tinyxml                   2.6.2                h4bd325d_2    conda-forge
tk                        8.6.11               h27826a3_1    conda-forge
tzdata                    2021c                he74cb21_0    conda-forge
urdfdom                   2.3.5                h4bd325d_0    conda-forge
urdfdom_headers           1.0.5                h4bd325d_2    conda-forge
wheel                     0.37.0             pyhd8ed1ab_1    conda-forge
x264                      1!161.3030           h7f98852_1    conda-forge
xorg-libxau               1.0.9                h7f98852_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xz                        5.2.5                h516909a_1    conda-forge
zlib                      1.2.11            h36c2ea0_1013    conda-forge
zstd                      1.5.0                ha95c52a_0    conda-forge

Is this problem related to this issue https://github.com/stack-of-tasks/pinocchio/issues/1471?

nim65s commented 2 years ago

Hi,

I can reproduce this issue in a totally different environment, but not with any other robot from this package (I tried with all of them). So I guess this is an issue in the URDF or SRDF of icub. I never used this robot. @cmastalli : did this ever work correctly for you ?

nim65s commented 2 years ago

(btw, I found out that simple_humanoid just has no visual at all…)

cmastalli commented 2 years ago

Hi,

I can reproduce this issue in a totally different environment, but not with any other robot from this package (I tried with all of them). So I guess this is an issue in the URDF or SRDF of icub. I never used this robot. @cmastalli : did this ever work correctly for you ?

Yes, it did. I generated a few videos with Icub in the past. At the moment, I have no clue what is going on.

jcarpent commented 2 years ago

Is it working well in MeshCat? What is the version of Pinocchio?

GiulioRomualdi commented 2 years ago

Hi @jcarpent, Pinocchio version is 2.6.3

Here when I try to view it with MeshCat image

This is the script I used

import pinocchio as pin
import numpy as np
import sys
import os
from os.path import dirname, join, abspath

from pinocchio.visualize import MeshcatVisualizer

# Load the URDF model.
# Conversion with str seems to be necessary when executing this file with ipython
pinocchio_model_dir = os.getenv("ROBOTPKG_BASE")

model_path = join(pinocchio_model_dir,"share/example-robot-data/robots")
mesh_dir = pinocchio_model_dir
urdf_filename = "icub_reduced.urdf"
urdf_model_path = join(join(model_path,"icub_description/robots"),urdf_filename)

model, collision_model, visual_model = pin.buildModelsFromUrdf(urdf_model_path, mesh_dir, pin.JointModelFreeFlyer())

viz = MeshcatVisualizer(model, collision_model, visual_model)

# Start a new MeshCat server and client.
# Note: the server can also be started separately using the "meshcat-server" command in a terminal:
# this enables the server to remain active after the current script ends.
#
# Option open=True pens the visualizer.
# Note: the visualizer can also be opened seperately by visiting the provided URL.
try:
    viz.initViewer(open=True)
except ImportError as err:
    print("Error while initializing the viewer. It seems you should install Python meshcat")
    print(err)
    sys.exit(0)

# Load the robot in the viewer.
viz.loadViewerModel()

# Display a robot configuration.
q0 = pin.neutral(model)
viz.display(q0)
viz.displayCollisions(False)
viz.displayVisuals(True)

input()
jcarpent commented 2 years ago

The issue is coming from the iCub model within the project. I would suggest switching to a descent version. @GiulioRomualdi Would you have time to select one of the available model and to put it within example-robot-data?

GiulioRomualdi commented 2 years ago

Yes, I can try to deal with that. In this concern, the latest iCub model that is automatically generated from the cad is this one

The model is different from the one currently stored in the example-robot-data

New Version Old Version
image image

If you agree I can port the new version in the repo. Do you prefer that I remove the old one and I add the new one or do I keep the old model?

jcarpent commented 2 years ago

As the old one does not look good in the viewer and we don't have time to investigate this issue, I would suggest removing it and replacing it with the proposed version. Thanks a lot, @GiulioRomualdi for your contribution.

jcarpent commented 2 years ago

@nim65s @cmastalli Any feedback?

cmastalli commented 2 years ago

No, please let's do not change the ICub model. We are using as a unittests in some repositories, this might trigger issues in other projects.

What I would suggest is to investigate why this is broken, and then fix it. I haven't tried from my side now, but it used to work before.

cmastalli commented 2 years ago

Also adding other mesh files (for a new ICub) will increase unnecessary the dimension of the repo.

This project doesn't aim to integrate a particular model used in our experiments. Instead, it aims to have a set of robot models for prototyping, unittesting and teaching.

jcarpent commented 2 years ago

No, please let's do not change the ICub model. We are using as a unittests in some repositories, this might trigger issues in other projects.

What I would suggest is to investigate why this is broken, and then fix it. I haven't tried from my side now, but it used to work before.

I see two options:

jcarpent commented 2 years ago

I would go for the second to let people move forward.

cmastalli commented 2 years ago

The problem is not the model, but the orientation of the mesh files.

This can be easily fixed by adapting the URDF.

I can provide a solution as soon I am available. But, unfortunately, I am extremely busy with other activities ATM.

Let's do not discuss about the second option.

jcarpent commented 2 years ago

Sorry @GiulioRomualdi, you will need to wait :(

GiulioRomualdi commented 2 years ago

I've just tried to load the new iCub model and everything works fine (except for the colors but this is a known issue in the urdf @traversaro)

image

Just to understand if the problem is related to Pinocchio or the model stored within this repo, I try to load it with iDynTree running the following command

idyntree-model-view -m icub.urdf

this is the output

image

jcarpent commented 2 years ago

Thanks @GiulioRomualdi for the nice report. So Pinocchio is NOT the issue. We are all safe then ;)

GiulioRomualdi commented 2 years ago

Thanks @GiulioRomualdi for the nice report. So Pinocchio is the issue. We are all safe then ;)

mmmh actually no, pinocchio is returning the very same result of idyntree so I think the problem is the model. Or iDynTree and Pinocchio have the same bug 🥲

jcarpent commented 2 years ago

Yes, you're right. I meant Pinocchio is NOT the issue.

traversaro commented 2 years ago

Or iDynTree and Pinocchio have the same bug 🥲

You know how they say, "great mind think alike". :D

cmastalli commented 2 years ago

I am thinking that this might be related with an old bug in Gepetto viewer.

This URDF model has not been changed from the first time in that I integrated and used it.

stephane-caron commented 1 year ago

Confirming from independent tests with yourdfpy that the iCub URDF in example-robot-data has a mesh orientation issue.

The one from https://github.com/robotology/icub-models/blob/9e91a7d7d09b4cf2c405f9b471965f6a6c3bab19/iCub/robots/iCubGazeboV2_5/model.urdf is fine :ok_hand:

cmastalli commented 1 year ago

Confirming from independent tests with yourdfpy that the iCub URDF in example-robot-data has a mesh orientation issue.

The one from https://github.com/robotology/icub-models/blob/9e91a7d7d09b4cf2c405f9b471965f6a6c3bab19/iCub/robots/iCubGazeboV2_5/model.urdf is fine 👌

I know that this issue is pending for a long time. However, feel free anyone to propose a solution if this is blocking you. Unfortunately, I am quite busy with other priority tasks