Page 1 of 1
Problem inverse kinematics
Posted: Fri May 21, 2010 2:26 am
by jjmordang
Hi,
I've been using the lower limb model to analyse human gait and it is really useful, thank you very much!
However, I've encountered a problem when I use the inverse kinematics. After IK the segments of the foot, ankle and knee move a little bit but the pelvis still remains on the same place. I noticed that with the example models of OpenSim that the motion of a model remains on the same place. Meanwhile my experimental data walks along the x-axis.
Is there a simple solution to this problem?
I hope it is a little bit clear what i mean.
Kind regards,
Jan-Jurre
RE: Problem inverse kinematics
Posted: Thu May 27, 2010 3:44 pm
by emarnold
Hi Jan-Jurre,
It would help me to understand if you could send me a sample of the files you're using, but here are a couple points:
1. The OpenSim examples use treadmill data, that's why they remain in the same space.
2. The pelvis in this model has no degrees of freedom relative to ground, so it can't move in space in your IK solution. You could add these degrees of freedom to the model pretty easily. Just so you know, I'll be posting an updated version of the model for gait with 2 legs and these DOFs in late June.
-Edith
RE: Problem inverse kinematics
Posted: Mon Jun 07, 2010 2:21 am
by jjmordang
Hi Edith,
The data is use are not treadmill data. I think indeed it I have to change the degrees of freedom between the pelvis and the ground but I can't figure it out how to do this. Maybe this is also a problem for my other thread (the scaling problem)? If you want I can send you the .osim file and the .trc files of both a walking and static experiment?
Thank you very much for your time and help,
Jan-Jurre
RE: Problem inverse kinematics
Posted: Mon Jun 07, 2010 5:03 am
by jjmordang
Hi,
The DOF's are added successfully. However the scaling is still a bit rubbish. The virtual markers are still floating above the feet and their initial positions. And during the inverse kinematics the patella detaches from the knee which looks kind of strange.
Does anyone know what I'm doing wrong?
Kind regards,
Jan-Jurre
RE: Problem inverse kinematics
Posted: Mon Jun 07, 2010 1:08 pm
by emarnold
Well, it's not worth worrying about IK until you have a scaling solution you're happy with. I added some details about scaling on your other thread.
But the patella problem is related to a known visualization bug with coordinate coupler constraints (the way the patella is implemented) so that it's initially in the wrong place after scaling. Jiggle the knee angle coordinate slider and it recalculates the coordinate coupler constraint and puts it back where it should be.
RE: Problem inverse kinematics
Posted: Thu Oct 14, 2010 1:07 pm
by mbebelveras
Hi,
I'm a begginer in OpenSim. I've already read the user's guide but I dont't know where I can find how to insert degrees of freedom in the pelvis. Can you help me pointing where I can find how to do it ?!
thanks
Maria Isabel
RE: Problem inverse kinematics
Posted: Thu Oct 14, 2010 5:15 pm
by emarnold
Hi Maria,
I'm happy to help, could you tell me which model you're trying to
modify? The 2-leg model has 6 degrees of freedom for the pelvis.
At this time, there's no way to modify a model this way in the GUI,
but it's easy to do by modifying the .osim file directly. Step one is
to get an xml editor. I like Notepad++ which is free to download.
I will cross-post the response on the Modeler's Kitchen help forum:
https://simtk.org/forum/forum.php?forum_id=1661
-Edith
RE: Problem inverse kinematics
Posted: Thu Oct 14, 2010 6:04 pm
by emarnold
Step 1: Get an xml editor. I use Notepad++ which is freely downloadable.
Step 2: Tell your xml editor what a .osim file is.
In Notepad++ do this by going to Settings > Style Configurator
Scroll down in the "Language:" list until you find XML. Below this you'll see an uneditable box called "Default ext:" Next to that is a box called "User ext:"
Type "osim" (without the quotes) in that box, click "Save&Close"
Now .osim files will have all their xml tags colored and collapsible, making them much easire to read.
There's lots of stuff at the beginning of the file that we don't need to worry about for adding degrees of freedom to a joint, so I'll get to those another time. For now, click the little box with a - in it next to "defaults" and hide that stuff. Same for "publications" and anything else you don't want to see. In Notepad++ you can use alt+anumber to collapse everything to that level.
Step 3: Find the pelvis body. Open and close levels until you find
BodySet > objects> Body name = "pelvis"
Step 4: Find the joint that connects the pelvis to something else.
In the case of the 2 leg, lower limb model from 2010, or the gait 2392 model this will be a joint between the pelvis body and the parent_body "ground"
What type of joint is it?
If it is a WeldJoint, then there are zero degrees of freedom between the pelvis and ground. The location and orientation attributes will describe how the pelvis relates to ground, but this cannot change.
For a 6-dof joint, we'll want a CustomJoint.
Step 5: Replace the WeldJoint with a 6-dof CustomJoint.
Find a model that has a 6-dof custom joint similar to the one you want. Copy everything from <CustomJoint name="ground_pelvis" to /CustomJoint>. Paste it into your model where there was a WeldJoint. Look at the names and parameters for each coordinate like initial_value, range, etc. (these are in radians) and change any that are not appropriate for your use. Give credit to the people who made the model you're adapting.
Save, open it in OpenSim to make sure you've got what you wanted.
If you see a message that says something like "XMLDocument.XMLDocument: ERROR- SAX exception while attempting to parse..." Then you probably forgot to close an xml tag.
You're done!
The "copy, modify, credit" method is also useful for adding new bodies onto a model. In this case you'll also have to locate those bodies in the frame of the parent body. One easy way to do this is to place the body approximately, open the model in the GUI and add a marker in the frame of the parent body. Click on it while holding control, then drag it around until it's where you want your new body to be located. Use the coordinate of this marker for the location_in_parent value of your xml file. Save, open, see if it's in the right place. Lather, rinse, repeat.
I hope that helps!
-Edith
RE: Problem inverse kinematics
Posted: Fri Oct 15, 2010 7:17 am
by mbebelveras
Hi Edith,
thank you for your help. I think it worked.
I'm making a preliminary study and i'm working with old data. I was needing a one-leg model that could move in space so I modified your "single-leg opensim" version with the pelve of the "2-leg and hat" model.
Maria Isabel