Query regarding creating new markers

Dear AnyBody support team,

I am a beginner in Anybody and have been learning a lot from your wonderful tutorials. I have some queries regarding importing my c3d files into the MoCap lower extremity model.
[ul]

  1. I have 57 markers in the c3d file and would like to use them for them in the simulation using Anybody. There is a small issue with the names of the markers that I am using. For example, the left ASIS is termed as L.ASIS, right lateral knee marker is termed as L.Knee.Lat and so on. Since the names of the markers have (.) in the labels will it cause any problem? Do I need to rename all the marker names in c3d?
    [/ul]
    [ul]
  2. Can I opt out few markers say Top.Head during my kinematic analysis or shall I remove all the upper extremity markers on the torso while performing IK or ID? If so how ?
    [/ul]

Apart from the above queries I have a few additional questions too. In our lab we use two force platforms and we record the data from left heel strike on the first platform and right heel strike on the second platform. Now my question is whether the model will sink down due to insufficient force data from the right foot during the first heelstrike and left foot after the second heelstrike. (I’ll attach my c3d file for better understanding). I have been using OpenSim before and while performing Residual reduction algorithm the model used to sink due to insufficient force data before left heel strike and after right heel strike.
Also, I found an interesting webinar on GRF prediction in anybody. Would you suggest to use that for performing the simulation for normal level ground walking as well as ramp?

How do I save the output after performing inverse dynamic analysis? Can I export the results in any other format for plotting say in MATLAB or MS excel? I could not find any files generated in the output directory after performing the tutorial MoCap model. Could you please elaborate or share the link to where I could find more details about it.

Look forward to your valuable suggestions. Thanks a lot. :slight_smile:

Cheers
Vishal

EDIT: I use Anybody 6.0.4

Dear Vishal,

  1. Yes you cannot read in marker names with the ‘.’s in the name, but we do have a workaround. If you are using the MoCap model, go to the file ‘C3DSettings.any’ and add the line SearchAndReplace = {{".",""}}. This is one of the settings of the AnyInputC3D class which reads in your file. It replaces all the dots with nothing, thus effectively removing them.

  2. You can indeed exclude specific markers from the kinematic and kinetic simulations. To do this, comment the head markers out from the ‘Markers.any’ file. However now, the kinematics algorithm cannot determine the position of the neck DOFs. So you would have to create some AnyKinEq or AnyKinEqSimpleDrivers that hold the DOF of your neck joint in a fixed orientation. The neck DOF is in the model tree at ‘Main.Studies.HumanModel.BodyModel.Trunk.JointsLumbar.C0C1Jnt’ in the MoCap Model from the examples folder. Follow similar steps for other upper extremity limbs.

  3. The AnyBody simulations are inverse dynamic simulations and so your model will not really ‘sink’ since it is expected to reproduce the results of the kinematics simulation. However, if you do not define a sufficient set of force actuators, the inverse dynamics may become infeasible. The simplest way of doing this is to switch on reactions for the drivers actuating ground-pelvis motion. In our sample MoCap model, this is the default case (see ‘JointsandDriversOptimized.any’). However, if you are missing force plate data for a foot, these pelvic reaction forces will be unreasonably high. It is then best to use the ground reaction force prediction algorithm, which should work for level and ramp walking.

  4. After running inverse dynamics, open the model tree and right click on the Output folder under ‘InverseDynamicStudy’ and click save data. Select ‘Deep Structure’ and save the ‘.anydata.h5’ file. You can then use the ‘h5read’ function in MATLAB to read in specific fields of data. Your ‘datasetname’ input to the function will be ‘/Output/Abscissa/t’ if for example you want to read out the time array. The location of a dataset is the same as their locations in the model tree. Identify the correct dataset locations for muscles of interest if you want muscle forces.

I hope that these may be helpful to you.

Best regards,
Moonki

Dear Moonki,

Thanks a lot for your valuable feedback. I have been nearly successful in executing the MoCap model GRF prediction using my c3d file for normal level ground walking. I still face few problems regarding this.

As per your suggestion I used the SearchAndReplace method to remove “.” with “”. It worked perfectly. And I edited a few markers too.

My c3d file has Z has its vertical axis and y is the direction of walking. I have been reading few threads in the forum with similar questions to find the solution. I figured out that we have to change the gravity as -9.81 in Z instead of Y in the generic MoCap model. Second thing is to change the Normal Direction in GRF prediction to Z. But still I am facing some errors that I am not able to figure out. I tried changing the initial position of the model too. Still there seems to be a problem.

