ros/urdf_parser_py

Setting visual in a link bug

Opened this issue · 0 comments

mutr commented

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