Code Monkey home page Code Monkey logo

urdf_parser_py's Introduction

urdf_parser_py

Development Setup

You must manually run setup.py. For catkin development, you can install to $ws/../build/lib/pythonX.Y/dist-packages via

devel_prefix=$(cd $(catkin_find --first-only)/.. && pwd)
cd ../urdf_parser_py
python setup.py install --install-layout deb --prefix $devel_prefix

Authors

  • Thomas Moulard - urdfpy implementation, integration
  • David Lu - urdf_python implementation, integration
  • Kelsey Hawkins - urdf_parser_python implementation, integration
  • Antonio El Khoury - bugfixes
  • Eric Cousineau - reflection update

Reflection

This an attempt to generalize the structure of the URDF via reflection to make it easier to extend. This concept is taken from Gazebo's SDF structure, and was done with SDF in mind to a) make an SDF parser and b) make a simple converter between URDF and SDF.

Changes

  • Features:
    • Transmission and basic Gazebo nodes.
    • General aggregate types, preserving order
    • Dumping to YAML, used for printing to string (dictionaries do not preserve attribute ordering)
  • XML Parsing: minidom has been swapped out with lxml.etree, but it should not be hard to change that back. Maybe Sax could be used for event-driven parsing.
  • API:
    • Loading methods rely primarily on instance methods rather than static methods, mirroring Gazebo's SDF construct-then-load method
    • Renamed static parse_xml() to from_xml(), and renamed load_* methods to from_* if they are static

Todo

  1. Support additional formats (SDF, drakeURDF, etc.)
    • Parse Gazebo's SDF definition files at some point? For speed's sake, parse it and have it generate code to use?
    • Consider auto-generating modules from schemas such as urdf.xsd. This can extend to SDF, drakeURDF.
  2. Make a direct, two-way URDF <-> SDF converter.
    • Gazebo has the ability to load URDFs and save SDFs, but it lumps everything together
  3. Consider a cleaner implementation for reflection.
    • Make the names a little clearer, especially the fact that from_xml and to_xml write to a node, but do not create a new one.
    • Abstraction layer is not clear. Should explicitly use abstract classes, and try to really clarify the dispatch order (xmlr.Element, xmlr.Param, xmlr.Object, etc.)
  4. Figure out good policy for handling default methods. If saving to XML, write out default values, or leave them out for brevity (and to leave it open for change)? Might be best to add that as an option.
  5. Find a lightweight package that can handle the reflection aspect more elegantly. Enthought traits? IPython's spinoff of traits?

urdf_parser_py's People

Contributors

130s avatar clalancette avatar cpaxton avatar eacousineau avatar eugene-katsevman avatar gerkey avatar goretkin avatar isucan avatar jacquelinekay avatar k-okada avatar kphawkins avatar mgrrx avatar nlamprian avatar otamachan avatar rhaschke avatar rsmallegoor avatar sloretz avatar thomas-moulard avatar timonegk avatar traversaro avatar vrabaud avatar willcbaker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

urdf_parser_py's Issues

Seems to be incompatible with python3.10

When I try to use your package from the ros docker image for humble, I get errors such as this from urdf_parser_py running with python.310:

"/integration_tests/ros/assembly_view/assembly_view/state_publisher.py", line 67, in <module>
    main()
  File "/integration_tests/ros/assembly_view/assembly_view/state_publisher.py", line 62, in main
    print(urdf)
  File "/usr/local/lib/python3.10/dist-packages/urdf_parser_py/xml_reflection/basics.py", line 91, in __str__
    return yaml.dump(self.to_yaml()).rstrip()
  File "/usr/local/lib/python3.10/dist-packages/urdf_parser_py/xml_reflection/basics.py", line 87, in to_yaml
    return to_yaml(raw)
  File "/usr/local/lib/python3.10/dist-packages/urdf_parser_py/xml_reflection/basics.py", line 68, in to_yaml
    out[str(var)] = to_yaml(value)
  File "/usr/local/lib/python3.10/dist-packages/urdf_parser_py/xml_reflection/basics.py", line 72, in to_yaml
    elif isinstance(obj, collections.Iterable):