It would be really great if you could you please check my model attached to this post and let me know where could be the problem?

Thanks a lot for your support and valuable time.

Best regards
Vishal

Dear Vishal,

Attached please find the zip file which contains a modified version of your model.

In order to pass the MotionAndParameterOptimizationModel procedure, I made some changes in the ‘TrialSpecificData.any’ file.

  1. I changed the initial orientation of the pelvis segment:
  AnyFolder InitialPositionOfBody ={
    
    AnyVar PelvisRotZ = 90; // changed
    AnyVar PelvisRotY = 0;
    AnyVar PelvisRotX = 90;
  1. Because there are not enough markers on the trunk and the foot segments, I had to turn on the extra drivers by doing this:
  // Do you have markers on the Trunk? If not turn OFF following switch:
#ifndef TrunkMarkersOnOff
  #define TrunkMarkersOnOff OFF
#endif
  // Do you have three markers on the Foot? If not turn OFF following switch:
#ifndef ThreeFootMarkersOnOff
  #define ThreeFootMarkersOnOff OFF
#endif

I hope this may be helpful to you.

Best regards,
Moonki

Dear Moonki,

Thanks a lot for your support. Yes now the model executed properly. :slight_smile: Well, I have a few more doubts.

  1. In our c3d file, we use 57 markers, but I reduced the number of markers to drive the model as per the MoCap example to 17 markers. We have 10 markers placed on one foot and 8 markers on the torso as well. So if I have to include them as well in the analysis do I need to turn on the extra drivers in TrialSpecificData.any?

  1. I have seen in the generic MoCap model markers.any, there are plenty of markers that have been commented out. I guess the additional markers that are referred to in TrailSpecificData.any are mentioned in those commented markers.

  2. If I am to implement an inclination or ramp in the GRF prediction model, where do I need to set the inclination in the Model?

 FootPlateConditionalContact GRF_Prediction_Right(
    PLATE_BASE_FRAME = Main.EnvironmentModel.GlobalRef,
    NORMAL_DIRECTION = "Z", // Do I have to change this?
    NODES_FOLDER = FootNodes,
    NUMBER_OF_NODES = 25 
  ) =
  {
    Settings =
    {
      LimitDistLow = -0.10; 
      LimitDistHigh = 0.045;
      Strength = 500;
    };    
    CreateFootContactNodes25 FootNodes(foot_ref = 
        Main.Studies.HumanModel.BodyModel.Right.Leg.Seg.Foot) = { };
  };

Thank you again for your valuable time and advice.

Best Regards,
Vishal

Hi Vishal,

  1. and 2): The switches in TrialSpecificData.any, like “TrunkMarkersOnOff” will turn on extra drivers for degrees of freedom (between pelvis - Thorax) whose positions cannot be determined when the trunk markers are excluded. You can see these conditional inclusions of extra drivers in “ExtraDrivers.any”.

When you include trunk markers, you must hence set TrunkMarkersOnOff to ON, so that the soft marker drivers will be used to determine the trunk DoF values. Do the same for ThreeFootMarkersOnOff, which should be ON when you have 3 or more markers on the foot.

3): I see that your PLATE_BASE_FRAME is currently set to the global frame. Open “Environment.any” and add the following code within the GlobalRef definition:



  AnyFixedRefFrame GlobalRef ={
    Origin={0,0,0};
    AnyDrawRefFrame drw={ScaleXYZ=0.4*{1,1,1};};
    AnyRefNode Ramp = 
    {
      ARel = RotMat(pi*5/180,x);
      AnyDrawRefFrame drw={ScaleXYZ=0.4*{1,1,1};};
    };
  };

This describes a new coordinate system which is inclined at 5 degrees wrt the global frame. In “GRF_example.any” set the “PLATE_BASE_FRAME” to “Main.EnvironmentModel.GlobalRef.Ramp”. That would be it! :slight_smile: You don’t need to change the normal axis because in this new coordinate system, the local Z axis is still the ground normal.

Ananth
AnyBody Support

Dear Ananth

Thank you a lot for explaining about how to implement the slope. Sorry to bother you all again. I was performing the inverse dynamics analysis for using one of the c3d files from our experiment. I did refer to the PLATE_BASE_FRAME as Main.EnvironmentModel.GlobalRef.Ramp But this time the inverse dynamics performed without any errors. But while checking for the predicted force platform data I found it blank. Also the simulation looks a bit different from the actual experiment. It looks like the model walks on a flat surface after the first step. The link of the simulation performed could be viewed here: Simulation video

