apply bug fixes in MATLAB wrapper shared_ptr return from trunk. All tests work now.
parent
71e757d2cf
commit
6f4c95a65b
|
@ -29,8 +29,9 @@ x1 = 3;
|
||||||
|
|
||||||
% the RHS
|
% the RHS
|
||||||
b2=[-1;1.5;2;-1];
|
b2=[-1;1.5;2;-1];
|
||||||
model4 = SharedDiagonal([1;1;1;1]);
|
sigmas = [1;1;1;1];
|
||||||
combined = JacobianFactor(x2, Ax2, l1, Al1, x1, Ax1, b2, model4);
|
model4 = gtsamSharedDiagonal(sigmas);
|
||||||
|
combined = gtsamJacobianFactor(x2, Ax2, l1, Al1, x1, Ax1, b2, model4);
|
||||||
|
|
||||||
% eliminate the first variable (x2) in the combined factor, destructive !
|
% eliminate the first variable (x2) in the combined factor, destructive !
|
||||||
actualCG = combined.eliminateFirst();
|
actualCG = combined.eliminateFirst();
|
||||||
|
@ -49,7 +50,7 @@ S13 = [
|
||||||
+0.00,-8.94427
|
+0.00,-8.94427
|
||||||
];
|
];
|
||||||
d=[2.23607;-1.56525];
|
d=[2.23607;-1.56525];
|
||||||
expectedCG = GaussianConditional(x2,d,R11,l1,S12,x1,S13,[1;1]);
|
expectedCG = gtsamGaussianConditional(x2,d,R11,l1,S12,x1,S13,[1;1]);
|
||||||
% check if the result matches
|
% check if the result matches
|
||||||
CHECK('actualCG.equals(expectedCG,1e-5)',actualCG.equals(expectedCG,1e-4));
|
CHECK('actualCG.equals(expectedCG,1e-5)',actualCG.equals(expectedCG,1e-4));
|
||||||
|
|
||||||
|
@ -68,8 +69,8 @@ Bx1 = [
|
||||||
% the RHS
|
% the RHS
|
||||||
b1= [0.0;0.894427];
|
b1= [0.0;0.894427];
|
||||||
|
|
||||||
model2 = SharedDiagonal([1;1]);
|
model2 = gtsamSharedDiagonal([1;1]);
|
||||||
expectedLF = JacobianFactor(l1, Bl1, x1, Bx1, b1, model2);
|
expectedLF = gtsamJacobianFactor(l1, Bl1, x1, Bx1, b1, model2);
|
||||||
|
|
||||||
% check if the result matches the combined (reduced) factor
|
% check if the result matches the combined (reduced) factor
|
||||||
% FIXME: JacobianFactor/GaussianFactor mismatch
|
% FIXME: JacobianFactor/GaussianFactor mismatch
|
||||||
|
|
|
@ -22,13 +22,13 @@
|
||||||
F = eye(2,2);
|
F = eye(2,2);
|
||||||
B = eye(2,2);
|
B = eye(2,2);
|
||||||
u = [1.0; 0.0];
|
u = [1.0; 0.0];
|
||||||
modelQ = SharedDiagonal([0.1;0.1]);
|
modelQ = gtsamSharedDiagonal([0.1;0.1]);
|
||||||
Q = 0.01*eye(2,2);
|
Q = 0.01*eye(2,2);
|
||||||
H = eye(2,2);
|
H = eye(2,2);
|
||||||
z1 = [1.0, 0.0]';
|
z1 = [1.0, 0.0]';
|
||||||
z2 = [2.0, 0.0]';
|
z2 = [2.0, 0.0]';
|
||||||
z3 = [3.0, 0.0]';
|
z3 = [3.0, 0.0]';
|
||||||
modelR = SharedDiagonal([0.1;0.1]);
|
modelR = gtsamSharedDiagonal([0.1;0.1]);
|
||||||
R = 0.01*eye(2,2);
|
R = 0.01*eye(2,2);
|
||||||
|
|
||||||
%% Create the set of expected output TestValues
|
%% Create the set of expected output TestValues
|
||||||
|
@ -48,7 +48,7 @@ P23 = inv(I22) + Q;
|
||||||
I33 = inv(P23) + inv(R);
|
I33 = inv(P23) + inv(R);
|
||||||
|
|
||||||
%% Create an KalmanFilter object
|
%% Create an KalmanFilter object
|
||||||
KF = KalmanFilter(2);
|
KF = gtsamKalmanFilter(2);
|
||||||
|
|
||||||
%% Create the Kalman Filter initialization point
|
%% Create the Kalman Filter initialization point
|
||||||
x_initial = [0.0;0.0];
|
x_initial = [0.0;0.0];
|
||||||
|
|
|
@ -59,17 +59,17 @@ void ReturnValue::wrap_result(FileWriter& file) const {
|
||||||
|
|
||||||
// second return value in pair
|
// second return value in pair
|
||||||
if (isPtr2) // if we already have a pointer
|
if (isPtr2) // if we already have a pointer
|
||||||
file.oss << " out[1] = wrap_shared_ptr(result.second,\"" << type2 << "\");\n";
|
file.oss << " out[1] = wrap_shared_ptr(result.second,\"" << matlabType2 << "\");\n";
|
||||||
else if (category2 == ReturnValue::CLASS) // if we are going to make one
|
else if (category2 == ReturnValue::CLASS) // if we are going to make one
|
||||||
file.oss << " out[1] = wrap_shared_ptr(make_shared< " << cppType2 << " >(result.second),\"" << matlabType2 << "\");\n";
|
file.oss << " out[1] = wrap_shared_ptr(make_shared< " << cppType2 << " >(result.second),\"" << matlabType2 << "\");\n";
|
||||||
else
|
else
|
||||||
file.oss << " out[1] = wrap< " << return_type(true,arg2) << " >(result.second);\n";
|
file.oss << " out[1] = wrap< " << return_type(true,arg2) << " >(result.second);\n";
|
||||||
}
|
}
|
||||||
else if (isPtr1)
|
else if (isPtr1)
|
||||||
file.oss << " out[0] = wrap_shared_ptr(result,\"" << type1 << "\");\n";
|
file.oss << " out[0] = wrap_shared_ptr(result,\"" << matlabType1 << "\");\n";
|
||||||
else if (category1 == ReturnValue::CLASS)
|
else if (category1 == ReturnValue::CLASS)
|
||||||
file.oss << " out[0] = wrap_shared_ptr(make_shared< " << cppType1 << " >(result),\"" << matlabType1 << "\");\n";
|
file.oss << " out[0] = wrap_shared_ptr(make_shared< " << cppType1 << " >(result),\"" << matlabType1 << "\");\n";
|
||||||
else if (type1!="void")
|
else if (matlabType1!="void")
|
||||||
file.oss << " out[0] = wrap< " << return_type(true,arg1) << " >(result);\n";
|
file.oss << " out[0] = wrap< " << return_type(true,arg1) << " >(result);\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue