diff --git a/examples/pybullet/gym/pybullet_utils/examples/mjcf2urdf.py b/examples/pybullet/gym/pybullet_utils/examples/mjcf2urdf.py
index c1e39745d..f7903262f 100644
--- a/examples/pybullet/gym/pybullet_utils/examples/mjcf2urdf.py
+++ b/examples/pybullet/gym/pybullet_utils/examples/mjcf2urdf.py
@@ -18,4 +18,11 @@ for o in objs:
humanoid = objs[o]
ed0 = ed.UrdfEditor()
ed0.initializeFromBulletBody(humanoid, p._client)
- ed0.saveUrdf(p.getBodyInfo(0)[1]+"_"+p.getBodyInfo(o)[0]+".urdf")
+ robotName = str(p.getBodyInfo(o)[1],'utf-8')
+ partName = str(p.getBodyInfo(o)[0], 'utf-8')
+
+ print("robotName=",robotName)
+ print("partName=",partName)
+
+ saveVisuals=False
+ ed0.saveUrdf(robotName+"_"+partName+".urdf", saveVisuals)
diff --git a/examples/pybullet/gym/pybullet_utils/urdfEditor.py b/examples/pybullet/gym/pybullet_utils/urdfEditor.py
index 6b05ce72c..3edca4596 100644
--- a/examples/pybullet/gym/pybullet_utils/urdfEditor.py
+++ b/examples/pybullet/gym/pybullet_utils/urdfEditor.py
@@ -273,7 +273,7 @@ class UrdfEditor(object):
file.write("\t\t\n")
- def writeLink(self, file, urdfLink):
+ def writeLink(self, file, urdfLink,saveVisuals):
file.write("\t\n")
@@ -283,9 +283,9 @@ class UrdfEditor(object):
for v in urdfLink.urdf_visual_shapes:
if (v.geom_type == p.GEOM_CAPSULE):
hasCapsules = True
- if (not hasCapsules):
- for v in urdfLink.urdf_visual_shapes:
- self.writeVisualShape(file,v)
+ if (saveVisuals and not hasCapsules):
+ for v in urdfLink.urdf_visual_shapes:
+ self.writeVisualShape(file,v)
for c in urdfLink.urdf_collision_shapes:
self.writeCollisionShape(file,c)
file.write("\t\n")
@@ -329,7 +329,7 @@ class UrdfEditor(object):
file.write(str)
file.write("\t\n")
- def saveUrdf(self, fileName):
+ def saveUrdf(self, fileName, saveVisuals=True):
file = open(fileName,"w")
file.write("\n")
file.write("\n")
for link in self.urdfLinks:
- self.writeLink(file,link)
+ self.writeLink(file,link, saveVisuals)
for joint in self.urdfJoints:
self.writeJoint(file,joint)