$search
00001 #!/usr/bin/python 00002 import sys 00003 00004 if len(sys.argv) < 5: 00005 print "usage: adjust_rviz_config.py in_file out_file stereo nav (where stereo and nav are true or false)" 00006 sys.exit(1) 00007 stereo = sys.argv[3] 00008 nav = sys.argv[4] 00009 if stereo not in ['true', 'false']: 00010 print "stereo was not true or false! usage: adjust_rviz_config.py in_file out_file stereo nav (where stereo and nav are true or false)" 00011 sys.exit(1) 00012 if nav not in ['true', 'false']: 00013 print "nav was not true or false! usage: adjust_rviz_config.py in_file out_file stereo nav (where stereo and nav are true or false)" 00014 sys.exit(1) 00015 00016 import os 00017 home_path = os.environ["HOME"] 00018 lines = file(sys.argv[1]).readlines() 00019 outfile = file( sys.argv[2], 'w') 00020 00021 outfile.write('### THIS FILE AUTO-GENERATED FROM config/pr2_interactive_manipulation_base.vcg\n') 00022 outfile.write('### IT IS SUGGESTED YOU DO NOT MODIFY THIS FILE.\n') 00023 for line in lines: 00024 if line[:13] == 'Fixed\ Frame=': 00025 if nav == 'true': 00026 outfile.write('Fixed\ Frame=/map\n') 00027 else: 00028 outfile.write('Fixed\ Frame=/odom_combined\n') 00029 elif 'Publish\ Click\ Camera\ Display.Image\ Topic' in line: 00030 if stereo == 'true': 00031 outfile.write('Publish\ Click\ Camera\ Display.Image\ Topic=/wide_stereo/left/image_color\n') 00032 else: 00033 outfile.write('Publish\ Click\ Camera\ Display.Image\ Topic=/camera/rgb/image_color\n') 00034 else: 00035 outfile.write(line) 00036 outfile.close()