Compound quaternion Matlab -error

5 ビュー (過去 30 日間)
Mark S
Mark S 2021 年 12 月 6 日
編集済み: Mark S 2022 年 1 月 8 日
Hi, I have written a Matlab code where i can compound two relative poses by Translation-Vecot-Unit-Quaternion-Pair
But I get an error and I did not know why. The error message is:
Output argument "t_q_pair_A_C" (and possibly others) not assigned a value in the execution with "test2>t_q_pair_compound"
function.
Error in test2 (line 40)
q_pair_A_C = t_q_pair_compound(t_q_pair_A_B,t_q_pair_B_C);
Can anybody give me a hint why I get this error message. Thank you :)
Here is my code:
.

採用された回答

KSSV
KSSV 2021 年 12 月 6 日
In this function:
function t_q_pair_A_C = t_q_pair_compound(t_q_pair_A_B,t_q_pair_B_C)
% Extract Translation Vectors
t_A_B = t_q_pair_A_B.t;
t_B_C = t_q_pair_B_C.t;
% Extract Unit Quaternion
q_A_B = t_q_pair_A_B.q;
q_B_C = t_q_pair_B_C.q;
%Compound Translation Vectors
t_A_C_pure_q = q_pure(t_A_B) + q_A_B * q_pure(t_B_C) * q_inv(q_A_B);
[~, v_1,v_2, v_3] = parts(t_A_C_pure_q);
t_A_C = [v_1;
v_2;
v_3];
end
You need to assign the output. May be you want:
function t_q_pair_A_C = t_q_pair_compound(t_q_pair_A_B,t_q_pair_B_C)
% Extract Translation Vectors
t_A_B = t_q_pair_A_B.t;
t_B_C = t_q_pair_B_C.t;
% Extract Unit Quaternion
q_A_B = t_q_pair_A_B.q;
q_B_C = t_q_pair_B_C.q;
%Compound Translation Vectors
t_A_C_pure_q = q_pure(t_A_B) + q_A_B * q_pure(t_B_C) * q_inv(q_A_B);
[~, v_1,v_2, v_3] = parts(t_A_C_pure_q);
t_q_pair_A_C = [v_1;
v_2;
v_3];
end
  3 件のコメント
KSSV
KSSV 2021 年 12 月 6 日
Thanks is accepting/ voting the answer. :)
KSSV
KSSV 2021 年 12 月 6 日
You are using a different variable name for that. This line:
q_pair_A_C = t_q_pair_compound(t_q_pair_A_B,t_q_pair_B_C);
should be:
t_q_pair_A_C = t_q_pair_compound(t_q_pair_A_B,t_q_pair_B_C);

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCoordinate Transformations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by