Hi,
I'm using Mocap models and, I'm running a 20 frame analysis. I want to keep track of a specific point on the subject's hand during the movement. I have used AnyKinLinear class to do so. But there are some problems that I will explain.
Here is my code:
First of all, the result of each kinematic measure is a three-dimensional vector. However, I want to have the 3D coordinates of the point in each frame. Something like this: {{1,2,3},{4,5,6},{7,8,9}} (I don't know the name of this kind of variable in anyscript) But the result is something like this: {1,2,3}
Second, I want to calculate the average of the values of the right and left hand. But the result is always a three-dimensional zero vector ({0,0,0}).
How are you viewing your results? Just looking at this variable in the Model Tree, or exporting into a CSV file? If you just view in the Model Tree - it will show you the value for a particular time step. Meaning that if you ran analysis - you will see the last value. Viewing these variables in the Chart View should supposedly show the right curves.
Secondly, please ensure that these values are included through referencing in the Study, otherwise they will not be updated and you may see zeros.
Thanks for your reply. I inserted this code into the InverseDynamicStudy, and the problem was solved. You were right; the problem was the lack of reference of those variables in the Study.
I have another question if you don’t mind. Now I want to draw a point with the coordinate that I have calculated in the AvgPos variable. I tried to define a node with AnyRefNode class and giving the value of Main.Studies.InverseDynamicStudy.AvgPos or Main.Studies.InverseDynamicStudy.Output.AvgPos to sRel of the node, but I got some errors each time. Would you please help me with this?
It could be that you are using values that are not ready at the time of computing the sRel. Can you try and dump the errors you see here in the thread?
Hi Bjørn,
Thanks for your reply. Here is the error that I receive when I load the model:
ERROR(SCR.EXP10) : EnvironmentModel.any(8) : 'AvgPointNode' : Expression evaluation failed at moment 'DesignVar' :
AnyMocapModel.any(33) : AvgHandPos : argument will not be ready for evaluation until moment 'PosVar'
I have defined a Node in the GlobalRef and assigned the position I calculate from getting the average of two specific points' positions on the hand. I calculated this position in the Main file, and the code is attached below:
I have also referenced it in the Studies, and there is no problem with the coordinates of the point itself, but it seems there is nothing to be assigned to the sRel of the Node at the beginning of the procedure. How can I visualize the point in any way during the simulation?
Thanks for the info.
The error you get is because you are trying the initiate a AnyRefNode with a sRel that is not ready at that specific time (called PosVar)
Luckily you don't need to make it a ref node in order to draw it.
The snippet you send about the measures and calculating the AvgHandPos is correct and in order to draw it you can use a AnyDrawSphere like this: