45 from numpy
import reshape, array, zeros, matrix, diag, real
47 import roslib; roslib.load_manifest(
'calibration_estimation')
59 if cur_config[
"sensor_id"]
in [ x.laser_id
for x
in M_robot.M_laser ] :
60 M_laser = [x
for x
in M_robot.M_laser
if cur_config[
"sensor_id"] == x.laser_id][0]
62 sensors.append(cur_sensor)
64 rospy.logdebug(
" Didn't find block")
78 self._tilting_laser.update_config(robot_params)
83 assert(z_mat.shape[0] == 4)
84 assert(h_mat.shape[0] == 4)
85 assert(z_mat.shape[1] == z_mat.shape[1])
86 r = array(reshape(h_mat[0:3,:].T - z_mat[0:3,:].T, [-1,1]))[:,0]
92 r_scaled = gamma_sqrt * matrix(r).T
93 return array(r_scaled.T)[0]
99 gamma = matrix(zeros(cov.shape))
102 for k
in range(num_pts):
105 sub_cov = matrix(cov[first:last, first:last])
106 sub_gamma_sqrt_full = matrix(scipy.linalg.sqrtm(sub_cov.I))
107 sub_gamma_sqrt = real(sub_gamma_sqrt_full)
108 assert(scipy.linalg.norm(sub_gamma_sqrt_full - sub_gamma_sqrt) < 1e-6)
109 gamma[first:last, first:last] = sub_gamma_sqrt
113 N = len(self._M_laser.joint_points)
120 laser_pts_root = self._tilting_laser.project_to_3D([x.position
for x
in self._M_laser.joint_points])
121 return laser_pts_root
133 x = [copy.copy(x.position)
for x
in self._M_laser.joint_points]
135 f0 = reshape(array(self._tilting_laser.project_to_3D(x)[0:3,:].T), [-1])
137 x = [ [y
for y
in x.position]
for x
in self._M_laser.joint_points]
140 fTest = reshape(array(self._tilting_laser.project_to_3D(x)[0:3,:].T), [-1])
141 Jt[i] = (fTest - f0)/epsilon
144 std_dev_sensor = [self._tilting_laser._cov_dict[
'tilt'],
145 self._tilting_laser._cov_dict[
'bearing'],
146 self._tilting_laser._cov_dict[
'range']]
147 cov_sensor = [x*x
for x
in std_dev_sensor]
149 cov = matrix(Jt).T * matrix(diag(cov_sensor)) * matrix(Jt)
161 sparsity[
'tilting_lasers'] = {}
162 sparsity[
'tilting_lasers'][self.
sensor_id] = {
'gearing':1}
163 sparsity[
'transforms'] = {}
164 for cur_transform
in ( self._tilting_laser._before_chain_Ts + \
165 self._tilting_laser._after_chain_Ts ):
166 sparsity[
'transforms'][cur_transform._name] = [1, 1, 1, 1, 1, 1]
167 sparsity[
'transforms'][self._tilting_laser._config[
'joint']] = [1, 1, 1, 1, 1, 1]
def update_config(self, robot_params)
def compute_residual(self, target_pts)
def compute_marginal_gamma_sqrt(self, target_pts)
def build_sparsity_dict(self)
def compute_residual_scaled(self, target_pts)
def get_residual_length(self)
def compute_expected(self, target_pts)
def get_measurement(self)
def __init__(self, valid_configs)
def build_blocks(self, M_robot)
def __init__(self, config_dict, M_laser)
def compute_cov(self, target_pts)