$search
00001 #! /usr/bin/env python 00002 # Software License Agreement (BSD License) 00003 # 00004 # Copyright (c) 2008, Willow Garage, Inc. 00005 # All rights reserved. 00006 # 00007 # Redistribution and use in source and binary forms, with or without 00008 # modification, are permitted provided that the following conditions 00009 # are met: 00010 # 00011 # * Redistributions of source code must retain the above copyright 00012 # notice, this list of conditions and the following disclaimer. 00013 # * Redistributions in binary form must reproduce the above 00014 # copyright notice, this list of conditions and the following 00015 # disclaimer in the documentation and/or other materials provided 00016 # with the distribution. 00017 # * Neither the name of Willow Garage, Inc. nor the names of its 00018 # contributors may be used to endorse or promote products derived 00019 # from this software without specific prior written permission. 00020 # 00021 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00024 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00025 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00026 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00027 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00028 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00029 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00030 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00031 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 # POSSIBILITY OF SUCH DAMAGE. 00033 00034 # author: Vijay Pradeep 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 # Load the yaml config of the robot_system 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 # Load the measurement blocks 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 #time.sleep(.1) 00097 00098 00099 sys.exit(1)