Forums Anyscript.org

Forums Anyscript.org (http://forum.anyscript.org/index.php)
-   Debug model (http://forum.anyscript.org/forumdisplay.php?f=21)
-   -   GMFoot MoCap and RBF Scaling (http://forum.anyscript.org/showthread.php?t=4632)

Zach_Welshman 02-22-2017 06:41 PM

GMFoot MoCap and RBF Scaling
 
1 Attachment(s)
Hello, I've been trying to get the GM foot model to run with the suggested RBFLandmark scaling for each individual bones. I can scale and morph each bone with the GMFreePosture Model, but would like to incorporate this with gait data. I've attached my model in a zip file below.

When i run my model it returns with:
Code:

ERROR(SCR.SCN6) :  D:/D..s/A..s/A..y/Body/A..n/B..s/G..t/BodyModel.any(37)  :  'TRUNK' :  Unexpected character.
Model loading skipped

Thank you for any help you can provide.
Thanks,
Zach

pgalibarov 02-28-2017 02:07 PM

Hi Zach,

I am sorry for the late reply.

Unfortunately the structure of the MoCap models is a little different from other models. You need to do a few modifications to make it work with the subject-specific scaling functions.
1. Please copy Body\AAUHuman\Scaling\FootScaling\ScalingLengthMas sFatRBF.any into the Model folder.

In MoCap-Model/Model you need to find HumanModel.any and change the path to be relative and looking at the file that you copied:
Code:

//    #include "<ANYBODY_PATH_BODY>\Scaling\FootScaling/ScalingLengthMassFatRBF.any"
  #include "ScalingLengthMassFatRBF.any"

2. In ScalingLengthMassFatRBF.any for the segments that you individualize you would need to define a block like the example below:

Code:

     
      AnyFolder Thigh = {
        AnyVar LengthScale  = ...AnthroSegmentLengths.Right.ThighLength / ...StandardParameters.Right.Thigh.Length;
        AnyVar ms = ...MassScaling.Right.Thigh.MassScale;
        AnyVar ls = LengthScale;
       
        #ifndef CUSTOM_SCALING_Right_Thigh
        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat = {{(.ms/.ls)^0.5, 0, 0},{0, .ls, 0},{0, 0, (.ms/.ls)^0.5}} ;
          Offset = {0, 0, 0};
        };
        #else
       
        #endif
       
      };
    }; // Right

This block of code should exclude ScaleFunction if CUSTOM_SCALING_#SIDE#_#SEGMENT# is specified.

This should be sufficient. Please let me know if that makes sense and you can make it work.

Kind regards,
Pavel

Zach_Welshman 03-06-2017 04:05 PM

GMFoot MoCap and RBF Scaling
 
1 Attachment(s)
Hi Pavel, again thank you for your time, I see where the differences exist between the free posture and the mocap models.

I've completed the changes and the model is returning:

Code:

Closing model...
Deleting last loaded model...
...Model deleted.
Loading  Main  :  "D:\Documents\Anyscripts\AMMR.v1.6.2-MyDemo - Copy\Application\Beta\MoCap-GMFoot\MoCap-GMFoot.main.any"
Scanning...
Parsing...
Constructing model tree...
Linking identifiers...
Evaluating constants...
ERROR(SCR.EXP0) :  D:/D..s/A..s/A..y/A..n/Beta/M..t/M..l/Environment.any(53)  :  'sRel'  :  Error in expression. Please refer to the following error messages for details ...
ERROR(SCR.EXP.FUN.EXT8) :  D:/D..s/A..s/A..y/A..n/Beta/M..t/M..l/Environment.any(37)  :  LocationFunction  :  Exception in Python extention module.
  Python error :
Model loading skipped

The Python file FootLocation4 is already in the model folder.
I look forward to your reply.
Many Thanks,
Zach

pgalibarov 03-07-2017 11:52 AM

Zach,

I tried and got the same error. And it seems that you may be using Python 3 and it has changed a couple of functions. Please try this correction, it worked for me.

Kind regards,
Pavel

pgalibarov 03-07-2017 11:53 AM

1 Attachment(s)
Please rename it into .py

Zach_Welshman 03-07-2017 12:33 PM

GMFoot MoCap and RBF Scaling
 
Thanks Pavel, the model is loading now. As you can probably see too, there seems to be a problem with the location rest of the foot, but I will investigate this further when i try an individualise more bones into the GM model, perhaps this will adjust the foot when these bones are morphed.

Thanks for your help Pavel.
Zach

Zach_Welshman 03-13-2017 10:08 AM

GMFoot MoCap and RBF Scaling
 
1 Attachment(s)
Hi Pavel, I can get it to work with each the calcaneus and talus separately, but I am getting an "object already declared at" error when i try to combine the laws. I tried to change the name of the scale function of one of the bones but then i get another error at the AnyInt.

My ScalingLengthMassFatRBF folders look like
Code:

// AnyFolder &Talus = Foot;
               
        AnyFolder Talus = {
        AnyVar LengthScale  = ...AnthroSegmentLengths.Right.TalusLength / ...StandardParameters.Right.Talus.Length;
        AnyVar ms = ...MassScaling.Right.Talus.MassScale;
        AnyVar ls = LengthScale;
       
        #ifndef CUSTOM_SCALING_Right_Talus
        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat = {{(.ms/.ls)^0.5, 0, 0},{0, .ls, 0},{0, 0, (.ms/.ls)^0.5}} ;
          Offset = {0, 0, 0};
        };
        #else
       
        #endif
       
      };
       
    // AnyFolder &Calcaneus = Foot;
       
        AnyFolder Calcaneus = {
        AnyVar LengthScale  = ...AnthroSegmentLengths.Right.CalcaneusLength / ...StandardParameters.Right.Calcaneus.Length;
        AnyVar ms = ...MassScaling.Right.Calcaneus.MassScale;
        AnyVar ls = LengthScale;
       
        #ifndef CUSTOM_SCALING_Right_Calcaneus
        AnyFunTransform3DLin ScaleFunction = {
          ScaleMat = {{(.ms/.ls)^0.5, 0, 0},{0, .ls, 0},{0, 0, (.ms/.ls)^0.5}} ;
          Offset = {0, 0, 0};
        };
        #else
       
        #endif
       
      };

