robotology / simmechanics-to-urdf

Script for converting simmechanics XML files to URDF
34 stars 8 forks source link

Check if everything is still working after urdf_parser_py modification of collision and visual tags #36

Closed traversaro closed 3 years ago

traversaro commented 6 years ago

We need to fix the regression in visual and collision elements introduced in https://github.com/ros/urdf_parser_py/pull/26 and discussed in https://github.com/robotology/simmechanics-to-urdf/issues/38 .

gabrielenava commented 5 years ago

@traversaro actually it is not ok: with the latest urdf_parser_py the urdf::Link class does not work properly anymore, and both Visual and Collision tags are missing in the link definition inside the urdf.

It seems the developers of the parser also noted the lack of backward compatibility of the Link class, in fact I fixed the problem by moving my urdf_parser_py to the fork implementing this PR: see also the issue I've opened https://github.com/robotology/simmechanics-to-urdf/issues/38#issuecomment-511048269.

Note that in my specific case there was another installation of the library that was hiding my modifications. In fact, the urdf_parser_py comes along with ros-desktop-full installation and therefore there was another (bugged) copy of the library in my path. I had to rename the installation that comes along with ROS, so that it was possible to see the correct files.

Now it seems to me that everything is working fine.

traversaro commented 5 years ago

If I remember correctly the changes in https://github.com/ros/urdf_parser_py/pull/26, we can simply strictly require the latest version of urdf_parser_py and switch to use visuals and collisions instead of visual and collision.

traversaro commented 5 years ago

I updated the title of the issue to reflect the current focus, after the evidence of the regression introduced in https://github.com/ros/urdf_parser_py/pull/26 .

traversaro commented 5 years ago

A fix for the regression was proposed in https://github.com/ros/urdf_parser_py/pull/47 by @k-okada, but unfortunately upstream seems not to be interested in the PR.

traversaro commented 4 years ago

A fix for the regression was proposed in ros/urdf_parser_py#47 by @k-okada, but unfortunately upstream seems not to be interested in the PR.

The fix has been merged in the melodic-branch and is available in release 0.4.3, while it is not available in the ros2 branch and in particular in release 1.0.0 . @gabrielenava @FabioBergonti can you test if everything works ok when using urdf_parser_py v0.4.3 ?

FabioBergonti commented 4 years ago

@gabrielenava @FabioBergonti can you test if everything works ok when using urdf_parser_py v0.4.3 ?

@traversaro I tested it but it didn't compile and I got this error:

Traceback (most recent call last):
  File "/usr/local/bin/simmechanics_to_urdf", line 11, in <module>
    load_entry_point('simmechanics-to-urdf==0.2', 'console_scripts', 'simmechanics_to_urdf')()
  File "build/bdist.linux-x86_64/egg/simmechanics_to_urdf/firstgen.py", line 1871, in main
  File "build/bdist.linux-x86_64/egg/simmechanics_to_urdf/firstgen.py", line 175, in convert
  File "build/bdist.linux-x86_64/egg/simmechanics_to_urdf/firstgen.py", line 202, in generateXML
  File "build/bdist.linux-x86_64/egg/urdf_parser_py/xml_reflection/core.py", line 588, in to_xml
  File "build/bdist.linux-x86_64/egg/urdf_parser_py/xml_reflection/core.py", line 581, in write_xml
  File "build/bdist.linux-x86_64/egg/urdf_parser_py/xml_reflection/core.py", line 554, in add_to_xml
  File "build/bdist.linux-x86_64/egg/urdf_parser_py/xml_reflection/core.py", line 336, in add_to_xml
AttributeError: 'Robot' object has no attribute 'version'

The error is the same as the issue https://github.com/dic-iit/component_ironcub/issues/138

traversaro commented 4 years ago

That is another urdf_parser_py bug: the default Robot class is generated without the version attribute (see https://github.com/ros/urdf_parser_py/blob/melodic-devel/src/urdf_parser_py/urdf.py#L488), but then the version attribute is required in the serialization. It is necessary to report upstream the bug (let me know if you want me to handle that, even if I do not know when I will be able to do so).

An easy way to reproduce the bug is:

import urdf_parser_py
import xml
xml.etree.ElementTree.tostring(urdf_parser_py.urdf.URDF("robot_name").to_xml())

that gives the error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.linux-x86_64/egg/urdf_parser_py/xml_reflection/core.py", line 588, in to_xml
  File "build/bdist.linux-x86_64/egg/urdf_parser_py/xml_reflection/core.py", line 581, in write_xml
  File "build/bdist.linux-x86_64/egg/urdf_parser_py/xml_reflection/core.py", line 554, in add_to_xml
  File "build/bdist.linux-x86_64/egg/urdf_parser_py/xml_reflection/core.py", line 336, in add_to_xml
AttributeError: 'Robot' object has no attribute 'version'

while the following call works fine:

import urdf_parser_py
import xml
xml.etree.ElementTree.tostring(urdf_parser_py.urdf.URDF("robot_name", 1.0).to_xml())

that prints:

<robot name="robot_name" version="1.0" />
AlexAntn commented 3 years ago

I have tried running the URDF toolchain and noticed that with the most recent versions of urdf_parser_py (namely, master and 1.1.0) the simmechanics-to-urdf is not generating a correct URDF file.

The generated file has no links to any of the meshes, which results in the model not being successfully loaded when launching it in gazebo.

This should be reproducible by following the installation procedure and using the most recent versions for urdf_parser_py, and trying to create a URDF file with it (I used the icub3 files present here https://github.com/robotology/icub-models-generator/tree/921c4cbd5eefd94e95437ad3bb01793aff3ace68/simmechanics/data/icub3)

cc @traversaro