Compound quaternion Matlab -error
3 views (last 30 days)
Show older comments
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:
.
0 Comments
Accepted Answer
KSSV
on 6 Dec 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 Comments
KSSV
on 6 Dec 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);
More Answers (0)
See Also
Categories
Find more on Specialized Messages in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!