I am having an issue when running a macro from anypytools on python. I am aiming to run the kinematics and inverse dynamics as well as dumping some hip reaction force data. The script runs but only returns one value for the hip reaction force. See code below.
I believe this could be because the model exits before running the inverse dynamics, therefore returning a value for a stationary body? I have tried to adapt the script but with no success.
Any advice on how to overcome this would be much appreciated.
To get more values, you need to dump the content of the variables below the study output folder. ‘Main.Studies.InverseDynamicStudy.Output’ The Output folder is the structure that collects the data from all time steps.
Thus, the dump class operation would look like this:
‘classoperation Main.Studies.InverseDynamicStudy.Output.BodyModel.SelectedOutput.Right.Leg.JointReactionForce.Hip_MediolateralForce “Dump”’,
Also, keep in mind that you need to run ‘ParameterOptimization’ before the inverse dynamic study. In your case, where the macros are split into two, AnyPyTools may run them in parallel.
Thank you very much for the fast reply. I have made the suggested changes and the script is now running fine.
I have a second question regarding output data. I put the following code into the inverse dynamics of my main model. I aim to save a number of variables directly into text files, however although the model runs fine, no text file is saved as far as I can see. Apologies if this is a relatively simple question.