poseGraph: Why is the node trajectory graph obtained by poseGraph not the same as the relative rigidtform2d() calculate result?
이전 댓글 표시
When I try to add relative pose "measurement" to the "poseGraph" object one by one using "addRelativePose", there is a big difference between the absolute pose position coordinates before the global optimized pose and the actual calculated pose position, what is the problem?
In the following procedure I have given a series of values for the relative attitude "measurement" (see attachment) and compared the results with the calculation program.
%% construct poseGraph
load measurements.mat
pg = poseGraph();
calAbsPose = rigidtform2d();
absPoseCum = [];
numsNodes = numel(relPoses);
for i = 1:numsNodes
currRelPose = relPoses(i);
measurement = [currRelPose.A(1,3),currRelPose.A(2,3),deg2rad(currRelPose.RotationAngle)];% Relative measurement pose, [x,y,theta] format
addRelativePose(pg,measurement);
calAbsPose = rigidtform2d(currRelPose.A*calAbsPose.A);% Calculated absolute pose
absPoseCum = [absPoseCum;calAbsPose];
end
%% plot trajectory result
figure;pg.show();title("poseGraph node trajectory")
traj = [];
for i = 1:numel(absPoseCum)
A = absPoseCum(i).A;
traj = [traj;A(1,3),A(2,3)];
end
figure;plot(traj(:,1),traj(:,2),'k-');axis equal;grid on;
title("calculate trajectory")
As you can see from these 2 drawings, the shapes are similar but the coordinates are vastly different, which is the right case and how to fix it, your answer would be greatly appreciate!
채택된 답변
추가 답변 (1개)
Akshai Manchana
2024년 3월 11일
Hi Cui,
One more small issue in the specified fix is the following.
% (From the above fix)
currAbsPose = rigidtform2d(currRelPose.A*preAbsPose.A);
% The actual expectation from pose graph and factor graph
currAbsPose = rigidtform2d(preAbsPose.A*currRelPose.A);
Also newer pose representation objects se2 and se3 can help in converting between pose vector, rigid formats.
(From the above fix)
relR = preAbsPose.R'*currAbsPose.R; % https://ww2.mathworks.cn/matlabcentral/answers/1720045-how-to-get-the-relative-camera-pose-to-another-camera-pose
relT = preAbsPose.R'*(currAbsPose.Translation'-preAbsPose.Translation');
eul = rotm2eul(blkdiag(relR,1));
measurement = [relT(1),relT(2),eul(1)];% Relative measurement pose, [x,y,theta] format,theta is in radians.
This can achieved better using the following.
measurement = se2(preAbsPose.invert().A*currAbsPose.A).xytheta;
currPose = se2(preAbsPose.A*currRelPose.A).xytheta;
Thanks & Regards
Akshai Manchana
카테고리
도움말 센터 및 File Exchange에서 Localization Algorithms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!