AttributeError: module 'collections' has no attribute 'Iterable'

The suggestion I've been given is to downgrade, but would it be possible to support python3.10? Or am I missing something else here?

The error message AttributeError: module 'collections' has no attribute 'Iterable' is due to a change in Python 3.10. The Iterable class has been moved from collections to collections.abc.

The error is coming from the urdf_parser_py package, which seems to be using the old import path. This package needs to be updated to work with Python 3.10.

As a workaround, you can use an older version of Python (3.9 or earlier) where collections.Iterable is still valid.

Can you please verify that your package works in python3.10?

ImportError: No module named lxml

After yesterday's sync, this package doesn't install it's dependencies on lxml and yaml.

apt install -y ros-melodic-urdfdom-py

python -c 'import urdf_parser_py.urdf'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/ros/melodic/lib/python2.7/dist-packages/urdf_parser_py/urdf.py", line 1, in <module>
    from urdf_parser_py.xml_reflection.basics import *
  File "/opt/ros/melodic/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/__init__.py", line 1, in <module>
    from urdf_parser_py.xml_reflection.core import *
  File "/opt/ros/melodic/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 1, in <module>
    from urdf_parser_py.xml_reflection.basics import *
  File "/opt/ros/melodic/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/basics.py", line 4, in <module>
    from lxml import etree
ImportError: No module named lxml

If you look at the dependencies of the debian package, it is missing 2 of them. Are the condition tags parsed properly?

apt depends ros-melodic-urdfdom-py
ros-melodic-urdfdom-py
  Depends: ros-melodic-rospy

Parsing with display_urdf a URDF file with the encoding indicated in the xml header

Passing a urdf file that starts with <?xml version='1.0' encoding='UTF-8'?> to display_urdf fails with a error.

Reproduction script using mamba

mamba create -n urdfdom-py urdfdom-py
mamba activate urdfdom-py
wget https://raw.githubusercontent.com/icub-tech-iit/ergocub-gazebo-simulations/1179630a88541479df51ebb108a21865ea251302/models/stickBot/model.urdf
$CONDA_PREFIX/lib/urdfdom_py/display_urdf model.urdf

fails with:

