configuration.py
Go to the documentation of this file.
00001 #
00002 # Copyright (c) 2010, Georgia Tech Research Corporation
00003 # All rights reserved.
00004 #
00005 # Redistribution and use in source and binary forms, with or without
00006 # modification, are permitted provided that the following conditions are met:
00007 #     * Redistributions of source code must retain the above copyright
00008 #       notice, this list of conditions and the following disclaimer.
00009 #     * Redistributions in binary form must reproduce the above copyright
00010 #       notice, this list of conditions and the following disclaimer in the
00011 #       documentation and/or other materials provided with the distribution.
00012 #     * Neither the name of the Georgia Tech Research Corporation nor the
00013 #       names of its contributors may be used to endorse or promote products
00014 #       derived from this software without specific prior written permission.
00015 #
00016 # THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
00017 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00018 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 # DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
00020 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00021 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
00022 # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00023 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
00024 # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00025 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 #
00027 
00028 #  \author Martin Schuster (Healthcare Robotics Lab, Georgia Tech.)
00029 
00030 
00031 import numpy as np,math
00032 
00033 
00034 class configuration(object):
00035     '''
00036     classdocs
00037     '''
00038 
00039 
00040     def __init__(self, path = '../data/', device = 'desktopScanner'):
00041         
00042         '''
00043         set default values
00044         '''
00045         self.path = path
00046         self.pointcloud_max_dist = 5.0
00047         self.pointcloud_min_dist = 0.1    
00048         
00049         self.device = device
00050         
00051         if device == 'desktopScanner':
00052             import webcam_config as cc
00053             self.webcam_id = 1
00054             
00055             #most code from travis scanr-class:
00056             # Initialize webcam
00057             self.cam_name = 'DesktopWebcam'
00058             cp = cc.webcam_parameters[self.cam_name]
00059             fx = cp['focal_length_x_in_pixels']
00060             fy = cp['focal_length_y_in_pixels']
00061             self.cam_proj_mat =  np.matrix([[fx, 0, 0,   0],
00062                                             [0, fy, 0,   0],
00063                                             [0,  0, 1,   0]])
00064     
00065             self.cam_centers = ( cp['optical_center_x_in_pixels'], cp['optical_center_y_in_pixels'] )
00066     
00067             # cam_vec came from a previous laser_cam_callibration
00068             #self.cam_vec = np.array([0.8, 0.9, -1.7, 3.1, 0.061, 0.032, -0.035 ])
00069             #self.cam_vec = np.array([1.2000,    1.2000 ,  -1.4000  ,  3.6000  ,  0.0600   , 0.0330   ,-0.0200])
00070             #self.cam_vec = np.array([0.9000  ,  0.8000 ,  -2.2000 ,   3.1000 ,   0.0620 ,   0.0320,   -0.0270 ])
00071             self.cam_vec = np.array([  1.8000  ,  1.7000  , -2.6000 ,   4.7500 ,   0.0620  ,  0.0320  , -0.0270  ])             
00072             
00073             #self.cam_vec = np.array([ 0.0  , 0.0  , 0.0 ,   0.0 ,   0.0 ,  0.0  , 0.0  ])                        
00074                        
00075             self.cam_deltas = np.array([0.1, 0.1, 0.1, 0.1, 0.001, 0.001, 0.001 ])
00076             self.cam_names = ['Ry_0', 'Rz_0', 'Rx_-90', 'Rz_-90', 'dx', 'dy', 'dz']
00077             import scanr_transforms as trs
00078             self.camTlaser = trs.camTlaser(self.cam_vec)
00079             
00080             
00081             self.scanner_metal_plate_offset = 0.05 #TODO
00082     
00083             # Initialize THOK
00084             self.thok_l1 = 0
00085             self.thok_l2 = 0.035
00086             self.thok_tilt_angles = (math.radians(40.0),math.radians(-40.0))
00087             self.thok_devname = '/dev/robot/desktopServos'
00088             self.thok_servonum = 19
00089             self.thok_hoknum = 0
00090             self.thok_scan_speed = math.radians(5.0)
00091             
00092         elif device == 'codyRobot':
00093             import hrl_camera.camera_config as cc
00094             
00095             self.webcam_id = 0
00096             
00097             #values from equilibrium_point_control/lpi.py
00098             self.cam_name = 'mekabotUTM'
00099             cp = cc.camera_parameters[self.cam_name]
00100             fx = cp['focal_length_x_in_pixels']
00101             fy = cp['focal_length_y_in_pixels']
00102             
00103             self.cam_proj_mat =  np.matrix([[fx, 0, 0,   0],
00104                                             [0, fy, 0,   0],
00105                                             [0,  0, 1,   0]])
00106             self.cam_centers = ( cp['optical_center_x_in_pixels'], cp['optical_center_y_in_pixels'] )
00107     
00108 
00109             #self.camTlaser = mcf.utmcam0Tglobal(mcf.globalTthok0(m),self.image_angle)
00110             
00111             
00112             # Initialize THOK
00113             self.thok_l1 = 0
00114             self.thok_l2 = -0.055
00115             self.thok_tilt_angles = (math.radians(40.0),math.radians(-40.0))
00116             self.thok_devname = '/dev/robot/servo0'
00117             self.thok_servonum = 5
00118             self.thok_hoknum = 0
00119             self.thok_scan_speed = math.radians(10.0) #speed=10 in lpi
00120             
00121         elif device == 'dummyScanner': #just for testing/demonstration without dependencies outside of gt-ros-pkgk
00122             self.webcam_id = 0
00123             
00124             #values from equilibrium_point_control/lpi.py
00125             self.cam_name = 'dummyUTM'
00126             import opencv as cv
00127             #values copied from Cody
00128             cp =     {'calibration_image_width' : 640.0,
00129             'calibration_image_height' : 480.0, 
00130             'focal_length_x_in_pixels' : 362.381,
00131             'focal_length_y_in_pixels' : 362.260,
00132             'optical_center_x_in_pixels' : 275.630,
00133             'optical_center_y_in_pixels' : 267.914,
00134             'lens_distortion_radial_1' :    -0.270544,
00135             'lens_distortion_radial_2' :    0.0530850,
00136             'lens_distortion_tangential_1' : 0,
00137             'lens_distortion_tangential_2' : 0,
00138             'opencv_bayer_pattern' :  cv.CV_BayerBG2BGR,
00139             'color': True,
00140             'uid': 8520228
00141             }
00142             fx = cp['focal_length_x_in_pixels']
00143             fy = cp['focal_length_y_in_pixels']
00144             
00145             self.cam_proj_mat =  np.matrix([[fx, 0, 0,   0],
00146                                             [0, fy, 0,   0],
00147                                             [0,  0, 1,   0]])
00148             self.cam_centers = ( cp['optical_center_x_in_pixels'], cp['optical_center_y_in_pixels'] )
00149     
00150 
00151             #self.camTlaser = mcf.utmcam0Tglobal(mcf.globalTthok0(m),self.image_angle)
00152             
00153             
00154             # Initialize THOK
00155             self.thok_l1 = 0
00156             self.thok_l2 = -0.055
00157             self.thok_tilt_angles = (math.radians(40.0),math.radians(-40.0))
00158             self.thok_devname = '/dev/robot/servo0'
00159             self.thok_servonum = 5
00160             self.thok_hoknum = 0
00161             self.thok_scan_speed = math.radians(10.0) #speed=10 in lpi
00162 
00163         else:
00164             print 'ERROR: unknown device',device


laser_camera_segmentation
Author(s): Martin Schuster, Advisor: Prof. Charlie Kemp, Lab: Healthcare Robotics Lab at Georgia Tech
autogenerated on Wed Nov 27 2013 11:56:44