small improvements to plotting coordinate frames
parent
f34ae951fc
commit
647b38c758
|
@ -39,11 +39,11 @@ initial.insertPose(5, hexagon.pose(5).retract(s*randn(6,1)));
|
|||
|
||||
%% Plot Initial Estimate
|
||||
figure(1);clf
|
||||
plot3(initial.xs(),initial.ys(),initial.zs(),'g-*'); axis equal
|
||||
plot3(initial.xs(),initial.ys(),initial.zs(),'g-*');
|
||||
|
||||
%% optimize
|
||||
result = fg.optimize(initial);
|
||||
|
||||
%% Show Result
|
||||
hold on; plot3(result.xs(),result.ys(),result.zs(),'b-*')
|
||||
hold on; plot3DTrajectory(result,'b-*', true, 0.3); axis equal;
|
||||
result.print(sprintf('\nFinal result:\n'));
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
function plot3DTrajectory(values,style,frames)
|
||||
function plot3DTrajectory(values,style,frames,scale)
|
||||
% plot3DTrajectory
|
||||
if nargin<3,frames=false;end
|
||||
if nargin<4,scale=0;end
|
||||
|
||||
plot3(values.xs(),values.ys(),values.zs(),style); hold on
|
||||
if frames
|
||||
N=values.size;
|
||||
for i=0:N-1
|
||||
pose = values.pose(i);
|
||||
t = pose.translation;
|
||||
R = pose.rotation.matrix;
|
||||
quiver3(t.x,t.y,t.z,R(1,1),R(2,1),R(3,1),'r');
|
||||
quiver3(t.x,t.y,t.z,R(1,2),R(2,2),R(3,2),'g');
|
||||
quiver3(t.x,t.y,t.z,R(1,3),R(2,3),R(3,3),'b');
|
||||
quiver3(t.x,t.y,t.z,R(1,1),R(2,1),R(3,1),scale,'r');
|
||||
quiver3(t.x,t.y,t.z,R(1,2),R(2,2),R(3,2),scale,'g');
|
||||
quiver3(t.x,t.y,t.z,R(1,3),R(2,3),R(3,3),scale,'b');
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue