62 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Matlab
		
	
	
			
		
		
	
	
			62 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Matlab
		
	
	
| % create a linear factor graph
 | |
| % The non-linear graph above evaluated at NoisyConfig
 | |
| function fg = createGaussianFactorGraph()
 | |
| 
 | |
| c = createNoisyConfig();
 | |
| 
 | |
| % Create
 | |
| fg = GaussianFactorGraph;
 | |
| sigma1=.1;
 | |
| 
 | |
| % prior on x1
 | |
| A11=eye(2);
 | |
| b = - c.get('x1');
 | |
| 
 | |
| <<<<<<< .mine
 | |
| f1 = LinearFactor('x1', A11, b, sigma1);
 | |
| =======
 | |
| f1 = GaussianFactor('x1', A11, b);
 | |
| >>>>>>> .r1017
 | |
| fg.push_back(f1);
 | |
| 
 | |
| % odometry between x1 and x2
 | |
| sigma2=.1;
 | |
| 
 | |
| <<<<<<< .mine
 | |
| A21=-eye(2);
 | |
| A22=eye(2);
 | |
| b = [.2;-.1];
 | |
| 
 | |
| f2 = LinearFactor('x1', A21,  'x2', A22, b,sigma2);
 | |
| =======
 | |
| f2 = GaussianFactor('x1', A21,  'x2', A22, b);
 | |
| >>>>>>> .r1017
 | |
| fg.push_back(f2);
 | |
| 
 | |
| % measurement between x1 and l1
 | |
| sigma3=.2;
 | |
| A31=-eye(2);
 | |
| A33=eye(2);
 | |
| b = [0;.2];
 | |
| 
 | |
| <<<<<<< .mine
 | |
| f3 = LinearFactor('x1', A31, 'l1', A33, b,sigma3);
 | |
| =======
 | |
| f3 = GaussianFactor('x1', A31, 'l1', A32, b);
 | |
| >>>>>>> .r1017
 | |
| fg.push_back(f3);
 | |
| 
 | |
| % measurement between x2 and l1
 | |
| sigma4=.2;
 | |
| A42=-eye(2);
 | |
| A43=eye(2);
 | |
| b = [-.2;.3];
 | |
| 
 | |
| <<<<<<< .mine
 | |
| f4 = LinearFactor('x2', A42, 'l1', A43, b,sigma4);
 | |
| =======
 | |
| f4 = GaussianFactor('x2', A41, 'l1', A42, b);
 | |
| >>>>>>> .r1017
 | |
| fg.push_back(f4);
 | |
| 
 | |
| end |