Closed ZhengmaoHe closed 1 year ago
It probably unrelated to the swapBuffers
warning.
The Node ... does not exist
makes me think the issue is in viewer.loadViewerModel
. I guess the objects are created but not added to the scene.
Also, is there another visualizers that I can use to easily display the robot while programming in c++?
Not that I know of.
Hello @MariaBana Difficult to reproduce your issue. There are no include in your sample C++ code. Can you embed your code in a minimal package with a CMakeLists.txt so that we can compile it ? Did you install from binary packages or from source. If so which versions of pinocchio, gepetto-viewer and gepetto-viewer-corba do you use ?
Otherwise can you look in the Body Tree what are the objects present ?
Hi @florent-lamiraux Thanks to your generous help,
Can you embed your code in a minimal package with a CMakeLists.txt so that we can compile it ?
I have written a more concise code here(simply replacing the urdf path of https://github.com/stack-of-tasks/pinocchio-gepetto-viewer/blob/master/tests/ur5.cc) learn-pinocchio.zip
Did you install from binary packages or from source. If so which versions of pinocchio, gepetto-viewer and gepetto-viewer-corba do you use ?
They are installed from source. The pinocchio I use is the pinocchio3-preview branch (because I need to use the closed chain manipulator), gepetto-viewer and gepetto-viewer-corba are the master branches. Other than that, I installed libopenscenegraph-dev3.6.4 and libopenscenegraph160 3.6.4 from binary packages, and osg3.6.4 from source.
Otherwise can you look in the Body Tree what are the objects present ?
It seems that it does not load the body tree correctly, here is a screenshot of the window.
@jmirabel
I guess the objects are created but not added to the scene.
Thanks very much for the tip, could you give me more guidance to verify this guess? These lines of code are written like the official example, so it should be fine, right?
pinocchio::gepetto::Viewer viewer (model, &visual_model, &collision_model);
viewer.initViewer("pinocchio");
viewer.loadViewerModel("ur5");
viewer.addFrame(model.nframes-1);
viewer.display(pinocchio::neutral(model));
I am not so familiar with the bindings between pinocchio and gepetto-viewer. I cannot find which package installs
#include <pinocchio/gepetto/viewer.hpp>
@florent-lamiraux It is pinocchio-gepetto-viewer: https://github.com/stack-of-tasks/pinocchio-gepetto-viewer, sorry I forgot to attach it.
It seems to work on my computer
Maybe you can try with another urdf model.
Yes, the issue is that the meshes are not loaded. I suspect that the meshes cannot be found (though I'm surprised there is no error message. Check your ROS_PACKAGE_PATH
.
@jmirabel I can't use pinocchio through ROS because I need pinocchio3-preview to use closed chain dynamics. But I installed pinocchio2 to compare. I changed the name of the base.dae in the meshes file and the following error is output in pinocchio2
mao@mao:~/Desktop/myProject/learn-pinocchio/build$ ./learn-pinocchio
terminate called after throwing an instance of 'std::invalid_argument'
what(): Could not load resource /home/mao/Desktop/Third-Party/pinocchio/models/example-robot-data/robots/ur_description/meshes/ur5/visual/base.dae
Unable to open file "/home/mao/Desktop/Third-Party/pinocchio/models/example-robot-data/robots/ur_description/meshes/ur5/visual/base.dae".
Hint: the mesh directory may be wrong.
Aborted (core dumped)
This means it can find the meshes file. The same learn-pinocchio program in pinocchio3, on the other hand, runs normally, so I think there may be a problem with the read meshes step in pinocchio3?
However, pinocchio2 also does not display the robot properly (when loading meshes normally), and the gepetto-gui reports the same error as pinocchio3, as does the body tree.
@florent-lamiraux I tried several models provided in pinocchio and they all report the same error. And compared with pinocchio2 (see the my last reply for details), I think the problem may not be loading the model?
I'm pretty sure the issue is unrelated. Either the paslth is wrong or the file got corrupted somehow. Check whether you can open the file with meshlab. Double check the path.
@jmirabel I made sure the path and files are OK, I have now installed the osg-dae plugin and successfully displayed the robot in pinocchio2, but the same program doesn't work in pinocchio3, still reporting the same error.
Can you open an issue in pinocchio explaining that displaying models using pinocchio 2 + pinocchio-gepetto-viewer works but that pinocchio 3 + gepetto-viewer does not, refer to this issue and ask for what has changed ?
Hello, I successfully installed gepetto-viewer and its dependencies on ubuntu20.04, but I can't make it display robots normally. When I run the sample program, the terminal running gepetto-gui will output
At the same time, GEPETTO GUI window displays only one coordinate axis. My sample program is as follows:
This problem has been bothering me for several days. I hope you can give me some tips. Thanks! Also, is there another visualizers that I can use to easily display the robot while programming in c++?