sdf2urdf.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import sys
00004 import argparse
00005 
00006 import pysdf
00007 
00008 
00009 def main():
00010   parser = argparse.ArgumentParser()
00011   parser.add_argument('sdf', help='SDF file to convert')
00012   parser.add_argument('urdf', help='Resulting URDF file to be written')
00013   parser.add_argument('-p', '--plot', nargs=1, help='Plot SDF to file')
00014   args = parser.parse_args()
00015 
00016   sdf = pysdf.SDF(file=args.sdf)
00017   world = sdf.world
00018   if args.plot:
00019     world.plot_to_file(args.plot[0])
00020   if len(world.models) != 1:
00021     print('SDF contains %s instead of exactly one model. Aborting.' % len(world.models))
00022     sys.exit(1)
00023 
00024   model = world.models[0]
00025   print(model)
00026   model.save_urdf(args.urdf)
00027 
00028 
00029 if __name__ == '__main__':
00030   main()


pysdf
Author(s): Andreas Bihlmaier
autogenerated on Fri Oct 3 2014 22:09:51