Compound quaternion Matlab -error

5 Ansichten (letzte 30 Tage)
Mark S
Mark S am 6 Dez. 2021
Bearbeitet: Mark S am 8 Jan. 2022
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:
.

Akzeptierte Antwort

KSSV
KSSV am 6 Dez. 2021
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 Kommentare
KSSV
KSSV am 6 Dez. 2021
Thanks is accepting/ voting the answer. :)
KSSV
KSSV am 6 Dez. 2021
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);

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Coordinate Transformations finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by