poseGraph: Why is the node trajectory graph obtained by poseGraph not the same as the relative rigidtform2d() calculate result?

1 回表示 (過去 30 日間)
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!

採用された回答

cui,xingxing
cui,xingxing 2022 年 12 月 5 日
編集済み: cui,xingxing 2024 年 4 月 27 日
After careful analysis, I found the problem. The second input parameter of the addRelativePose function, "measurement", can easily be misinterpreted as a relative value in the global world coordinate system, but in fact it is a relative observed value relative to the current ego, as shown in the following diagram, with the pentagram being the observed target and theta being the observed angle (note that theta is in radians).
%% poseGraph 姿态轨迹图问题
load measurements.mat
pg = poseGraph();
preAbsPose = rigidtform2d();
absPoseCum = [];
numsNodes = numel(relPoses);
for i = 1:numsNodes
currRelPose = relPoses(i);% note:这里的相对姿态数值单位是指参考的基准是世界坐标系(一般不变)
currAbsPose = rigidtform2d(currRelPose.A*preAbsPose.A);% Calculated absolute pose
absPoseCum = [absPoseCum;preAbsPose];
% measurement = [currRelPose.A(1,3),currRelPose.A(2,3),deg2rad(currRelPose.RotationAngle)];
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.
addRelativePose(pg,measurement);
preAbsPose = currAbsPose;
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")
Now they are the same.
-------------------------Off-topic interlude, 2024-------------------------------
I am currently looking for a job in the field of CV algorithm development, based in Shenzhen, Guangdong, China,or a remote support position. I would be very grateful if anyone is willing to offer me a job or make a recommendation. My preliminary resume can be found at: https://cuixing158.github.io/about/ . Thank you!
Email: cuixingxing150@gmail.com
  5 件のコメント
Zheng Dong
Zheng Dong 2022 年 12 月 8 日
Hi Cui,
Thanks for the feedback! I agree that the current example for optimizePoseGraph does not include the process about genereating the pose graph. We will consider adding another example including more details for the function based on your feedbacks.
Thanks,
Zheng

サインインしてコメントする。

その他の回答 (1 件)

Akshai Manchana
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

カテゴリ

Help Center および File ExchangePoint Cloud Processing についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by