adjust_rviz_config.py
Go to the documentation of this file.
00001 #!/usr/bin/python
00002 import sys
00003 
00004 if len(sys.argv) < 7:
00005     print "usage: adjust_rviz_config.py in_file out_file stereo nav nav_local sim (where stereo, nav, nav_local, and sim are true or false)"
00006     sys.exit(1)
00007 stereo = sys.argv[3]
00008 nav = sys.argv[4]
00009 nav_local = sys.argv[5]
00010 sim = sys.argv[6]
00011 if stereo not in ['true', 'false']:
00012     print "stereo was not true or false!  usage: adjust_rviz_config.py in_file out_file stereo nav nav_local sim (where stereo, nav, nav_local, and sim are true or false)"
00013     sys.exit(1)
00014 if nav not in ['true', 'false']:
00015     print "nav was not true or false!  usage: adjust_rviz_config.py in_file out_file stereo nav nav_local sim (where stereo, nav, nav_local, and sim are true or false)"
00016     sys.exit(1)
00017 if nav_local not in ['true', 'false']:
00018     print "nav was not true or false!  usage: adjust_rviz_config.py in_file out_file stereo nav nav_local sim (where stereo, nav, nav_local, and sim are true or false)"
00019     sys.exit(1)
00020 if sim not in ['true', 'false']:
00021     print "nav was not true or false!  usage: adjust_rviz_config.py in_file out_file stereo nav nav_local sim (where stereo, nav, nav_local, and sim are true or false)"
00022     sys.exit(1)
00023 
00024 
00025 lines = file(sys.argv[1]).readlines()
00026 outfile = file( sys.argv[2], 'w')
00027 
00028 outfile.write('### THIS FILE AUTO-GENERATED FROM config/pr2_interactive_manipulation_base.vcg\n')
00029 outfile.write('### IT IS SUGGESTED YOU DO NOT MODIFY THIS FILE.\n')
00030 for line in lines:
00031     if line[:13] == 'Fixed\ Frame=':
00032         if nav == 'true' and not nav_local == 'true':
00033             outfile.write('Fixed\ Frame=/map\n')
00034         else:
00035             outfile.write('Fixed\ Frame=/odom_combined\n')
00036     elif 'Map.Enabled=' in line:
00037         if nav == 'true' and not nav_local == 'true':
00038             outfile.write('Map.Enabled=1\n')
00039         else:
00040             outfile.write('Map.Enabled=0\n')
00041     elif 'Nav\ Global\ Path.Enabled=' in line:
00042         if nav == 'true':
00043             outfile.write('Nav\ Global\ Path.Enabled=1\n')
00044         else:
00045             outfile.write('Nav\ Global\ Path.Enabled=0\n')
00046     elif 'Nav\ Obstacles.Enabled=' in line:
00047         if nav == 'true':
00048             outfile.write('Nav\ Obstacles.Enabled=1\n')
00049         else:
00050             outfile.write('Nav\ Obstacles.Enabled=0\n')
00051     elif 'Nav\ Obstacles.Topic=' in line:
00052         if nav_local == 'true':
00053             outfile.write('Nav\ Obstacles.Topic=/move_base_local_node/local_costmap/obstacles\n')
00054         else:
00055             outfile.write('Nav\ Obstacles.Topic=/move_base_node/local_costmap/obstacles\n')
00056     elif 'Nav\ Global\ Path.Topic=' in line:
00057         if nav_local == 'true':
00058             outfile.write('Nav\ Global\ Path.Topic=/move_base_local_node/NavfnROS/plan\n')
00059         else:
00060             outfile.write('Nav\ Global\ Path.Topic=/move_base_node/NavfnROS/plan\n')
00061     else:
00062         outfile.write(line)
00063 outfile.close()


pr2_interactive_manipulation
Author(s): Matei Ciocarlie, Kaijen Hsiao, Adam Leeper
autogenerated on Fri Jan 3 2014 12:08:58