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 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
00056
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
00068
00069
00070
00071 self.cam_vec = np.array([ 1.8000 , 1.7000 , -2.6000 , 4.7500 , 0.0620 , 0.0320 , -0.0270 ])
00072
00073
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
00082
00083
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
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
00110
00111
00112
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)
00120
00121 elif device == 'dummyScanner':
00122 self.webcam_id = 0
00123
00124
00125 self.cam_name = 'dummyUTM'
00126 import opencv as cv
00127
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
00152
00153
00154
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)
00162
00163 else:
00164 print 'ERROR: unknown device',device