Go to the documentation of this file.00001
00002
00003 import sys
00004 import os
00005 import os.path
00006 import commands
00007 import re
00008
00009
00010 def convert_all_eusmodel ():
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 print "[convert-all-eusmodel] converting %s" % eusmodel_file_name
00019 regexp_search_res = re.compile("(.*)\-object\.l").search(eusmodel_file_name)
00020 if regexp_search_res:
00021 eusmodel_function_name = regexp_search_res.group(1)
00022 os.system('rosrun roseus roseus "(progn (load \\"package://eusgazebo/euslisp/eusgazebo-util.l\\") (load \\"package://euslisp/jskeus/eus/models/%s\\") (irteus2urdf-for-gazebo (%s) :urdf-dir \\"%s\\") (exit))"' % (eusmodel_file_name, eusmodel_function_name, urdfmodel_dir_path))
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-eusobject (%s) \\"%s\\") (exit))"' % (eusmodel_file_name, eusmodel_function_name, urdfmodel_dir_path+eusmodel_function_name+"/model.scene"))
00024
00025 if __name__ == '__main__':
00026 convert_all_eusmodel()