simplified, sync with manual

release/4.3a0
Frank Dellaert 2012-06-05 04:01:37 +00:00
parent 9560997bc7
commit fe1a9997cf
1 changed files with 5 additions and 6 deletions

View File

@ -16,18 +16,17 @@ N = 2500;
filename = '../Data/sphere2500.txt'; filename = '../Data/sphere2500.txt';
%% Initialize graph, initial estimate, and odometry noise %% Initialize graph, initial estimate, and odometry noise
model = gtsamSharedNoiseModel_Sigmas([0.05; 0.05; 0.05; 5*pi/180; 5*pi/180; 5*pi/180]);
[graph,initial]=load3D(filename,model,true,N); [graph,initial]=load3D(filename,model,true,N);
first = initial.pose(0); model = gtsamSharedNoiseModel_Sigmas([0.05; 0.05; 0.05; 5*pi/180; 5*pi/180; 5*pi/180]);
graph.addHardConstraint(0, first);
%% Plot Initial Estimate %% Plot Initial Estimate
figure(1);clf figure(1);clf
first = initial.pose(0);
plot3(first.x(),first.y(),first.z(),'r*'); hold on plot3(first.x(),first.y(),first.z(),'r*'); hold on
plot3DTrajectory(initial,'g-',false); plot3DTrajectory(initial,'g-',false);
%% Read again, now all constraints %% Read again, now with all constraints, and optimize
[graph,discard]=load3D(filename,model,false,N); graph = load3D(filename,model,false,N);
graph.addHardConstraint(0, first); graph.addHardConstraint(0, first);
result = graph.optimize(initial); % start from old result result = graph.optimize(initial);
plot3DTrajectory(result,'r-',false); axis equal; plot3DTrajectory(result,'r-',false); axis equal;