Gepetto / gepetto-viewer-corba

CORBA server/client for SceneViewer.
Other
11 stars 25 forks source link

omniORB.CORBA.COMM_FAILURE when trying to visualize a pinocchio model #177

Closed IoannisDadiotis closed 1 year ago

IoannisDadiotis commented 1 year ago

Hi,

I am trying to visualize a pinocchio model generated from urdf (in particular I want to check the GeometryModel related with the collisions.). When running the above minimal example:

import sys
import numpy as np
import pinocchio as pin
try:
    import hppfcl
except ImportError:
    print("This example requires hppfcl")
    sys.exit(0)
from pinocchio.visualize import GepettoVisualizer
import pinocchio as pin

urdfpath = "/home/ioannis/centauro_ws/src/iit-centauro-ros-pkg/centauro_urdf/urdf/centauro.urdf"
mesh_dir = ["/home/ioannis/centauro_ws/src/iit-centauro-ros-pkg/",  "/home/ioannis/test_ws/src"] #pinocchio_model_dir

# model = pin.buildModelFromUrdf(urdfpath, pin.JointModelFreeFlyer()) #pin.Model()
# robot = RobotWrapper.BuildFromURDF(urdfpath, mesh_dir, pin.JointModelFreeFlyer())
model, collision_model, visual_model = pin.buildModelsFromUrdf(urdfpath, mesh_dir, pin.JointModelFreeFlyer())

# Create data required by the algorithms
data, collision_data, visual_data = pin.createDatas(model, collision_model, visual_model)

viz = GepettoVisualizer(
    model=model, collision_model=collision_model, visual_model=visual_model,
)

# Initialize the viewer.
try:
    viz.initViewer()
except ImportError as error:
    print("Error while initializing the viewer. It seems you should install gepetto-viewer")
    print(error)
    sys.exit(0)

try:
    viz.loadViewerModel("shapes")
except AttributeError as error:
    print("Error while loading the viewer model. It seems you should start gepetto-viewer")
    print(error)
    sys.exit(0)

viz.display(np.zeros(0))

I get:

Traceback (most recent call last):
  File "/home/ioannis/PycharmProjects/Check_pinocchio/display_shapes.py", line 81, in <module>
    viz.loadViewerModel("shapes")
  File "/opt/openrobots/lib/python2.7/site-packages/pinocchio/visualize/gepetto_visualizer.py", line 160, in loadViewerModel
    self.loadViewerGeometryObject(visual,pin.GeometryType.VISUAL)
  File "/opt/openrobots/lib/python2.7/site-packages/pinocchio/visualize/gepetto_visualizer.py", line 129, in loadViewerGeometryObject
    gui.setColor(meshName, npToTuple(meshColor))
  File "/opt/openrobots/lib/python2.7/site-packages/gepetto/corbaserver/graphical_interface_idl.py", line 524, in setColor
    return self._obj.invoke("setColor", _0_gepetto.corbaserver.GraphicalInterface._d_setColor, args)
omniORB.CORBA.COMM_FAILURE: CORBA.COMM_FAILURE(omniORB.COMM_FAILURE_WaitingForReply, CORBA.COMPLETED_MAYBE)

My system is:

Notice that import pinocchio as pin also gives me (maybe not related with this issue):

/opt/openrobots/lib/python2.7/site-packages/hppfcl/__init__.py:34: RuntimeWarning: to-Python converter for boost::shared_ptr<hpp::fcl::CollisionGeometry> already registered; second conversion method ignored.

I also tried the display_shapes.py example which apparently runs without the above error but I only see an empty scene in gepetto-gui.

Any idea how to solve this? Thanks

florent-lamiraux commented 1 year ago

Did you start gepetto-gui ?

IoannisDadiotis commented 1 year ago

Yes and it starts as expected. When the error occurs the gui exits with the following message QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined Segmentation fault (core dumped)

Forgot to mention that the issue does not seem to be urdf dependent. I tried as well with different urdf files.

florent-lamiraux commented 1 year ago

The CORBA error above is due to the failure of gepetto-gui. As the server dies, the client receives an error. I will try to reproduce the error and let you know.

florent-lamiraux commented 1 year ago

Can you provide me the content of the hardcoded paths in your script ?

IoannisDadiotis commented 1 year ago

Yes, the iit-centauro-ros-pkg is cloned in my /home/ioannis/centauro_ws/src

But if it makes it easier to you, you can just try with tiago robot from example-robot-data:

urdfpath = "/home/ioannis/test_ws/src/example-robot-data/robots/tiago_description/robots/tiago.urdf"
mesh_dir = ["/home/ioannis/test_ws/src"]

where /home/ioannis/test_ws/src is where my example-robot-data forked repo is cloned.

I get the same error with tiago.

florent-lamiraux commented 1 year ago

I am not able to reproduce your bug. Did you install some packages from source besides the robotpkg-... binary packages ?

