Forums Anyscript.org  

Go Back   Forums Anyscript.org > Professional Forum > Debug model

Notices

Reply
 
Thread Tools Display Modes
  #11  
Old 04-03-2017, 06:36 PM
Zach_Welshman Zach_Welshman is offline
Member
 
Join Date: Sep 2016
Posts: 38
Default GM Foot model with own data

Thank you Søren, I have successfully installed the new libraries and I am getting a new error. Although when i first installed the new envs it didnt install to my anaconda folder at first, but a .conda folder, which is probably an issue on my side in terms of inital set-up.

Code:
ERROR(SCR.EXP0) :   D:/D..s/A..s/A..g/A..n/Beta/M..t/M..l/Environment.any(384)  :   'FootPressureNodeCoeffVec'  :  Error in expression. Please refer to the following error messages for details ...
ERROR(SCR.EXP.FUN.EXT8) :   D:/D..s/A..s/A..g/A..n/Beta/M..t/M..l/Environment.any(372)  :   PressureFunction  :  Exception in Python extention module.
  Python error : ValueError: A value in x_new is below the interpolation range.
  File "D:\Documents\Anyscripts\AMMR.v1.6.2-MyDemo - GMScaling\Application\Beta\MoCap-GMFoot\Model\Final2.py", line 181, in PressureFunction
    ScaleFactor = CellCoeffFunction(timestep)[i] / CoeffSumVec[i]
  File "C:\Program Files\Anaconda3\envs\py27_foot\Lib\site-packages\scipy\interpolate\interpolate.py", line 477, in _evaluate
    out_of_bounds = self._check_bounds(x_new)
I see it is referring to an interpolation issue where where the x_new is below the interpolation range. Is this an issue with the frame rate, my pressure data starts at Frame 1 (10.0 ms) or is it an issue with the interaction between the gait and pressure time steps? Or potentially the Rectangle bottom/Left definition?

Also with the Type3Pressure plate, can you explain a little on the analog Channels 1-8. Aside from Force and moment x,y,z and COP I am struggling to work out what each channel is referring to.

Kind Regards,
Zach
Reply With Quote
  #12  
Old 04-04-2017, 01:32 PM
toerholm's Avatar
toerholm toerholm is offline
AnyBody Support
 
Join Date: Feb 2009
Posts: 865
Default

Hi Zach,

I am unsure what goes wrong with the python code,

I would try to make the input pressure data you have to be exactly the same format as the original data, to rule out any issues related to that. Alternatively you migth be able to alter the python files read your data format.

Concerning the channels, please have a look at c3d.org website, in the documentation section there is a section on forceplates, and there is short description on each type.

Best regards
Søren
__________________
TIP: How to save and load results.
http://wiki.anyscript.org/index.php/All_about_AnyBody_Modeling_System#Save_Load_and_Re play_Results

Subscribe to the forums, click the 'Forum Tools' link above the list of threads then select 'Subscribe to Forum'. You will then have the option to choose the subscription mode for this forum and get an email automatically.
Reply With Quote
  #13  
Old 06-20-2017, 06:37 PM
Zach_Welshman Zach_Welshman is offline
Member
 
Join Date: Sep 2016
Posts: 38
Default GM Foot Model

Hi Soren,

Thank you for your reply. I see there is a long list of detailed scripting inheritance with this model through previous employees.

I have been able to read in my pressure file (which is different to that used in the model) and I have the CooVec tuple from the python script I'm sure this tuple is used to describe the anterior/posterior/lat/med points in the model.

I have these nodes visually in my model view, but I have had to rotate and translate sRel in AnyScript to line up with the foot as it shows in the model (perhaps if i did it in the Python Script it could be more accurate). When i run the inverse dynamics operation the error i'm having is to do with the FootCal1 or foot calibration study and initial condition unable to solve.

Code:
...  InverseDynamicStudy.InitialConditions  :  Kinematic analysis failed in time step 0 : Fail...
I think it might be due to the manual positioning of the pressure data, but i'm not quite sure, would you have any thoughts on this?

Kind Regards,
Zach
Reply With Quote
  #14  
Old 06-22-2017, 11:08 AM
toerholm's Avatar
toerholm toerholm is offline
AnyBody Support
 