Traceback (most recent call last):
  File "/home/traversaro/miniforge3/envs/urdfdom-py/lib/urdfdom_py/display_urdf", line 33, in <module>
    sys.exit(load_entry_point('urdfdom-py==1.2.1', 'console_scripts', 'display_urdf')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/traversaro/miniforge3/envs/urdfdom-py/lib/python3.12/site-packages/urdf_parser_py/display_urdf.py", line 15, in main
    robot = URDF.from_xml_string(args.file.read())
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/traversaro/miniforge3/envs/urdfdom-py/lib/python3.12/site-packages/urdf_parser_py/xml_reflection/core.py", line 610, in from_xml_string
    node = etree.fromstring(xml_string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "src/lxml/etree.pyx", line 3257, in lxml.etree.fromstring
  File "src/lxml/parser.pxi", line 1911, in lxml.etree._parseMemoryDocument
ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.

mamba list:

(urdfdom-py) traversaro@IITICUBLAP257:~$ mamba list
# packages in environment at /home/traversaro/miniforge3/envs/urdfdom-py:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
bzip2                     1.0.8                hd590300_5    conda-forge
ca-certificates           2023.7.22            hbcca054_0    conda-forge
icu                       73.2                 h59595ed_0    conda-forge
ld_impl_linux-64          2.40                 h41732ed_0    conda-forge
libexpat                  2.5.0                hcb278e6_1    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 13.2.0               h807b86a_2    conda-forge
libgomp                   13.2.0               h807b86a_2    conda-forge
libiconv                  1.17                 h166bdaf_0    conda-forge
libnsl                    2.0.1                hd590300_0    conda-forge
libsqlite                 3.44.0               h2797004_0    conda-forge
libstdcxx-ng              13.2.0               h7e041cc_2    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libxml2                   2.11.5               h232c23b_1    conda-forge
libxslt                   1.1.37               h0054252_1    conda-forge
libzlib                   1.2.13               hd590300_5    conda-forge
lxml                      4.9.3           py312he528aba_1    conda-forge
ncurses                   6.4                  h59595ed_2    conda-forge
openssl                   3.1.4                hd590300_0    conda-forge
pip                       23.3.1             pyhd8ed1ab_0    conda-forge
python                    3.12.0          hab00c5b_0_cpython    conda-forge
python_abi                3.12                    4_cp312    conda-forge
pyyaml                    6.0.1           py312h98912ed_1    conda-forge
readline                  8.2                  h8228510_1    conda-forge
setuptools                68.2.2             pyhd8ed1ab_0    conda-forge
tk                        8.6.13          noxft_h4845f30_101    conda-forge
tzdata                    2023c                h71feb2d_0    conda-forge
urdfdom-py                1.2.1           py312h7900ff3_3    conda-forge
wheel                     0.41.3             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
yaml                      0.2.5                h7f98852_2    conda-forge

Downstream issue: icub-tech-iit/ergocub-gazebo-simulations#49 .

ros.org page for `urdf_parser_py` is confusing?

At present, the urdf_parser_py page on ROS.org seems a bit mixed up:
http://wiki.ros.org/urdf_parser_py

It refers to the old robot_model_py package, and indicates that it's only supported for EOL packages; it then mentions that its been renamed to urdfdom_py; if you click on that link, it takes you to that page which actually refers to the urdf_parser_py page?
http://wiki.ros.org/urdfdom_py

It does seem that robot_model_py does still have its old page:
http://wiki.ros.org/robot_model_py

A wee bit confusing...

Setting visual in a link bug

I found two possible bugs. Opened one issue because I think they are related.

  1. Latest commit broke setting Visual via Link constructor.
  2. <visual> tag are missing in a resulting xml if I created robot from scratch like this:
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import roslib; roslib.load_manifest('urdfdom_py')
>>> from urdf_parser_py.urdf import *
>>> robot = Robot("my_robot")
>>> v = Visual(origin=Pose(xyz=[0.0, 0.0, 0.0], rpy=[0.0, 0.0, 0.0]), geometry=Mesh(filename='package://my.stl'), material=Material(name=""))
>>> l = Link(name='my_link', visual=v)
>>> print(l)
collisions: []
inertial: None
name: my_link
origin: None
visuals: []
>>> # BUG1: visual are empty because setter must be called in a constructor
... l.visual = v # try again manual way
>>> print(l)
collisions: []
inertial: None
name: my_link
origin: None
visuals:
- geometry: {filename: 'package://my.stl', scale: None}
  material: {color: None, name: '', texture: None}
  origin:
    rpy: [0.0, 0.0, 0.0]
    xyz: [0.0, 0.0, 0.0]
>>> robot.add_link(l) 
>>> print(robot.to_xml_string())
<?xml version="1.0"?>
<robot name="my_robot">
  <link name="my_link"/>
</robot>

>>> # BUG2: <visual> are missing

urdf_parser_py.urdf not working on ros melodic

I noticed that the xacro command under melodic adds the encoding attribute to the xml tag of the generated urdf file. This gives problems with the underlying lxml parser. That complaints about:

ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.

Here by a minimal example to reproduce this error under ros melodic:

import roslib; roslib.load_manifest('urdfdom_py')
import rospy

# Import the module

from urdf_parser_py.urdf import URDF

robot = URDF.from_xml_string("<?xml version=\"1.0\" encoding=\"utf-8\"?><robot name='myrobot'></robot></xml>")

The version without the encoding attribute works correctly

import roslib; roslib.load_manifest('urdfdom_py')
import rospy

# Import the module

from urdf_parser_py.urdf import URDF

robot = URDF.from_xml_string("<?xml version=\"1.0\" "?><robot name='myrobot'></robot></xml>")

I noticed this when using the URDF.from_parameter_server() command that now no longer works (It still works with ros kinetic)

A simple solution would be to remove the encoding tag from the parameter string before passing it to the parser. But im not sure if this is the way to go. If you agree with this solution i can open a PR to fix this.

urdf parser should be able to recognize sensor elements

I tried to parse my pr2 urdf sample but the sensors that he has weren't recognized.
The elements recognized in the robot parameter are:
name
joints
links
materials
gazebos
transmissions
I couldn't find anything about this, so I'll add the new sensor elements recognition feature.

[release request] PR2Transmisstion cannot be loaded by latest ros-melodic-urdfdom-py

When I loaded URDF with old transmission (PR2Transmission) by latest ros-melodic-urdfdom-py, I got an error.

>>> from urdf_parser_py.urdf import URDF

>>> robot = URDF.from_xml_string("<?xml version=\"1.0\"?><robot name=\"myrobot\"><transmission name=\"mytransmission\" type=\"pr2_mechanism_model/SimpleTransmission\"><actuator name=\"mymotor\"/><joint name=\"myjoint\"/><mechanicalReduction>1 </mechanicalReduction></transmission></robot>")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/ros/melodic/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 616, in from_xml_string
    return cls.from_xml(node, path)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 610, in from_xml
    return cur_type.from_xml(node, path)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 232, in from_xml
    obj.read_xml(node, path)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 598, in read_xml
    self.XML_REFL.set_from_xml(self, node, path)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 513, in set_from_xml
    element.add_from_xml(obj, child, element_path)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 390, in add_from_xml
    value = self.value_type.from_xml(node, path)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 283, in from_xml
    raise ParseError(Exception(out), path)
urdf_parser_py.xml_reflection.core.ParseError: ParseError in /robot[@name='myrobot']/transmission[@name='mytransmission']:
Could not perform duck-typed parsing.
Value Type: <class 'urdf_parser_py.urdf.Transmission'>
Exception: ParseError in /robot[@name='myrobot']/transmission[@name='mytransmission']/joint[@name='myjoint']:
no hardwareInterface defined

This error is caused by this commit 22f3a60 .

In xml_children of xml_reflection/basics.py, raw list of children is returned. (not copied one).
This destroys the node here, and destroyed node causes the error above.

info.children.remove(child)

After this commit b6a9726 , this error will be fixed.
I would appreciate it if you could release it as soon as possible.

LICENSE file

Hi authors! We are currently using your package in Theseus. We are considering adding a local copy of urdf_parser_py to our third party folder as a fallback import for some use cases were we can't easily install from pip. However, we weren't sure if this was allowed by your license.

From your package.xml it seems that you considered a BSD-license, however I don't see a LICENSE file in your repository. Could you include a file with the license type you are using?

Thanks!

Branch urdf_parser_py for Galactic?

@clalancette objections?

This one seems easy: create a galactic-devel (matching the existing foxy-devel naming style on this repo) branch from the ros2 branch and update rosdistro to say galactic-devel is the devel branch.

Backport support for multiple visuals to Kinetic

In Kinetic (and probably Indigo), if you define multiple visual tags within a link tag, I get a warning like this:

Scalar element defined multiple times: visual

That warning goes away if I pull urdf_parser_py from source and use the melodic_devel branch. I'm not sure how hard it would be, but it would be nice if the changes that squashed that warning could be cherry-picked back and released into Kinetic.

It looks like the docs were updated to allow multiple visuals in May 2013:

http://wiki.ros.org/action/info/urdf/XML/link?action=diff&rev2=59&rev1=58

"Unknown tag: hardwareInterface" in actuator

I'm not sure, but there's a potential regression during runtime.

I started getting an error with one of our robots (software undisclosable):

Unknown tag: hardwareInterface
Unknown tag: hardwareInterface
Unknown tag: hardwareInterface
Unknown tag: hardwareInterface
Unknown tag: hardwareInterface
Unknown tag: hardwareInterface
Unknown tag: hardwareInterface
Unknown tag: hardwareInterface
Unknown tag: hardwareInterface
Unknown tag: hardwareInterface
:

The tags in question are probably the ones defined in actuator tag. And I suspect that this has begun happening after this commit.

To check with simpler case, in my forked repo I added hardwareInterface in an actuator element in the test case, and the test fails returning the same error.

Definition on the wiki says hardwareInterface can be optionally defined in actuator. So something is wrong with the current impl.

Deprecate accidental leaking of private API

Relates #30, #14

It's hard to know what you can really change in the API since some of the internal implementation bits leaked out into the public namespace.

Ideally, it'd be nice to deprecate those private bits, and simplify the public interface, and do a bit more testing on it.

\cc @clalancette

Default Robot class is generated without the version attribute

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

Load params from ROS 2

I am using the ROS 2 Foxy branch and the from_parameter_server function has to import rospy (Link), so this is not compatible in the ROS 2 working space.

def from_parameter_server(cls, key='robot_description'):
        """
        Retrieve the robot model on the parameter server
        and parse it to create a URDF robot structure.
        Warning: this requires roscore to be running.
        """
        # Could move this into xml_reflection
        import rospy
        return cls.from_xml_string(rospy.get_param(key))

I compared also the code in ros2 branch and I see the from_paramater_server is removed. So what is the better approach to retrieve the robot model from the ROS 2 parameter server? Thank you

Wiki example with PR2 not working

Hi! I ran into some errors when parsing PR2 urdf files, and it seems the example from wiki http://wiki.ros.org/urdfdom_py is not working for me as well.

> rosrun urdfdom_py display_urdf `rospack find pr2_mechanism_model`/pr2.urdf

Unknown attribute "type" in /robot[@name='pr2']/link[@name='base_laser_link']
Unknown attribute "reference_position" in /robot[@name='pr2']/joint[@name='fl_caster_rotation_joint']/calibration
Unknown attribute "reference_position" in /robot[@name='pr2']/joint[@name='fr_caster_rotation_joint']/calibration
Unknown attribute "reference_position" in /robot[@name='pr2']/joint[@name='bl_caster_rotation_joint']/calibration
Unknown attribute "reference_position" in /robot[@name='pr2']/joint[@name='br_caster_rotation_joint']/calibration
Unknown attribute "reference_position" in /robot[@name='pr2']/joint[@name='torso_lift_joint']/calibration
Unknown attribute "reference_position" in /robot[@name='pr2']/joint[@name='head_pan_joint']/calibration
Unknown attribute "reference_position" in /robot[@name='pr2']/joint[@name='head_tilt_joint']/calibration
Unknown attribute "type" in /robot[@name='pr2']/link[@name='wide_stereo_optical_frame']
Unknown attribute "type" in /robot[@name='pr2']/link[@name='narrow_stereo_optical_frame']
Unknown attribute "reference_position" in /robot[@name='pr2']/joint[@name='laser_tilt_mount_joint']/calibration
Unknown attribute "type" in /robot[@name='pr2']/link[@name='laser_tilt_link']
Unknown attribute "reference_position" in /robot[@name='pr2']/joint[@name='r_shoulder_pan_joint']/calibration
Unknown attribute "reference_position" in /robot[@name='pr2']/joint[@name='r_shoulder_lift_joint']/calibration
Unknown attribute "reference_position" in /robot[@name='pr2']/joint[@name='r_upper_arm_roll_joint']/calibration
Unknown attribute "reference_position" in /robot[@name='pr2']/joint[@name='r_forearm_roll_joint']/calibration
Unknown attribute "reference_position" in /robot[@name='pr2']/joint[@name='r_elbow_flex_joint']/calibration
Unknown attribute "reference_position" in /robot[@name='pr2']/joint[@name='r_wrist_flex_joint']/calibration
Unknown attribute "reference_position" in /robot[@name='pr2']/joint[@name='r_wrist_roll_joint']/calibration
Unknown tag "verbose" in /robot[@name='pr2']/link[@name='r_wrist_roll_link']/collision[1]
Traceback (most recent call last):
  File "/home/perceptron/catkin_ws_calib/devel/lib/urdfdom_py/display_urdf", line 15, in <module>
    exec(compile(fh.read(), python_script, 'exec'), context)
  File "/home/perceptron/catkin_ws_calib/src/urdf_parser_py/scripts/display_urdf", line 18, in <module>
    robot = URDF.from_xml_string(args.file.read())
  File "/home/perceptron/catkin_ws_calib/src/urdf_parser_py/src/urdf_parser_py/xml_reflection/core.py", line 616, in from_xml_string
    return cls.from_xml(node, path)
  File "/home/perceptron/catkin_ws_calib/src/urdf_parser_py/src/urdf_parser_py/xml_reflection/core.py", line 610, in from_xml
    return cur_type.from_xml(node, path)
  File "/home/perceptron/catkin_ws_calib/src/urdf_parser_py/src/urdf_parser_py/xml_reflection/core.py", line 232, in from_xml
    obj.read_xml(node, path)
  File "/home/perceptron/catkin_ws_calib/src/urdf_parser_py/src/urdf_parser_py/xml_reflection/core.py", line 598, in read_xml
    self.XML_REFL.set_from_xml(self, node, path)
  File "/home/perceptron/catkin_ws_calib/src/urdf_parser_py/src/urdf_parser_py/xml_reflection/core.py", line 513, in set_from_xml
    element.add_from_xml(obj, child, element_path)
  File "/home/perceptron/catkin_ws_calib/src/urdf_parser_py/src/urdf_parser_py/xml_reflection/core.py", line 390, in add_from_xml
    value = self.value_type.from_xml(node, path)
  File "/home/perceptron/catkin_ws_calib/src/urdf_parser_py/src/urdf_parser_py/xml_reflection/core.py", line 283, in from_xml
    raise ParseError(Exception(out), path)
urdf_parser_py.xml_reflection.core.ParseError: ParseError in /robot[@name='pr2']/transmission[@name='r_wrist_trans']:
Could not perform duck-typed parsing.
Value Type: <class 'urdf_parser_py.urdf.Transmission'>
Exception: ParseError in /robot[@name='pr2']/transmission[@name='r_wrist_trans']:
Required element not set in XML: type

This seems to be an instance of #36 and ros/urdfdom#36 (comment) but I'm not sure why the fix in that issue didn't help with this, any help or pointer is appreciated!

Python 3.10 compatibility: `collections.Iterable` cannot be imported

Issue

On Python 3.10.2, when calling print() on a joint or other object, I get the error:

AttributeError: module 'collections' has no attribute 'Iterable'

I assume this is from line 72 of urdf_parser_py/src/urdf_parser_py/xml_reflection/basics.py:

    elif isinstance(obj, collections.Iterable):
        out = [to_yaml(item) for item in obj]
    else:

I believe it should be Iterable should be imported from collections.abc now instead of directly from collections.

A related issue in another library: nerdocs/pydifact#46

Code to reproduce:

import urdf_parser_py.urdf

robot = urdf_parser_py.urdf.URDF.from_xml_file('./my_urdf.urdf')
for joint in robot.joints:
    print(joint)

Release melodic-devel

Could you please release the package to be included with the next melodic/noetic update?

Is the master branch mantained?

The master branch of this repo used to contain a catkin-free version of the package, as originally discussed in ros/urdfdom#70 .
However, some months ago the default branch of the repo switched to indigo-devel, and the master branch is not receiving any bug fix. If this branch is not maintained anymore I suggest deleting it, especially if installing catkin in windows using pip is straightforward (I guess it is, but I did not tried personally).

Release to ROS Lunar

This package is blocked by none, but blocking the following:

  • calibration
  • jsk_visualization
  • robot_model
  • srdfdom

Build failing in xenial, yakkety and stretch

Looks like a couple builds have started failing

In stretch I see a linker error when CMake checks for the existence of pthread_create

Run Build Command:"/usr/bin/make" "cmTC_f2232/fast"
make[2]: Entering directory '/tmp/binarydeb/ros-lunar-urdfdom-py-0.3.3/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp'
/usr/bin/make -f CMakeFiles/cmTC_f2232.dir/build.make CMakeFiles/cmTC_f2232.dir/build
make[3]: Entering directory '/tmp/binarydeb/ros-lunar-urdfdom-py-0.3.3/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_f2232.dir/CheckFunctionExists.c.o
/usr/bin/cc    -g -O2 -fdebug-prefix-map=/tmp/binarydeb/ros-lunar-urdfdom-py-0.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_f2232.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.7/Modules/CheckFunctionExists.c
Linking C executable cmTC_f2232
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f2232.dir/link.txt --verbose=1
/usr/bin/cc  -g -O2 -fdebug-prefix-map=/tmp/binarydeb/ros-lunar-urdfdom-py-0.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -DCHECK_FUNCTION_EXISTS=pthread_create    CMakeFiles/cmTC_f2232.dir/CheckFunctionExists.c.o  -o cmTC_f2232 -rdynamic -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_f2232.dir/build.make:97: recipe for target 'cmTC_f2232' failed
make[3]: *** [cmTC_f2232] Error 1
make[3]: Leaving directory '/tmp/binarydeb/ros-lunar-urdfdom-py-0.3.3/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_f2232/fast' failed
make[2]: *** [cmTC_f2232/fast] Error 2
make[2]: Leaving directory '/tmp/binarydeb/rodh_auto_configure: cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var -DCATKIN_BUILD_BINARY_PACKAGE=1 -DCMAKE_INSTALL_PREFIX=/opt/ros/lunar -DCMAKE_PREFIX_PATH=/opt/ros/lunar returned exit code 1
s-lunar-urdfdom-py-0.3.3/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp

In yakkety and xenial there's a failure to import a catkin python module

08:56:32 -- Found gtest sources under '/usr/src/gtest': gtests will be built
08:56:32 -- Using Python nosetests: /usr/bin/nosetests-2.7
08:56:32 -- catkin 0.7.7
08:56:32 Traceback (most recent call last):
08:56:32   File "/tmp/binarydeb/ros-lunar-urdfdom-py-0.3.3/obj-x86_64-linux-gnu/catkin_generated/generate_cached_setup.py", line 20, in <module>
08:56:32     from catkin.environment_cache import generate_environment_script
08:56:32 ImportError: No module named catkin.environment_cache
08:56:32 CMake Error at /opt/ros/lunar/share/catkin/cmake/safe_execute_process.cmake:11 (message):
08:56:32   execute_process(/usr/bin/python
08:56:32   "/tmp/binarydeb/ros-lunar-urdfdom-py-0.3.3/obj-x86_64-linux-gnu/catkin_generated/generate_cached_setup.py")
08:56:32   returned error code 1
08:56:32 Call Stack (most recent call first):
08:56:32   /opt/ros/lunar/share/catkin/cmake/all.cmake:186 (safe_execute_process)
08:56:32   /opt/ros/lunar/share/catkin/cmake/catkinConfig.cmake:20 (include)
08:56:32   CMakeLists.txt:10 (find_package)

No license specified

There is no license specified for this package - I can add in another pull request for adding a BSD license.

Before I do so, who do I add the copyright under?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.