Rotate covariance ellipses correctly (plotPose2 stolen from ASPN)
parent
647b38c758
commit
9a8e083697
|
@ -34,6 +34,6 @@ marginals = graph.marginals(result);
|
||||||
for i=1:result.size()-1
|
for i=1:result.size()-1
|
||||||
pose_i = result.pose(i);
|
pose_i = result.pose(i);
|
||||||
P{i}=marginals.marginalCovariance(i);
|
P{i}=marginals.marginalCovariance(i);
|
||||||
covarianceEllipse([pose_i.x;pose_i.y],P{i},'b')
|
plotPose2(pose_i,'b',P{i})
|
||||||
end
|
end
|
||||||
fprintf(1,'%.5f %.5f %.5f\n',P{99})
|
fprintf(1,'%.5f %.5f %.5f\n',P{99})
|
|
@ -0,0 +1,11 @@
|
||||||
|
function plotPose2(p,color,P)
|
||||||
|
% plotPose2: show a Pose2, possibly with covariance matrix
|
||||||
|
plot(p.x,p.y,[color '.']);
|
||||||
|
c = cos(p.theta);
|
||||||
|
s = sin(p.theta);
|
||||||
|
quiver(p.x,p.y,c,s,0.1,color);
|
||||||
|
if nargin>2
|
||||||
|
pPp = P(1:2,1:2); % covariance matrix in pose coordinate frame
|
||||||
|
gRp = [c -s;s c]; % rotation from pose to global
|
||||||
|
covarianceEllipse([p.x;p.y],gRp*pPp*gRp',color);
|
||||||
|
end
|
Loading…
Reference in New Issue