Join Date: Feb 2009
Posts: 865
Default

Hi Zach,

I have looked into the model and it uses the the joint angles from the kinematic model to drive the model in this calibration study. So the calibration model here relies on that the kinematics has been finished correctly first, because the joint angles are used by this study.

So the kinematics needs to runs correct before the calibration will be able to run?

Best regards
Søren
__________________
TIP: How to save and load results.
http://wiki.anyscript.org/index.php/All_about_AnyBody_Modeling_System#Save_Load_and_Re play_Results

Subscribe to the forums, click the 'Forum Tools' link above the list of threads then select 'Subscribe to Forum'. You will then have the option to choose the subscription mode for this forum and get an email automatically.
Reply With Quote
  #15  
Old 07-06-2017, 08:17 PM
Zach_Welshman Zach_Welshman is offline
Member
 
Join Date: Sep 2016
Posts: 38
Default GM Foot Model

Hi Søren,

So i have been able to run kinematic analysis with the muscles switched off, but when i try and run the kinematics with the muscles switched on, it fails.

Code:
ERROR(OBJ.MCH.KIN3) :   D:/D..s/A..s/A..y/A..n/Beta/M..t/M..l/Kinematics.any(70)  :   MotionOptimization.InitialConditions  :  Kinematic analysis failed in time step 0 : Velocity analysis is not completed

Do you have any ideas as to why this is the case?

Kind Regards,
Zach
Reply With Quote
  #16  
Old 07-07-2017, 10:08 AM
toerholm's Avatar
toerholm toerholm is offline
AnyBody Support
 
Join Date: Feb 2009
Posts: 865
Default

Hi Zach,

Usually mocap driven models are designed to run in two steps first the kinematics is solved then the joint angles are saved and used in the inverse dynamic simulations with the muscles on. The foot model has also been made in this way, so i would recommend you to follow this approach
  1. Run kinematics without muscles , this will export all joint angles... this will run using overdetermined kinematics
  2. Run inverse with muscles, this will run a model using determined kinematics


Additional info:
There can be difference in kinematics between a model with and without muscles sometimes, because there might be additional segments defined which are used to obtain correct moment arms, i think this is also the case in the foot, so this may explain why you see a different behavior between the two studies.

To see if this can be the explanation go the the modeltree and click the kinematicstudy / inverseStudy and compare the object descriptions. For studies the object description contains a full list of segments, joints, drivers in the study and is a good way to see exactly what is contained in the model.

Best regards
Søren
__________________
TIP: How to save and load results.
http://wiki.anyscript.org/index.php/All_about_AnyBody_Modeling_System#Save_Load_and_Re play_Results

Subscribe to the forums, click the 'Forum Tools' link above the list of threads then select 'Subscribe to Forum'. You will then have the option to choose the subscription mode for this forum and get an email automatically.
Reply With Quote
  #17  
Old 07-12-2017, 05:56 PM
Zach_Welshman Zach_Welshman is offline
Member
 
Join Date: Sep 2016
Posts: 38
Default GM Foot Model

Hi Soren,
I've managed to get the inverse dynamic study to fail at step 17.

Code:
1.0) Inverse dynamic analysis...
1.0) Inverse dynamic analysis...
ERROR(OBJ.MCH.MUS4) :   D:/D..s/A..s/A..y/A..n/Beta/M..t/M..l/InverseDynamics.any(22)  :   InverseDynamicStudy.InverseDynamics  :  Muscle recruitment solver :  solver aborted due to singular KKT matrix
0) Replay Operation...
ERROR(OBJ.OperationReplay1) :   D:/D..s/A..s/A..y/A..n/Beta/M..t/M..l/InverseDynamics.any(22)  :   InverseDynamicStudy.Replay  :  Replaying data failed in time step 17. Data is not ready.
In which conditions this might be the case?

I have a few questions about the format of pressure data.

1. Does the BareFootWalk-PressureData.txt in the repo model contain the pressure of both left and right feet in the matrix.

2. If the BareFootWalk-PressureData.txt in the repo contains just the right foot which direction is the heel strike to toe off in the matrix. Does heel strike to toe off run from the top to the bottom of the matrix or from right to left?

