Fixed namespace return type bug with pointers in wrap. Matlab tests now pass.
							parent
							
								
									9f1f38ac29
								
							
						
					
					
						commit
						fab5717917
					
				| 
						 | 
				
			
			@ -29,8 +29,9 @@ x1 = 3;
 | 
			
		|||
 | 
			
		||||
% the RHS
 | 
			
		||||
b2=[-1;1.5;2;-1];
 | 
			
		||||
model4 = SharedDiagonal([1;1;1;1]);
 | 
			
		||||
combined = JacobianFactor(x2, Ax2,  l1, Al1, x1, Ax1, b2, model4);
 | 
			
		||||
sigmas = [1;1;1;1];
 | 
			
		||||
model4 = gtsamSharedDiagonal(sigmas);
 | 
			
		||||
combined = gtsamJacobianFactor(x2, Ax2,  l1, Al1, x1, Ax1, b2, model4);
 | 
			
		||||
 | 
			
		||||
% eliminate the first variable (x2) in the combined factor, destructive !
 | 
			
		||||
actualCG = combined.eliminateFirst();
 | 
			
		||||
| 
						 | 
				
			
			@ -49,7 +50,7 @@ S13 = [
 | 
			
		|||
+0.00,-8.94427
 | 
			
		||||
];
 | 
			
		||||
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('actualCG.equals(expectedCG,1e-5)',actualCG.equals(expectedCG,1e-4));
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -68,8 +69,8 @@ Bx1 = [
 | 
			
		|||
% the RHS
 | 
			
		||||
b1= [0.0;0.894427];
 | 
			
		||||
 | 
			
		||||
model2 = SharedDiagonal([1;1]);
 | 
			
		||||
expectedLF = JacobianFactor(l1, Bl1, x1, Bx1, b1, model2);
 | 
			
		||||
model2 = gtsamSharedDiagonal([1;1]);
 | 
			
		||||
expectedLF = gtsamJacobianFactor(l1, Bl1, x1, Bx1, b1, model2);
 | 
			
		||||
 | 
			
		||||
% check if the result matches the combined (reduced) factor
 | 
			
		||||
% FIXME: JacobianFactor/GaussianFactor mismatch
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,13 +22,13 @@
 | 
			
		|||
F = eye(2,2);
 | 
			
		||||
B = eye(2,2);
 | 
			
		||||
u = [1.0; 0.0];
 | 
			
		||||
modelQ = SharedDiagonal([0.1;0.1]);
 | 
			
		||||
modelQ = gtsamSharedDiagonal([0.1;0.1]);
 | 
			
		||||
Q = 0.01*eye(2,2);
 | 
			
		||||
H = eye(2,2);
 | 
			
		||||
z1 = [1.0, 0.0]';
 | 
			
		||||
z2 = [2.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);
 | 
			
		||||
 | 
			
		||||
%% Create the set of expected output TestValues
 | 
			
		||||
| 
						 | 
				
			
			@ -48,7 +48,7 @@ P23 = inv(I22) + Q;
 | 
			
		|||
I33 = inv(P23) + inv(R);
 | 
			
		||||
 | 
			
		||||
%% Create an KalmanFilter object
 | 
			
		||||
KF = KalmanFilter(2);
 | 
			
		||||
KF = gtsamKalmanFilter(2);
 | 
			
		||||
 | 
			
		||||
%% Create the Kalman Filter initialization point
 | 
			
		||||
x_initial = [0.0;0.0];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,17 +59,17 @@ void ReturnValue::wrap_result(FileWriter& file) const {
 | 
			
		|||
 | 
			
		||||
    // second return value in pair
 | 
			
		||||
    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
 | 
			
		||||
    	file.oss << "  out[1] = wrap_shared_ptr(make_shared< " << cppType2 << " >(result.second),\"" << matlabType2 << "\");\n";
 | 
			
		||||
    else
 | 
			
		||||
      file.oss << "  out[1] = wrap< " << return_type(true,arg2) << " >(result.second);\n";
 | 
			
		||||
  }
 | 
			
		||||
  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)
 | 
			
		||||
  	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";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue