| |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| import sys, os |
| import xml.etree.ElementTree as ET |
|
|
| def usage(): |
| print "Usage: " + sys.argv[0] + " URDF_FILE OUT_FILE\n" |
| sys.exit(3) |
|
|
| if len(sys.argv) != 3: |
| usage() |
|
|
| in_file = sys.argv[1] |
| out_file = sys.argv[2] |
|
|
| namespaces = { |
| 'controller': 'http://playerstage.sourceforge.net/gazebo/xmlschema/#controller', |
| 'sensor': "http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor", |
| 'interface': "http://playerstage.sourceforge.net/gazebo/xmlschema/#interface", |
| } |
| for prefix, uri in namespaces.iteritems(): |
| ET.register_namespace(prefix, uri) |
| tree = ET.parse(in_file) |
| root = tree.getroot() |
|
|
| |
| |
| |
|
|
| |
| root.find('.').attrib['name'] = "shadowhand" |
|
|
| |
| for mesh in root.iter('mesh'): |
| fn = mesh.attrib['filename'] |
| (path, name) = os.path.split(fn) |
| new_file = "package://sr_grasp_description/meshes/" + name |
| |
| mesh.attrib['filename'] = new_file |
| |
| if mesh.attrib['scale'] == "0.001 0.001 0.001" and not name.endswith(".stl") and not name.endswith("biotac_thumb_adapter.dae"): |
| mesh.attrib['scale'] = "0.1 0.1 0.1" |
|
|
| |
| for tag in root.findall('.//controller:sr_gazebo_ros_controller_manager/..', namespaces=namespaces): |
| root.remove(tag) |
|
|
| |
| for tag in root.findall('.//sensor:contact/..', namespaces=namespaces): |
| root.remove(tag) |
|
|
| |
| for tag in root.findall('.//gazebo', namespaces=namespaces): |
| root.remove(tag) |
|
|
| |
| for tag in root.findall('.//transmission', namespaces=namespaces): |
| root.remove(tag) |
|
|
| for tag in root.findall('.//material[@name="BiotacGreen"]', namespaces=namespaces): |
| root.remove(tag) |
|
|
| |
| |
| |
| |
| for tag in root.findall('.//joint/limit[@effort="10"]', namespaces=namespaces): |
| tag.attrib['effort'] = "100" |
|
|
| |
| tree.write(out_file) |
|
|
|
|