I have tried a few variations of what I think it is, but cannot seem to get it passed time step 17 in the Inverse Dynamic Study.

Thank you for your time,
Zach
Reply With Quote
  #18  
Old 07-31-2017, 11:41 AM
toerholm's Avatar
toerholm toerholm is offline
AnyBody Support
 
Join Date: Feb 2009
Posts: 865
Default

Hi Zach,

Sorry for the slow reply i have been out of office.

The error you have now means that the muscle recruitment solver did not managed to create balance in the model.

This could possibly relate to the way the loads are being applied?
Quote:
1. Does the BareFootWalk-PressureData.txt in the repo model contain the pressure of both left and right feet in the matrix.
I am not sure but i think this is not the case, please open the file and search for left in text if you find a section relatinn to left then it contains it, but i would it is not the case.

Quote:
2. If the BareFootWalk-PressureData.txt in the repo contains just the right foot which direction is the heel strike to toe off in the matrix. Does heel strike to toe off run from the top to the bottom of the matrix or from right to left?
As i recall it the first line relates to the heel strike and the last line in the section relates to the toe off, so heel strike to toe off runs top to bottom.

The KKT error means that some DOF in the model is not carried by the muscles. Sometimes it can be a good idea to add artificial torque generators in the joints to detect which dof are giving the the problem and the try to alter the muscles/ligaments/loads/calibration. To see how this is done take look in the JointMuscle.any file of the leg or arm and then try to replicated this for the foot joints.

Best regards
Søren
__________________
TIP: How to save and load results.
http://wiki.anyscript.org/index.php/All_about_AnyBody_Modeling_System#Save_Load_and_Re play_Results

Subscribe to the forums, click the 'Forum Tools' link above the list of threads then select 'Subscribe to Forum'. You will then have the option to choose the subscription mode for this forum and get an email automatically.
Reply With Quote
  #19  
Old 08-01-2017, 06:02 PM
Zach_Welshman Zach_Welshman is offline
Member
 
Join Date: Sep 2016
Posts: 38
Default GM Foot Model

Thank you for your reply Søren and I will have a look at the that.

Recently, I have been tinkering with the final2.py file specifically in the section:

Code:
  


# Scale the bell function coeff sum to match the measured cell coeff
    #*******************************************************************
    for i in range(len(CoeffMat)):
        if CoeffSumVec[i] == 0:
            ScaleFactor = 0
        else:
            ScaleFactor = CellCoeffFunction(timestep)[i] / CoeffSumVec[i]
        for j in range(len(CoeffMat[0])):
            CoeffMat[i][j] = CoeffMat[i][j] * ScaleFactor
I have changed this section to:

Code:
  # Scale the bell function coeff sum to match the measured cell coeff
    #*******************************************************************
    for i in range(len(CoeffMat)):
        if CoeffSumVec[i] == 0:
            ScaleFactor = 0
        else:
            #ScaleFactor = CellCoeffFunction(timestep)[i] / CoeffSumVec[i]
              ScaleFactor = 0.0344
        for j in range(len(CoeffMat[0])):
            CoeffMat[i][j] = CoeffMat[i][j] * ScaleFactor
The inverse dynamics sequence runs further as a I reduce the 0.0344 to 0.001, but the resultant forces from the pressure nodes do not look to be delivering the appropriate force per timestep.

When I run the original piece of python script the error returns:

Code:
Python error : ValueError: A value in x_new is below the interpolation range.
  File "D:\Documents\Anyscripts\AMMR.v1.6.2-MyDemo - GMScaling\Application\Beta\MoCap-GMFoot\Model\Final2.py", line 181, in PressureFunction
    ScaleFactor = CellCoeffFunction(timestep)[i] / CoeffSumVec[i]
  File "C:\Program Files\Anaconda3\envs\py27_foot\Lib\site-packages\scipy\interpolate\interpolate.py", line 477, in _evaluate
    out_of_bounds = self._check_bounds(x_new)
Would it be possible for you or a python expert at AnyBody to help explain how the final2.py script interacts with the AMS.

