ros / urdf_parser_py

Standalone URDF parser for Python.
83 stars 48 forks source link

update backward compatibility on visual and collisions #47

Closed k-okada closed 4 years ago

k-okada commented 5 years ago

On indigo, to set visual and collisions on links, we write

        robot = urdf.Robot(name = 'test')
        link = urdf.Link(name = 'link',
                         visual = urdf.Visual(geometry = urdf.Cylinder(length = 1, radius = 1),
                                              material = urdf.Material(name = 'mat')))
        robot.add_link(link)

or

        robot = urdf.Robot(name = 'test')
        link = urdf.Link(name = 'link')
        link.visual = urdf.Visual(geometry = urdf.Cylinder(length = 1, radius = 1),
                                  material = urdf.Material(name = 'mat'))
        robot.add_link(link)

However, since melodic both method did not work well when we write URDF strings from these data as reported on #45. It only outputs <robot> and <link> tag without <visual> and <collision>. And , to output <visual> and <collision> in URDF, we have to write

        robot = urdf.Robot(name = 'test')
        link = urdf.Link(name = 'link')
        link.add_aggregate('visual', urdf.Visual(geometry = urdf.Cylinder(length = 1, radius = 1),
                                                 material = urdf.Material(name = 'mat')))
        robot.add_link(link)

, but this is not work on Indigo machine.

This PR enable melodic users to continue using indigo-style code.

traversaro commented 5 years ago

Hi @clalancette @sloretz , let us know if there is anything we can do to help in merging this PR, thanks!

sloretz commented 4 years ago

This looks generally OK to me. @k-okada can you please rebase?

Brought up to date and made a few fixes for the version attribute.