Using MultiBody SmiData in User Defined Functions
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello , im trying to use some workspace variables(got from datafile of multibody) in matlab function, i tried adding workspace as a paramter but it said :
Mixed field types in structure arrays are not supported. Type at 'smiData.RigidTransform(1).ID' differed from type at 'smiData.RigidTransform(3).ID'.
it is an m file so if i tried to load it , load() function wont do , so any ideas how to do that?, i also tried adding the smiData to the matlab workspace but i think the func/matlab workspace is not the same , any ideas how to pull that off?
function y2 = Funcc(DataNum,Rotz1,Rotz2)
%This Function takes stuff in this order
%1-Vector that have every Frame in order , regualr
%Frame->ReversedFrame->reg->rev
%2-RotSensor of hip around Z
%3-RotSensor Of knee around z
rotz=-Rotz1 ;
rotz2=-Rotz2;
AxisAngle=0;
NormVector=zeros(3,1);
RotZMat = [cos(rotz) -sin(rotz) 0 0;sin(rotz) cos(rotz) 0 0;0 0 1 0;0 0 0 1];
RotZMat2 = [cos(rotz2) -sin(rotz2) 0 0;sin(rotz2) cos(rotz2) 0 0;0 0 1 0;0 0 0 1];
len=length(DataNum);
A1=zeros(4,4,len);
for i=1:len
AxisAngle=smiData.RigidTransform(DataNum(i)).angle;
NormVector=smiData.RigidTransform(DataNum(i)).axis;
TranslationVector=smiData.RigidTransform(DataNum(i)).translation;
c=cos(AxisAngle);
t1=1-c;
s1=sin(AxisAngle);
xi=NormVector(1);
yi=NormVector(2);
zi=NormVector(3);
x=TranslationVector(1);
y=TranslationVector(2);
z=TranslationVector(3);
A1(:,:,i)=[t1*xi*xi+c t1*xi*yi-zi*s1 t1*xi*zi+yi*s1 x; t1*xi*yi+zi*s1 t1*yi*yi+c t1*yi*zi-xi*s1 y; t1*xi*zi-yi*s1 t1*yi*zi+xi*s1 t1*zi*zi+c z;0 0 0 1];
end
y2 = A1(:,:,1)*RotZMat*(A1(:,:,2)^-1)*A1(:,:,3)*RotZMat2*(A1(:,:,4)^-1)*A1(:,:,5)*(A1(:,:,6)^-1);
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Assembly dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!