joint constraint violation during replay

Dear experts,

I notice that the elbow joint constraints are violated during replay of the results of a simulation performed a few days ago.

Here’s my procedure to replay the saved results:

  1. Open AnyBody
  2. Open the MoCap model
  3. Turn the Inverse Dynamics switch on (if it is not on already)
  4. Load the model
  5. In the model tree, go to Studies->InverseDynamicStudy->Output and Load the saved results
  6. In the operations tree, go to Studies->Inverse Dynamic Study->Replay

Am I missing something? I had visualized the saved results on the day I carried out the simulation and everything looked fine.

Thank you,

Vikas

Hi Vikas,

If the model has been optimized you might be missing to load into the model the optimized results, which would change the bone lengths etc?

Best regards
Søren

Hi Søren,

Thank you. I thought about that right after I posted that question and I tried loading the optimized results as well but it did not help. Could you please add a line or two could to the relevant Wiki link?

Thanks,

Vikas

Hi Vikas,

Here I would make some suggestions for you.

  1. For automatic saving process of the result in the form of ‘h5’ file,
    you can just change one line setting in the ‘MoCap_FullBody.main.any’ file.
#ifndef AutoSaveOption
#define AutoSaveOption 1
#endif

Then the h5 file will be saved after the execution of ‘InverseDynamicAnalysisSequence’

  1. In the ‘InverseDynamics.any’ file, I would suggest you to add a few more lines like this:
//** Creates the RunApplication **//
Main = { 
  AnyOperationMacro InverseDynamicAnalysisSequence =
  {
    MacroStr =
    ({
      "classoperation Main.Studies.LoadParametersOptimizationResults" + " " + strquote("Load design") + " --file=" + strformat("\x22") + "../Input/" + OutputFileNamePrefix + Main.ModelSetup.C3DFileData.NameOfFile +"-"+"OptimizedParameters.txt" + strformat("\x22"), 
      "classoperation Main" + strformat("\x22")+ "Update Values" + strformat("\x22"),
      "operation Main.Studies.InverseDynamicStudy.InitialConditions",
      "run",
      "operation Main.Studies.HumanModel.Calibration.CalibrationSequence",
      "run",
      "operation Main.Studies.InverseDynamicStudy.InverseDynamics",
      "run"
      #if AutoSaveOption
      ,
      "classoperation Main.Studies.InverseDynamicStudy.Output" + strquote("Save data") + " --file="+ "../Output/" + OutputFileNamePrefix + Main.ModelSetup.C3DFileData.NameOfFile + ".anydata.h5 " + "--type=Deep"
      #endif      
    });
  };
  
  #if AutoSaveOption
  
  Main = 
  {
    AnyOperationMacro ReplayIDAnalysisSequence = 
    {
      MacroStr = 
      ({
        "classoperation Main.Studies.LoadParametersOptimizationResults" + " " + strquote("Load design") + " --file=" + strformat("\x22") + "../Input/" + OutputFileNamePrefix + Main.ModelSetup.C3DFileData.NameOfFile +"-"+"OptimizedParameters.txt" + strformat("\x22"), 
        "classoperation Main" + strformat("\x22")+ "Update Values" + strformat("\x22"),        
        "classoperation Main.Studies.InverseDynamicStudy.Output" + strquote("Load data") + " --file="+ "../Output/" + OutputFileNamePrefix + Main.ModelSetup.C3DFileData.NameOfFile + ".anydata.h5 " + "--type=Deep",
        "operation Main.Studies.InverseDynamicStudy.Replay",
        "run"
      });
    };      
  };

  #endif    
};
...

After adding these lines, then you can seee ‘ReplayIDAnalysisSequence’ operation in the Operations tree.

Then you can execute this operation sequence for reply with proper pre-loaded scaling.

I hope this may help you.

Best regards,
Moonki

Thank you very much, Moonki. That piece of script was very helpful!

Vikas