The output for the predicted GRF Fx,Fy,Fz,Mx,My,Mz are still zero. But muscle activity could be seen. Any ideas where I am going wrong again?:confused:

Thanks a lot for your continuous support team!

Best regards
Vishal

Hi Vishal,

Appreciate the effort of uploading the video to demonstrate the issue :slight_smile: I’m not sure if the video refers to the same trial that was being simulated earlier, but it seems as though the model has been translated further along the global z direction, since the global origin is barely visible. I’m comparing this to what I see in the model I have with me here.

This could be the reason why the ground reaction forces are zero, since the contact muscles only activate when the respective attachment points on your foot penetrate the slab-like control volume defined by the X-Y plane, and LimitDistLow and LimitDistHigh in your virtual forceplate’s definition.

Since AnyBody only uses inverse dynamics, the model’s motion will always mimic the motion defined by the input MoCap data. Of course if the kinematic simulation does not match the experimental marker trajectories very well you will get errors, but that doesn’t seem to be the case based on what I see in the video. How about adding some more markers on the foot? You had mentioned that idea in the last post.

Regards
Ananth

Dear Ananth

Thank you for letting me know about it. I was hoping that it would be the error with GRF prediction. But unfortunately, it did not work with that as well. The model is translated along Z axis and it is not able to figure out the slope in GRF prediction.

I was trying for performing the ramp with one force plate data from the c3d file using normal MoCap model. Even in that the model wasn’t successful in performing parameter optimization and inverse dynamics. The model looks translated along Z axis and the force platform defined was stuck on the origin. Doesn’t ForcePlatformType4AutoDetection gets the position and initializes it in the model? I have tried adding additional foot markers as well. Still no luck :frowning:

Here is the mokka image for the c3d

Here is the model simulated using the same

Both looks the same, just that the forceplatform in ramp is shown parallel to y axis. Any suggestions please? :confused:

Thanks a lot!

Kind regards
Vishal

Hi Vishal,

sorry for the slow reply,

So if i understand the problem correctly the problem is that one of the plates in AnyBody is placed on the ground, and in reality it should have been lifted up and been tilted?

Please double check the code used to call the class… so ensure that the correct plate number is being used… when making use of the forceplate class… see highligted code below…


 ForcePlateType4AutoDetection Plate1 (
    PlateName = Plate1,
    Folder =Main.ModelSetup.C3DFileData,
    Limb1=  .BodyModelRef.Right.Leg.Seg.Foot,
    Limb2=  .BodyModelRef.Left.Leg.Seg.Foot,
    [b][i][u]No=0,[/u][/i][/b]
    VerticalDirection ="Y",
    HeightTolerance=0.07,
    VelThreshold=2.2,
    Fx=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Fx1,
    Fy=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Fy1,
    Fz=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Fz1,
    Mx=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Mx1,
    My=Main.ModelSetup.C3DFileData.Analog.DataFiltered.My1,
    Mz=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Mz1,
    FootPresent=HumanModelPresent)
    ={
      Cal=Main.ModelSetup.C3DFileData.Groups.FORCE_PLATFORM.CAL_MATRIX.Data[0];
      Switch_DrawForceVectorFromCOP = On;
    };

 
 
    ForcePlateType4AutoDetection Plate2 (
    PlateName = Plate2,
    Folder =Main.ModelSetup.C3DFileData,
    Limb1=  .BodyModelRef.Right.Leg.Seg.Foot,
    Limb2=  .BodyModelRef.Left.Leg.Seg.Foot,
    [b][i][u]No=1,[/u][/i][/b]
    VerticalDirection ="Y",
    HeightTolerance=0.07,
    VelThreshold=2.2,
    Fx=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Fx2,
    Fy=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Fy2,
    Fz=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Fz2,
    Mx=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Mx2,
    My=Main.ModelSetup.C3DFileData.Analog.DataFiltered.My2,
    Mz=Main.ModelSetup.C3DFileData.Analog.DataFiltered.Mz2,
    FootPresent=HumanModelPresent)
    ={
      Cal=Main.ModelSetup.C3DFileData.Groups.FORCE_PLATFORM.CAL_MATRIX.Data[1];
      Switch_DrawForceVectorFromCOP = On;
    };

If this is not the issue, i am not sure what is the issue… it must be something with the corners nodes of the plate not being correctly set… you could try to look into the definition of the forceplate class and look at the values for the forceplate corners nodes if these makes sense… alternatively if possible upload the C3D file, and we could take a look.

Best regards
Søren