Forums Anyscript.org  

Go Back   Forums Anyscript.org > General Forum > AnyBody Modeling System

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 01-11-2019, 09:20 AM
johntiger johntiger is offline
Junior Member
 
Join Date: Jul 2016
Posts: 9
Default Establish a 3 DOFs knee

Hi,

I want to modify the knee joint and increase its DOFs from a hinge joint to a SphericalJoint by modifying the code in the leg.root.any and Interface.any.
AnyKinMeasureOrg KneeFlexion = {
AnyFolder &Thigh = ..Seg.Thigh.KneeJoint;
Thigh ={
AnyRefNode RotNode={
ARel={{....Sign*1,0,0},{0,....Sign*1,0},{0,0,1}};
};
};
AnyFolder &Shank = ..Seg.Shank.KneeJoint;
Shank ={
AnyRefNode RotNode={
ARel={{....Sign*1,0,0},{0,....Sign*1,0},{0,0,1}};
};
};
AnyKinRotational KneeRot={
AnyRefNode &ShankNode = ...Seg.Shank.KneeJoint.RotNode;
AnyRefNode &ThighNode = ...Seg.Thigh.KneeJoint.RotNode;
Type=RotAxesAngles;
};
MeasureOrganizer={0};
};

AnyKinMeasureOrg KneeAbduction= {
AnyKinRotational &KneeJoint=.KneeFlexion.KneeRot;
MeasureOrganizer={1};
};
AnyKinMeasureOrg KneeExternalRotation= {
AnyKinRotational &KneeJoint=.KneeFlexion.KneeRot;
MeasureOrganizer={2};
};

when I run inverse kinematics ,everything goes well (kinematics.png).
However,when I run inverse dynamics, the location of marker on the tibia is not good(kinetics.png).Seen in the attched pictures.
Could you please give me some suggestion?
Thanks very much for your attention.

Best wishes,
johntiger
Attached Images
File Type: png kinematics.png (55.2 KB, 2 views)
File Type: png kinetics.png (13.6 KB, 2 views)
Reply With Quote
  #2  
Old 01-11-2019, 05:16 PM
toerholm's Avatar
toerholm toerholm is offline
AnyBody Support
 
Join Date: Feb 2009
Posts: 955
Default

Hi JohnTiger,

Judging from your code it will not alter any joints it is a set of new measures only.

To modify the knee joint it would exclude the current knee joint using the MechObjectExclude options of the AnyBodyStudy. Then add a new spherical joint instead, using the exclude options it is possible to avoid altering the original AMMR script.

The difference in the pictures may arise if you run a parameter optimization and then somehow fail to transfer the optimized values to the inverse dynamic model. If you use the built in sequence of operations in the MocapModels this should be automatically handled but if you select the operations manually you have to ensure you do it correctly.


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
  #3  
Old 01-13-2019, 03:55 PM
johntiger johntiger is offline
Junior Member
 
Join Date: Jul 2016
Posts: 9
Default

Dear Søren,

Thanks very much for your quick reply.
As for the model,I modified the knee joint from a hinge joint to a spherical joint in the leg.root.any.
AnySphericalJoint &Knee = .Jnt.Knee;

And as for the parameters, I added extra code in the model. And I have transfered the optimized values calculated from inverse kinematics to the inverse dynamic model successfully in the first 20 frames. And the location of the marker on the tibia is good in the beginning, but goes wrong in later frames as I mentioned. Could you please help me with that?

As for your suggestions, I will have a try and replace the previous joint using the MechObjectExclude.

Thanks for your time!

Best regards,
John
Reply With Quote
  #4  
Old 01-14-2019, 10:02 AM
toerholm's Avatar
toerholm toerholm is offline
AnyBody Support
 
Join Date: Feb 2009
Posts: 955
Default

Hi JohnTiger,

It is strange that the correspondance seems to be ok in the start and then deviate.

The only thing i could think of is if you are exporting the joint angles in the knee using one rotational measure and then when applying them in the inverse analysis you are using a different measure or different sequence?, please verify this.


The mechobjectexclude will not change your results, it is just a way to make the model without changing the AMMR body model code.


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
  #5  