IoannisDadiotis commented 1 year ago

No, I don't think so. I am trying to check if there are different versions/installations of pinocchio and gepetto-viewer in my device from previous projects that I did and do not remember. Is there an easy way to check that my robotpkg-* installations listed above are unique in my system? (For now in my sourced workspaces I cannot find any related source packages and with conda list I do not get any related pkg. )

florent-lamiraux commented 1 year ago

You can try to run ldd /opt/openrobots/bin/gepetto-gui in the same terminal in which you run gepetto-gui and see if the executable is linked to libraries that are manually compiled by you.

IoannisDadiotis commented 1 year ago

I get the followng:

ioannis@ioannis-iit-laptop ~ $ ldd /opt/openrobots/bin/gepetto-gui 
    linux-vdso.so.1 (0x00007ffe4fa56000)
    libgepetto-viewer.so => /usr/local/lib/libgepetto-viewer.so (0x00007feaad738000)
    libQt5Widgets.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 (0x00007feaacef1000)
    libQt5Gui.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5 (0x00007feaac788000)
    libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007feaac03d000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007feaabcb4000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007feaaba9c000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007feaab6ab000)
    libosg.so.161 => /opt/openrobots/lib/libosg.so.161 (0x00007feaab0ef000)
    libosgDB.so.161 => /opt/openrobots/lib/libosgDB.so.161 (0x00007feaaad8d000)
    libosgFX.so.161 => /opt/openrobots/lib/libosgFX.so.161 (0x00007feaaab4f000)
    libosgGA.so.161 => /opt/openrobots/lib/libosgGA.so.161 (0x00007feaaa866000)
    libosgText.so.161 => /opt/openrobots/lib/libosgText.so.161 (0x00007feaaa5f4000)
    libosgUtil.so.161 => /opt/openrobots/lib/libosgUtil.so.161 (0x00007feaaa1b9000)
    libosgViewer.so.161 => /opt/openrobots/lib/libosgViewer.so.161 (0x00007feaa9e8a000)
    libOpenThreads.so.21 => /opt/openrobots/lib/libOpenThreads.so.21 (0x00007feaa9c81000)
    libosgQt5.so.145 => /opt/openrobots/lib/libosgQt5.so.145 (0x00007feaa9a58000)
    libQt5Xml.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Xml.so.5 (0x00007feaa981c000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007feaa947e000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007feaa925f000)
    libGL.so.1 => /usr/lib/x86_64-linux-gnu/libGL.so.1 (0x00007feaa8fd3000)
    libpng16.so.16 => /usr/lib/x86_64-linux-gnu/libpng16.so.16 (0x00007feaa8da1000)
    libharfbuzz.so.0 => /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007feaa8b03000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007feaa88e6000)
    libicui18n.so.60 => /usr/lib/x86_64-linux-gnu/libicui18n.so.60 (0x00007feaa8445000)
    libicuuc.so.60 => /usr/lib/x86_64-linux-gnu/libicuuc.so.60 (0x00007feaa808d000)
    libdouble-conversion.so.1 => /usr/lib/x86_64-linux-gnu/libdouble-conversion.so.1 (0x00007feaa7e7c000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007feaa7c78000)
    libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007feaa7961000)
    /lib64/ld-linux-x86-64.so.2 (0x00007feaadf0b000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007feaa7759000)
    libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007feaa7514000)
    libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007feaa71dc000)
    libXinerama.so.1 => /usr/lib/x86_64-linux-gnu/libXinerama.so.1 (0x00007feaa6fd9000)
    libXrandr.so.2 => /usr/lib/x86_64-linux-gnu/libXrandr.so.2 (0x00007feaa6dce000)
    libQt5OpenGL.so.5 => /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5 (0x00007feaa6b77000)
    libGLX.so.0 => /usr/lib/x86_64-linux-gnu/libGLX.so.0 (0x00007feaa6946000)
    libGLdispatch.so.0 => /usr/lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007feaa6690000)
    libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007feaa63dc000)
    libgraphite2.so.3 => /usr/lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007feaa61af000)
    libicudata.so.60 => /usr/lib/x86_64-linux-gnu/libicudata.so.60 (0x00007feaa4606000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007feaa4395000)
    libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007feaa4163000)
    libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007feaa3f3b000)
    libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007feaa3d29000)
    libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007feaa3b1f000)
    libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007feaa391b000)
    libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007feaa3715000)
    libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007feaa3500000)

Do you think that the problem can be this line libgepetto-viewer.so => /usr/local/lib/libgepetto-viewer.so (0x00007feaad738000) ? Maybe instead of this I should have the dependency on /opt/openrobots/lib/libgepetto-viewer.so?

florent-lamiraux commented 1 year ago

Yes. I suggest you remove the installation of gepetto-viewer in /usr/local.

IoannisDadiotis commented 1 year ago

This solved my issue. Thank you for the effort!