convert-all-eusscene.py
Go to the documentation of this file.
00001 #! /usr/bin/env python
00002 
00003 import sys
00004 import os
00005 import os.path
00006 import commands
00007 import re
00008 
00009 
00010 def convert_all_eusscene ():
00011 
00012     urdfmodel_dir_path = commands.getoutput('rospack find eusurdf') + "/models/"
00013     eusmodel_dir_path = commands.getoutput('rospack find euslisp') + "/jskeus/eus/models/"
00014     eusmodel_file_path_list = commands.getoutput('ls ' + eusmodel_dir_path + '*.l -1')
00015 
00016     for eusmodel_file_path in eusmodel_file_path_list.split('\n'):
00017         eusmodel_file_name = os.path.basename(eusmodel_file_path)
00018         regexp_search_res = re.compile("(.*)\-scene\.l").search(eusmodel_file_name)
00019         if regexp_search_res:
00020             print "[convert-all-eusmodel] converting %s" % eusmodel_file_name
00021             eusmodel_function_name = regexp_search_res.group(1)
00022             os.system('mkdir -p %s' % urdfmodel_dir_path+eusmodel_function_name+"-scene")
00023             os.system('rosrun roseus roseus "(progn (load \\"package://pr2eus_moveit/euslisp/eus2scene.l\\") (load \\"package://euslisp/jskeus/eus/models/%s\\") (generate-scene-file-from-eusscene (%s) \\"%s\\") (exit))"' % (eusmodel_file_name, eusmodel_function_name, urdfmodel_dir_path+eusmodel_function_name+"-scene/model.scene"))
00024 
00025 if __name__ == '__main__':
00026     convert_all_eusscene()


eusurdf
Author(s): Ryohei Ueda (ueda@jsk.t.u-tokyo.ac.jp)
autogenerated on Mon Oct 6 2014 01:10:08