You can use the MannequinValuesFromModel.any file for that. Look for example in the main file of the StandingModel. There is a section explaining how to use this file to dump joint angles from a simulation and use them as initial position for the Mannequin.any file.
Thanks for your reply.
I found the file and found pretty useful.
However, I’m trying to set the translational position of the joints not the joint angles. Is there a variable that holds the joint 3D location (not angles) that I can edit for setting initial position?
Each AnyRefNode has a “r” menber. This is the 3D coordinates of the node in the global reference frame at any time. I understand this what you want to use for the initial position.
However this is not very usefull with the current definition of the initial positions: first the pelvis position and orientation is defined, then only the orientation of the other segments is needed because the two nodes of each joint are already set to be on top of each other. That is why when the pelvis is positioned only the joint angles are used as input.
I think if you really want to use the joint center position as input you will have to modify the r0 and axes0 definitions in the InitialPosition.any and Seg.any files of each body part.
I decided to go with joint angles, however i have some question:
Are angles used in rad or degrees in Anybody?
does the member ‘Pos’ (described at :The position vector of the joint coordinates, in the ref-manual) of the ‘AnyJoint’ class represent angles or 3D coordinates?
The ‘mannequin.any’ file is used to input initial joint angles. However not all joints are included in the default version of the file. How can I add more joint angles? where can I find the exact naming of the angles. For example the file contains the angles for the Hip angle (in all its DOFs), but how can I specify the angles of joint like : Atlanto Occipital Joint / C0C1 Joint,Neck Joint / T1C7 Joint, T12L1 Joint, L2L3 Joint, L3L4 Joint, Toe Joint … ect?
In the ‘mannequin.any’ we can also define the pelvis position and orientation. The variables PelvisPosX, PelvisPosY, PelvisPosZ, do they refer to the 3D coordinates of the pelvis or its angles?
Angles are in Radian. However in the Mannequin file they are specified in Degrees because it is easier to estimate, and they are transformed in Rad later in the drivers.
That actually depend on the joint type, but in general it represents the values of the joint’s degrees of freedom. So for rotating joints like revolute, universal and spherical it corresponds to angles. And for a prismatic joint it represents the linear displacement.
Some joints like the toe joints simply don’t exist yet in the model. The lumbar joints are linked by a kinematic rhythm, so their position is automatically defined with the Trunk_Pelvis orientation. AS for the cervical joints (if you use the neck model, else they are stiff) their initial position is set to be always straight regarding to the trunk.
So basically al the variable initial positions you can set are already in the Mannequin file.
PelvisPos refers to the 3D coordinates in the global ref frame, and PelvisRot refers to the orientation (angles) in the global ref frame.
Im trying to add a AnyInputFile to the Mannequin.any file to be able to change the initial joint angles from an external txt file. However when i load the modeil, i get the following error:
ERROR(SCR.EXP10) : C:/U…s/Rami/A…a/L…l/A…y/A…x/C…s/Body/Arm/Muscle.any : ‘InitWrapPosVectors’ : Expression evaluation failed at moment ‘Const’ :
C:\Users\Rami\AppData\Local\AnyBody Technology\AnyBody.5.x.x\Complete_Models\DrivingPosture_DetailedHand\Mannequin.any(141) : GlenohumeralFlexion : argument will not be ready for evaluation until moment ‘ConfigVar’
How can i solve this probelm??
The problem is the evaluation moment. The initial positions are of the type Constants, that means there are read at the begining of the loading process. An AnyInputFile will be read later in the process. So in this case the initial positions are not ready on time and it causes the error.
I am affraid that means you can’t use the AnyInputFile to define the initial positions after all. I think you have to follow the method described for the MannequinValuesFromModel file.
I’ve looked into using the MannequinValuesFromModel method.
My understanding is that its a manual process that uses the initial position of the same model, just more accurate since the values are acquired after performing an initial conditions operation.
This will not work for me because I need to use external value, not from the model itself. I have a file with the required values of joint positions and I need to initialized the model using these values.
I think i understand better your problem now. I just did a small test and it confirmed what you wrote in the previous post.
Using the AnyInputFile works ok for joints that don’t have wrapping muscles like the elbow. But for the ones having wrapping muscles (like the GH joint) there is the problem of evaluation sequence that you saw.
So the AnyInputFile is not the solution.
The other solution to import values from a text file is the design variables. But again i think those are updated after the initial position is loaded. So i doubt it will be succesfull either.
That means we are back to a manual method similar to the MannequinValuesFromModel. The only difference is that you use your external values (instead of the model dumped values) to create a new Mannequin file. Maybe you can make some kind of MatLab script that can automatically generate the anyscript file from your text file.
I have an update about this problem of evaluation moment that prevents you from using the AnyInputFile to read initial joint angles. There was a small bug in the repository that has been fixed for the next version.
So keep an eye for the release, I think that with the updated version you will be able to use the AnyInputFile as you planned initialy.