urdf_parser_py icon indicating copy to clipboard operation
urdf_parser_py copied to clipboard

Default Robot class is generated without the version attribute

Open FabioBergonti opened this issue 5 years ago • 2 comments

The robot class is generated without the version attribute and if I run:

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

I got this 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'

Is it possible to set the default robot class with version attribute equal to 1.0? In this way I can avoid to specify every time the robot version.

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

I did these tests on melodic-devel branch

FabioBergonti avatar May 22 '20 15:05 FabioBergonti

This is definitely a problem; thanks for pointing it out. Please see https://github.com/ros/urdf_parser_py/pull/62 for a fix.

clalancette avatar Jun 12 '20 16:06 clalancette

This is definitely a problem; thanks for pointing it out. Please see #62 for a fix.

Thank you @clalancette I checked the PR and I confirm that it solves the problem

FabioBergonti avatar Jun 13 '20 08:06 FabioBergonti

Since we merged in #62 ages ago, closing this out.

clalancette avatar Nov 08 '23 19:11 clalancette