fix_urdf.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 
00004 import sys
00005 from xml.dom.minidom import parse
00006 import re
00007 
00008 def main(from_file, to_file):
00009     root = parse(from_file)
00010     # remove illegal link/join
00011     # link .*_cb_link
00012     # joint .*_cb
00013     links = root.getElementsByTagName("link")
00014     joints = root.getElementsByTagName("joint")
00015     for link in links:
00016         name = link.getAttribute("name")
00017         if re.match(".*_cb_link$", name):
00018             link.parentNode.removeChild(link)
00019     for joint in joints:
00020         name = joint.getAttribute("name")
00021         if re.match(".*_cb$", name):
00022             joint.parentNode.removeChild(joint)
00023     with open(to_file, "w") as f:
00024         f.write(root.toxml())
00025 
00026 
00027 if __name__ == "__main__":
00028     main(sys.argv[1], sys.argv[2])


jsk_calibration
Author(s):
autogenerated on Wed Sep 16 2015 04:37:40