ros / urdf_parser_py

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

Setting visual in a link bug #42

Open mutr opened 5 years ago

mutr commented 5 years ago

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