8 def make_static_model (name, eusurdf_package_path=commands.getoutput(
'rospack find eusurdf'), overwrite=
True):
9 urdf_dir_path = eusurdf_package_path +
'/models/' + name
10 static_urdf_dir_path = urdf_dir_path +
'_static' 11 urdf_path = urdf_dir_path +
'/' +
'model.urdf' 12 static_urdf_path = static_urdf_dir_path +
'/' +
'model.urdf' 15 os.system(
"rm -rf %s" % static_urdf_dir_path)
17 if os.path.exists(static_urdf_dir_path):
18 print '[ERROR] the same name static model already exits' 21 os.system(
"cp -r %s %s" % (urdf_dir_path, static_urdf_dir_path))
23 if len(commands.getoutput(
"grep \"<static>false</static>\" %s" % static_urdf_path)) != 0:
24 os.system(
'sed -i -e \"s@<static>false</static>@<static>true</static>@g\" %s' % static_urdf_path)
25 elif len(commands.getoutput(
"grep \"<static>true</static>\" %s" % static_urdf_path)) == 0:
26 os.system(
'sed -i -e \"s@ <link @ <gazebo>\\n <static>true</static>\\n </gazebo>\\n <link @g\" %s' % static_urdf_path)
29 os.system(
'sed -i -e "s@<robot name=\\"\(.*\)\\"@<robot name=\\"\\1_static\\"@g\" %s' % static_urdf_path)
32 if __name__ ==
'__main__':
35 elif len(sys.argv) > 1:
def make_static_model(name, eusurdf_package_path=commands.getoutput('rospack find eusurdf'), overwrite=True)