Old 01-15-2019, 05:41 AM
johntiger johntiger is offline
Junior Member
 
Join Date: Jul 2016
Posts: 9
Default

Dear Søren,

Thanks very much for your reply.
I have checked the model again and found that the locations of the marker are not good in the first frame.I am sorry for my last reply.
I use step to debug the model.In the first,it runs well,and it shows finishes updating the expressions.And the error took place when the Design variables updated.I guess the optimised locations from the inverse kinematic analysis are not well transmitted to the inverse dynamics steps.

As for the mechobjectexclude code,I have encountered some problems.
I have added the new kneejoint in the inverse kinematic step as following.However,the other two angles are extremly low(max angle 8e-5rad) compared with flexion angle(max angle 1.2 rad).Could you please help me with that?
//AnyObjectPtrArray l1 = ObjSearch("Main.Studies.HumanModel.BodyModel.Right .Leg.Seg.Thigh.KneeJoint","AnyMechObject");
// exclude knee joint
AnyObjectPtrArray l1 = ObjSearch("Main.HumanModel.BodyModel.Right.Leg.Seg .Thigh.KneeJoint","AnyMechObject");
AnyObjectPtrArray l2 = ObjSearchRecursive("Main.HumanModel.BodyModel.Righ t.Leg.Jnt.Knee","*","AnyMechObject");
AnyObjectPtrArray l3 = ObjSearchRecursive("Main.Model.ModelEnvironmentCon nection.JointsAndDrivers.JntDriverRightLegTD","Kne e*","AnyMechObject");

AnyObjectPtrArray KneeExcludeList = arrcat(arrcat(l1,l2), l3);




MechObjectExclude = KneeExcludeList;


AnySphericalJoint Knee = {

AnyRefFrame &ThighNode = Main.Studies.HumanModel.BodyModel.Right.Leg.Seg.Th igh.KneeJoint;
AnyRefFrame &ShankNode = Main.Studies.HumanModel.BodyModel.Right.Leg.Seg.Sh ank.KneeJoint;


AnyKinMeasureOrg KneeFlexion = {
AnyKinRotational KneeRot={
AnyRefNode &ShankNode = Main.Studies.HumanModel.BodyModel.Right.Leg.Seg.Th igh.KneeJoint;
AnyRefNode &ThighNode = Main.Studies.HumanModel.BodyModel.Right.Leg.Seg.Sh ank.KneeJoint;
Type=RotAxesAngles;
};
MeasureOrganizer={0};
};

AnyKinMeasureOrg KneeAbduction= {
AnyKinRotational &KneeJoint=.KneeFlexion.KneeRot;
MeasureOrganizer={1};
};
AnyKinMeasureOrg KneeExternalRotation= {
AnyKinRotational &KneeJoint=.KneeFlexion.KneeRot;
MeasureOrganizer={2};
};
};

I really appreciate your patience.

Best regards,
John
Reply With Quote
  #6  
Old 01-15-2019, 10:31 AM
toerholm's Avatar
toerholm toerholm is offline
AnyBody Support
 
Join Date: Feb 2009
Posts: 955
Default

Hi JohnTiger,

One other thing comes to my mind please ensure that you run the sequence of operations correctly so using the RunAnalysis operation it ensures that the values are transferred correctly and the updates are done.


If you see values in the spherical joint being zero i may indicate that the revolute joint was not excluded correctly. To see if this is the case click on the invserseStudy in the modeltree and go though it's information on joint, drivers, segs… the knee joint should not be present and you should see your new joint there. If this is not the case the exclusion was wrong.

The exclude code looks in principle ok but there are some spaces (e.g. ht.Leg.Seg .Thigh.KneeJoint) in the search terms that are wrong and will affect the result.

Hope it helps

Bets 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
  #7  
Old 01-17-2019, 02:38 PM
johntiger johntiger is offline
Junior Member
 
Join Date: Jul 2016
Posts: 9
Default

Hi Søren,

Thanks very much for your reply!
I am modifying the model and hope it will work.

best regards,
John
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 06:52 PM.