and my HumanModel file looks like:
Code:

//Choose between scaling laws
  //#include "<ANYBODY_PATH_BODY>Scaling\ScalingUniform.any"
  //#include "<ANYBODY_PATH_BODY>Scaling\ScalingLengthMass.any"
  //#include "<ANYBODY_PATH_BODY>Scaling\FootScaling\ScalingLengthMassFat.any"
  //#include "<ANYBODY_PATH_BODY>\Scaling\FootScaling/ScalingLengthMassFatRBF.any"
    #include "ScalingLengthMassFatRBF.any"
 
  Scaling = {
    //This is the file which set the segments lenghts
    #include "AnyManRBF.any"
   
    //GeometricalScaling.Right.Foot = {#include "../Scaling/RBFLandmarksTalus.any"};
        GeometricalScaling.Right.Foot = {#include "../Scaling/RBFLandmarksCalcaneus.any"};
   
    //MorphingLandmarks = {AnyFolder &SegRef = Main.Studies.HumanModel.BodyModel.Right.Leg.Seg;};
    //#include "<ANYBODY_PATH_BODY>Scaling\FootScaling\MorphingLandmarks.any"
  };
  #include "FootType.any"
};

I'm sure it's a trivial organisational problem, sorry!

pgalibarov 03-13-2017 10:26 AM

Hi Zach,

Yes, it is simple. You provide your RBF scaling functions and redefine the scaling law at the same time to contain a linear scaling functions. They conflict.

The way I expected you to work was to modify the scaling law, and externally add this block:

Code:


#define CUSTOM_SCALING_Right_Talus
#define CUSTOM_SCALING_Right_Calcaneus

Scaling = {
    //This is the file which set the segments lenghts
    #include "AnyManRBF.any"
   
    GeometricalScaling.Right.Foot = {#include "../Scaling/RBFLandmarksTalus.any"};
    GeometricalScaling.Right.Foot = {#include "../Scaling/RBFLandmarksCalcaneus.any"};
   
    //MorphingLandmarks = {AnyFolder &SegRef = Main.Studies.HumanModel.BodyModel.Right.Leg.Seg;};
    //#include "<ANYBODY_PATH_BODY>Scaling\FootScaling\MorphingLandmarks.any"
  };


Please note that this code should be included before HumanModel.any so it would have an effect. Just remove it and define before:

Code:

  #if MotionAndParameterOptimizationModel
  #include "Model/Kinematics.any"
  #endif
 
  #if InverseDynamicModel
  #include "Model/InverseDynamics.any"
  #endif

Hope this makes sense.

Kind regards,
Pavel

Zach_Welshman 03-13-2017 12:36 PM

GMFoot MoCap and RBF Scaling
 
Hi Pavel, i'm getting back error:

Code:

Closing model...
Deleting last loaded model...
...Model deleted.
Loading  Main  :  "D:\Documents\Anyscripts\AMMR.v1.6.2-MyDemo - Copy (2)\Application\Beta\MoCap-GMFoot\MoCap-GMFoot.main.any"
Scanning...
Parsing...
Constructing model tree...
ERROR(SCR.PRS9) :  D:/Documents/A..s/A..)/Body/A..n/FootGM/Seg.any(223)  :  'ScaleFunction'  :  Unresolved object
Model loading skipped

this is after defining the custom scaling laws.
Code:

Main = {
 
 //** ModelSetup will let you edit the general Marker setup and the Foot Folder location**
  #include "Model/ModelSetup.any"
 //** Trials will let you edit names and Start-End times of the trials**
  #include "Model/TrialSpecificData3.any"

  #define CUSTOM_SCALING_Right_Talus
  #define CUSTOM_SCALING_Right_Calcaneus
 
  #if MotionAndParameterOptimizationModel
  #include "Model/Kinematics.any"
  #endif
 
  #if InverseDynamicModel
  #include "Model/InverseDynamics.any"
  #endif

}; //Main

Sorry if i have misunderstood Pavel.
Many Thanks,
Zach

pgalibarov 03-13-2017 01:21 PM

Zach,

The place to provide these #defines is correct. Did you remove definition of custom scaling functions from HumanModel.any?

If yes, you need to provide them again. If not - it could be that the one for calcaneus is commented out. Please check.

The logic is simple: the scaling law should either use linear one or custom - these switched control behaviour.

Pavel


All times are GMT +2. The time now is 12:50 PM.