In the feet I made this rotation:
[SIZE=3]AnyFloat[/SIZE] p1=-14.282pi/180;
[SIZE=3]AnyFloat[/SIZE] p2= 2.141pi/180;
[SIZE=3]AnyFloat[/SIZE] p3=5.09937933*pi/180;
[SIZE=3]AnyRefNode[/SIZE] ISBNodeAnalyse={
[SIZE=3]AnyMat33[/SIZE] Rotation = RotMat(.HeelNodeStandard, .BigToeNodeStandard,.SubTalarJointStandard)*RotMat(.p1,x)*RotMat(.p2 ,z)*RotMat(.p3,y);
ARel=Rotation;
sRel=.HeelNode.sRel;
[SIZE=3]AnyDrawRefFrame[/SIZE] drw ={
Visible = On;
ScaleXYZ={0.5,0.5,0.5};
RGB={.1,0.6,0.3};};};
Now I want use the variables p1, p2 and p3 in such a way that the Axes of this node will be {1,0,0},{0,0,1},{0,-1,0}; Which method is appropiate for that?
If matrix A0 is Axes0 of the segment, where the node is defined. A1 is the ARel that you defined in the node. Then Axes (of the node) = A0*A1.
In order to set Axes to be B (your matrix), you need to do the following:
rotation will consist of several steps -> Axes=B= (A0*(A1*A1.T)*A0.T)*B, where .T means transposition, () gives identity matrix => ARel = .A0’*B.
This is not what I want to achieve The local reference frame needs to be parallel orientated to the goblal reference frame so that the Y-axis will be exactly vertical and X- axis exactly horizontal. With the solutions you present ARel will be the identity matrix but I need to have the ISBNodeAnalyse.Axes to be the identity matrix.
You cannot assign it and I wrote how it is being calculated a couple of times. YourNode.Axes is the rotation matrix in global ref. frame (computed automatically), whereas ARel is the rotation matrix in the local ref. frame that you can enter. To go from local to global you multiply all nested rotations.
So if you have a segment A with rotations B, nested node C, with ARel D:
AnySeg A = {Axes0 = B;
AnyRefNode C = {ARel=D;};
};
Then A.C.Axes = BD OR A.C.Axes=A.Axes0C.ARel;
If you want A.C.Axes to be matrix F => you rotate everything to the global ref. frame to make the rotation matrix Identity first, and then multiply by F. Then it becomes:
A.C.Axes = (B*(D*D’)*B’)F=((I))F=F
So in the code above it will be: ARel = DD’.Axes0’*F. If your Axes0 is identity you will receive what i wrote above several times.
Please try to create a simple model, enter simple matrices, and understand what Axes object is and how it is computed. I suggest you start with a small example as in my answer. When you load your model these objects are accessible to check in the model tree view. You can see the actual values and play with the numbers.
If you do not have clear understanding of these basics - you may make mistakes in your model. So i recommend you to spend a little bit of time on this problem.
The last status of the problem: when I make the Axes0 of the feet equal to the value of Foot.Axes then the matrix in the ISBNodeAnalyse is an entity matrix both when the model is loading and when the initial conditions are used. This is also the case for the pelvis and thorax. Only in the left foot Axes = {{0.7603833, -0.2863198, -0.5829564}, {-0.5318971, -0.7895995, -0.3059708}, {-0.3726965, 0.542728, -0.752691}} and in the right foot {{1, -6.025384e-008, -4.112028e-008}, {-4.804978e-008, 7.611931e-007, -1}, {3.93603e-008, 1, 7.051857e-007}} which I consider as an entity matrix. Why isn"t the axes in the left foot an entity matrix as well?
Please be more specific about what objects you are looking at - then I may help with specific locations of object definitions.
It is non-identity because some Axes0 and r0 are prescribed in the initial conditions, which will be used as an initial guess to kinematic solver: http://www.anybodytech.com/693.0.html
To make it identity you will have to use what i suggested before (F=I), but taking into account dynamic changes and using segmental Axes0, e.g. using the A.Axes0’ as a multiplier. Do exactly the same thing that worked for you in the simple example.
Could you please be more specific on what you are trying to achieve? (beyond making 2 reference frames parallel). Maybe this can be done easier.
What I try to achieve is the following: When my model will be set to the dataset I load in the local reference frame must be parallel to the global reference frame in the thorax, pelvis and feet. This is necesary because I have to compare the GaitLowerExtremity model with another independent softwaretool which has that assumtion.
still not specific - what kind of entities are you trying to compare? are you looking at the joint angles? forces? are you driving AnyBody model using data from another software? etc.
Unfortunately you are not providing us with information that can be used to help. I cannot clearly see why the suggested solution suggested does not work for you.
I need to compare the following entities: segment positions first, then joint angles and later on also joint forces and joint moments plus muscle forces. The entitiy matrix in axes must be an entity matrix if the initial conditions are used and not if the model is loaded.
The last status of the problem: when I make the Axes0 of the feet equal to the value of Foot.Axes then the matrix in the ISBNodeAnalyse is an entity matrix both when the model is loading and when the initial conditions are used. This is also the case for the pelvis and thorax.
In order to achieve what you want, namely measure your angles and displacements as compared to the global reference frame, it is easier to construct proper measures such as AnyKinRotational and AnyKinLinear and use relevant components. __ Tutorials: Kinematic measures__
Segmental members may give you information about positioning in the global reference frame too. For example, accessing .r member of AnySeg will give you global position of the segment.
However, rotation may require a bit of processing, such as decomposing rotational matrices into angles - much easier for you to go with AnyKinRotational. Something like:
I used this to make a Rotation where axes in the initial conditions is an identity matrix:
[SIZE=3]AnyFloat[/SIZE] p1=-0.2489909;
[SIZE=3]AnyFloat[/SIZE] p2= 0.03717305;
[SIZE=3]AnyFloat[/SIZE] p3= 0.08901289;
[SIZE=3]AnyRefNode[/SIZE] ISBNodeAnalyse={
My question is : Is it possible to replaces the values of p1, p2 and p3 with an expression that it will use the values of the AnyKinRotational instead of a constant value?
RotmeasureFootRefFrame.Pos[0] will correspond to the p2 value and you can use it for rotation (if p2 is the angle about global Z axis in a single point of time).
If i use this as expression:
[SIZE=3]AnyFloat [/SIZE]p1=Main.Studies.MotionOptimization.RotmeasureFootRefFrame.Pos[0];[SIZE=3]
[/SIZE][SIZE=3]AnyFloat[/SIZE] p2=Main.Studies.MotionOptimization.RotmeasureFootRefFrame.Pos[1];[SIZE=3] [/SIZE][SIZE=3]AnyFloat[/SIZE] p3= Main.Studies.MotionOptimization.RotmeasureFootRefFrame.Pos[2];
I got this error message:
[SIZE=1][SIZE=2]Loading Main : “C:\bestanden\AMMRV1.4\Application\Examples\GaitLowerExtremity\GaitLowerExtremity.main.any”
Scanning…
Parsing…
Constructing model tree…
Linking identifiers…
Evaluating constants…
[/SIZE]ERROR(SCR.EXP10) : C:/bestanden/AMMRV1.4/Body/AA…n/LegTD/Seg.any : ‘ARel’ : Expression evaluation failed at moment ‘DesignVar’ : C:\bestanden\AMMRV1.4\Body\AAUHuman\LegTD\Seg.any(183) : Rotation : argument will not be ready for evaluation until moment ‘PosVar’
Model loading skipped