My pressuredata.txt is is in a similar format as the repository model with the exception the frame every 10ms (repo model is 2ms) the pressure.txt inputs are:

Rectangle bottom
12
Rectangle left
18
Rectangle width
25
Rectangle height
54

and the Environment.any footlocation4.py reads:

Code:
AnyFolder &GlobalRef = .GlobalRef;
    GlobalRef = {
      AnyRefNode StrikeFootRef = {
        sRel = {..FootLocationCooVec[0] -0.35, ..FootLocationCooVec[1] -0.52, 0}*RotMat(-pi,y)*RotMat(-pi,x);
        AnyDrawNode Draw = {ScaleXYZ=0.005*{1,1,1}; RGB={1,0,0};};
      };
      AnyRefNode PosteriorFootRef = {
        sRel = {..FootLocationCooVec[2 ]-0.35, ..FootLocationCooVec[3] -0.56, 0}*RotMat(-pi,y)*RotMat(-pi,x);
        AnyDrawNode Draw = {ScaleXYZ=0.005*{1,1,1}; RGB={0,1,0};};
      };
      AnyRefNode AnteriorMedialFootRef = {
        sRel = {..FootLocationCooVec[4] -0.35, ..FootLocationCooVec[5] -0.52, 0}*RotMat(-pi,y)*RotMat(-pi,x);
        AnyDrawNode Draw = {ScaleXYZ=0.005*{1,1,1}; RGB={0,0,1};};
      };
      AnyRefNode AnteriorLateralFootRef = {
        sRel = {..FootLocationCooVec[6] -0.35, ..FootLocationCooVec[7] -0.52, 0}*RotMat(-pi,y)*RotMat(-pi,x);
        AnyDrawNode Draw = {ScaleXYZ=0.005*{1,1,1}; RGB={1,1,0};};
      };
      AnyRefNode DistalFootRef = {
        sRel = {..FootLocationCooVec[8] -0.35, ..FootLocationCooVec[9] -0.52, 0}*RotMat(-pi,y)*RotMat(-pi,x);
        AnyDrawNode Draw = {ScaleXYZ=0.005*{1,1,1}; RGB={0,0,0};};
      };
     AnyRefNode DistalPhal1Ref = {
        sRel = {..FootLocationCooVec[10] -0.35, ..FootLocationCooVec[11] -0.52, 0}*RotMat(-pi,y)*RotMat(-pi,x);
        AnyDrawNode Draw = {ScaleXYZ=0.005*{1,1,1}; RGB={0,0,0};};
      };
      AnyRefNode DistalPhal2Ref = {
        sRel = {..FootLocationCooVec[12] -0.35, ..FootLocationCooVec[13] -0.52, 0}*RotMat(-pi,y)*RotMat(-pi,x);
        AnyDrawNode Draw = {ScaleXYZ=0.005*{1,1,1}; RGB={0,0,0};};
      };
    };
Also, Is it possible to print the matrix on the AnyBody GUI?

Kind Regards,
Zach

Last edited by Zach_Welshman; 08-01-2017 at 08:58 PM. Reason: Additional Question
Reply With Quote
  #20  
Old 08-02-2017, 10:05 AM
toerholm's Avatar
toerholm toerholm is offline
AnyBody Support
 
Join Date: Feb 2009
Posts: 865
Default

Hi Zach,

It looks to me like there is a mismatch between the time of your study and the data in the file.

The error you get relates to that the it is try to extrapolate the data which is not possible.

So it reads the data first into an interpolation function and then it use the interpoaltion function which it created using "timestep", this value comes from AnyBody and it seems to not macth the time from the file.

You wrote the that the that the sampling is different, please check if there are harcoded smapling setting in the .py files which needs to be changed in your case.

Another cause of error could be if you have non syncronized data, so mismatch between time in mocap and pressure data.

I would not scale the data, like you have tried.

Best regards
Søren
__________________
TIP: How to save and load results.
http://wiki.anyscript.org/index.php/All_about_AnyBody_Modeling_System#Save_Load_and_Re play_Results

Subscribe to the forums, click the 'Forum Tools' link above the list of threads then select 'Subscribe to Forum'. You will then have the option to choose the subscription mode for this forum and get an email automatically.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:00 PM.