00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 import roslib; roslib.load_manifest('pr2_calibration_estimation')
00037
00038 import sys
00039 import rospy
00040 import time
00041 import numpy
00042 import rosrecord
00043 import yaml
00044
00045 import numpy
00046
00047 from pr2_calibration_estimation.robot_params import RobotParams
00048 from pr2_calibration_estimation.blocks import robot_measurement_bundler
00049
00050 def usage():
00051 print "Usage:"
00052 print " ./error_viewer.py [config.yaml] [blocks.yaml] [bagfile]"
00053 sys.exit(-1)
00054
00055 if (len(sys.argv) < 4):
00056 usage()
00057
00058 config_filename = sys.argv[1]
00059 blocks_filename= sys.argv[2]
00060 bag_filename = sys.argv[3]
00061
00062
00063 config_f = open(config_filename)
00064 config = yaml.load(config_f)
00065 config_f.close()
00066 robot_params = RobotParams()
00067 robot_params.configure(config)
00068
00069
00070 blocks_f = open(blocks_filename)
00071 measurement_blocks = yaml.load(blocks_f)
00072 blocks_f.close()
00073 bundler = robot_measurement_bundler.RobotMeasurementBundler(measurement_blocks)
00074
00075 blocks = bundler.load_from_bag(bag_filename)
00076
00077
00078 for block in blocks:
00079 block.update_config(robot_params)
00080
00081 from pr2_calibration_estimation import plot_helper
00082 plot_helper.start()
00083
00084 from matplotlib import pyplot as plt
00085
00086 for block in blocks:
00087 resp = raw_input("> ").upper()
00088 print "Type: %s" % block.block_type
00089 print "ID: %s" % block.block_id
00090 plt.clf()
00091 block.view_error()
00092 plt.axis([0, 640, 0, 480])
00093 print "About to draw"
00094 plt.draw()
00095 print "Done drawing"
00096
00097
00098
00099 sys.exit(1)