00001 #!/usr/bin/python 00002 # 00003 # Copyright (c) 2010, Georgia Tech Research Corporation 00004 # All rights reserved. 00005 # 00006 # Redistribution and use in source and binary forms, with or without 00007 # modification, are permitted provided that the following conditions are met: 00008 # * Redistributions of source code must retain the above copyright 00009 # notice, this list of conditions and the following disclaimer. 00010 # * Redistributions in binary form must reproduce the above copyright 00011 # notice, this list of conditions and the following disclaimer in the 00012 # documentation and/or other materials provided with the distribution. 00013 # * Neither the name of the Georgia Tech Research Corporation nor the 00014 # names of its contributors may be used to endorse or promote products 00015 # derived from this software without specific prior written permission. 00016 # 00017 # THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND 00018 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00019 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00020 # DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT, 00021 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00022 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 00023 # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00024 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 00025 # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 00026 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 # 00028 00029 # \author Martin Schuster (Healthcare Robotics Lab, Georgia Tech.) 00030 import roslib; roslib.load_manifest('laser_camera_segmentation') 00031 00032 print 'TEST CROSSVALIDATION script!!!' 00033 00034 # Import Psyco if available 00035 try: 00036 import psyco 00037 psyco.full() 00038 print "Psyco loaded" 00039 except ImportError: 00040 pass 00041 00042 import time 00043 def getTime(): 00044 return '['+time.strftime("%H:%M:%S", time.localtime())+']' 00045 00046 import subprocess 00047 00048 print getTime(), 'start' 00049 00050 import laser_camera_segmentation.processor as processor 00051 import laser_camera_segmentation.configuration as configuration 00052 00053 cfg = configuration.configuration('/home/martin/robot1_data/usr/martin/laser_camera_segmentation/labeling') 00054 pc = processor.processor(cfg) 00055 00056 #pc.calculate_and_save_ground_and_table_transformations_for_all_scans(use_RANSAC_table_plane = False) 00057 00058 pc.generate_save_features(True, True) 00059 00060 00061 folds = 40 00062 for current_fold in range(folds): #test_crossvalidation_fold.py 00063 #output = subprocess.Popen(["python", 'test_crossvalidation_fold.py',str(current_fold)], stdout=subprocess.PIPE, env={"ROS_PACKAGE_PATH":"/home/martin/ros/pkgs:/home/martin/gt-ros-pkg/hrl:/home/martin/robot1/src:/home/martin/gt-ros-pkg/hrl:/home/martin/robot1/src:/home/martin/gt-ros-pkg/hrl:/home/martin/robot1/src", "ROS_ROOT":"/home/martin/ros/ros", "PYTHONPATH": "/home/martin/robot1/src/libraries:/home/martin/robot1/src/libraries/katana:/home/martin/robot1/src/libraries:/home/martin/robot1/src/libraries/katana:/home/martin/robot1/src/libraries:/home/martin/robot1/src/libraries/katana:/home/martin/ros/ros/core/roslib/src:/home/martin/robot1/src/libraries:/home/martin/robot1/src/libraries/katana:/usr/local/lib/python2.5/site-packages/m3rt/:/home/martin/gt-ros-pkg/hrl/segway_omni/src:/home/martin/gt-ros-pkg/hrl/hrl_opencv/src:/home/martin/gt-ros-pkg/hrl/force_torque/src:/home/martin/gt-ros-pkg/hrl/hrl_lib/src:/home/martin/gt-ros-pkg/hrl/zenither/src:/home/martin/gt-ros-pkg/hrl/robotis/src:/usr/local/lib/python2.5/site-packages/m3rt/:/home/martin/gt-ros-pkg/hrl/segway_omni/src:/home/martin/gt-ros-pkg/hrl/hrl_opencv/src:/home/martin/gt-ros-pkg/hrl/force_torque/src:/home/martin/gt-ros-pkg/hrl/hrl_lib/src:/home/martin/gt-ros-pkg/hrl/zenither/src:/home/martin/gt-ros-pkg/hrl/robotis/src:/usr/local/lib/python2.5/site-packages/m3rt/:/home/martin/gt-ros-pkg/hrl/segway_omni/src:/home/martin/gt-ros-pkg/hrl/hrl_opencv/src:/home/martin/gt-ros-pkg/hrl/force_torque/src:/home/martin/gt-ros-pkg/hrl/hrl_lib/src:/home/martin/gt-ros-pkg/hrl/zenither/src:/home/martin/gt-ros-pkg/hrl/robotis/src"}).communicate()[0] 00064 output = subprocess.Popen(["python", 'test_crossvalidation_fold.py',str(current_fold)]).communicate()[0] 00065 #print getTime(), output 00066 00067 #todo: parallel: don't use communicate() but just create 3 processes with Popen and then wait for them with wait() 00068 00069 00070 00071 pc.collect_and_save_testresults_crossvalidation(folds) 00072 00073 00074 00075 00076 print getTime(), 'done'