Foot model

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
Christopher Lee
Posts: 9
Joined: Thu Feb 14, 2008 5:55 am

Foot model

Post by Christopher Lee » Fri Mar 14, 2008 3:37 am

Hello,
First I wan't to thank everybody for this great tool. It is simply great, please keep on doing like this.
I am doing researchs on the human foot for robotics and I am looking for a complex foot model (with separate toes joints for example). We wan't to do Inverse Kinematics using Vicon motion capture system.
I try to change the xml model (bothlegs.osim) but I lost myself in the complexity of the file.
Do the geometry file of the separate toes bones exists? How can I give a look at the .vtp files?
Does anybody have a opensim or simm model of such a foot? It would be great.

Best regards,
Christopher

User avatar
Daniel Leib
Posts: 75
Joined: Mon Sep 11, 2006 6:44 am

RE: Foot model

Post by Daniel Leib » Mon Mar 17, 2008 11:20 am

Hi Chris,

The files you seek do exist. If you're on a Windows based system, the geometry files are located at the path <C:\Program Files\OpenSim 1.1\Geometry>

You're right that the xml files are pretty complex - let's break down an example that should serve as a template for what you want to do.

First, you'll need to define the toes as bodies. Below is an example (my comments inserted with %%):

<SimmBody name="l_femur"> %%note that the body is named here. You can name it whatever you like.
<mass> 0.00000000 </mass> %%Mass of the body. Note that in the demo model you're editing, the segments are all massless at this point.
<mass_center> 0.00000000 0.00000000 0.00000000 </mass_center> %%COM with respect to the origin of the segment.
<inertia> 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 </inertia>%%inertial properties, again, start with zero.
<VisibleObject name=""> %%I don't think you need to provide a name here
<geometry_files> l_femur.vtp </geometry_files>%%The geometry file you want to call (one of the toes, for example)
</VisibleObject>
</SimmBody>

Once you've done that for each of the toes, you can now define joints between the bodies you've made and the rest of the foot. The first step in the example you're editing is to name and set the range for the joint (example below):

<SimmCoordinate name="r_knee_angle"> %%Again, named according to a convention you like; the rest of the comments in the xml explain it well.
<!--Allowd range for a coordinate.-->
<range> -2.09439510 0.00000000 </range>
<!--Default value for a coordinate.-->
<default_value> 0.00000000 </default_value>
<!--Tolerance for a coordinate.-->
<tolerance> 0.00000001 </tolerance>
<!--Stiffness of a coordinate.-->
<stiffness> 0.00000000 </stiffness>
<!--Flag (true or false) indicating whether a coordinate is not permitted
outside its range.-->
<clamped> true </clamped>
<!--Flag (true or false) indicating whether a coordinate is fixed or
locked at its current value.-->
<locked> false </locked>
<!--Flag (true or false) indicating whether or not the restraint function
is active.-->
<restraint_active> false </restraint_active>

So that's how you'll set the range. Next, you build the joint itself:

<SimmJoint name="r_hip"> %%Again, named so that you'll remember it
<bodies> pelvis r_femur </bodies> %%The two bodies involved in the joint
<DofSet name="">
<objects>
<SimmTranslationDof name="tx"> %%translation of the joint in x direction
<Value>
<Constant name="">
<value> -0.07070000 </value>
</Constant>
</Value>
</SimmTranslationDof>
<SimmTranslationDof name="ty">%%same in y
<Value>
<Constant name="">
<value> -0.06610000 </value>
</Constant>
</Value>
</SimmTranslationDof>
<SimmTranslationDof name="tz">%%and z
<Value>
<Constant name="">
<value> 0.08350000 </value>
</Constant>
</Value>
</SimmTranslationDof>
<SimmRotationDof name="r1">
<axis> 0.00000000 0.00000000 1.00000000 </axis> %%this says the joint can rotate about z
<coordinate> r_hip_flexion </coordinate>%%Important! This is the name you used when defining the range earlier
<Value>
<natCubicSpline name="">
<x> -6.28318531 6.28318531 </x>
<y> -6.28318531 6.28318531 </y>
</natCubicSpline> %%Note this is 2pi, allowing for a full circle rotation
</Value>
</SimmRotationDof>
<SimmRotationDof name="r2">
<axis> 1.00000000 0.00000000 0.00000000 </axis> %%Rotating about x
<coordinate> r_hip_adduction </coordinate> %%Another of the ranges you'll need to define. You'll need one for each DOF you want each joint to have.
<Value>
<natCubicSpline name="">
<x> -6.28318531 6.28318531 </x>
<y> -6.28318531 6.28318531 </y>
</natCubicSpline>
</Value>
</SimmRotationDof>
<SimmRotationDof name="r3">
<axis> 0.00000000 1.00000000 0.00000000 </axis>
<coordinate> r_hip_rotation </coordinate>
<Value>
<natCubicSpline name="">
<x> -6.28318531 6.28318531 </x>
<y> -6.28318531 6.28318531 </y>
</natCubicSpline>
</Value>
</SimmRotationDof>
</objects>
</DofSet>
</SimmJoint>

So that should do it. You'll need to make sure to alter the other XML files that make reference to the coordinates, bodies, and joints that you've created as well. I recommend OpenXML editor, it's pretty easy to use.

I'm not sure of a stand-alone program to view the vtp files graphically, nothing I have will do it. Maybe someone else has an idea on that.

Have a good one,

-Dan

User avatar
Christopher Lee
Posts: 9
Joined: Thu Feb 14, 2008 5:55 am

RE: Foot model

Post by Christopher Lee » Fri Mar 28, 2008 5:38 am

Hi Daniel,

thank you for your answer, with a little motivation and a good XMLeditor I finally managed to do my own foot model based on Gait2392example. It has only the tibia (and fibula) and a foot with 5 articulated Toes and a Marker on each.

I have a few other questions.


-I find it difficult to judge where to put the markers just like this. Is it possible to change the Marker position directly in openSim (graphically) or is there a standard method you are using? How do I know if I placed the marker in the right place on my foot?


-What is the Adjust Model Marker option doing? (in the scale tool) How is it proceeding to move the markers?


-For a selected Inverse Kinematics motion, I got a message for each frame like this:
"Frame 509 (t=11): total weighted squared error = 0.000694358, marker error: RMS=0.00658767, max=0.00968109 (R.Toe.Mid3)"
What are this Errors? Do you have a mathematical definition? Is the max in meters?

Once again, I'm sorry for all these questions and thank you for what you are doing.

bye bye,

Christopher

User avatar
Daniel Leib
Posts: 75
Joined: Mon Sep 11, 2006 6:44 am

RE: Foot model

Post by Daniel Leib » Fri Mar 28, 2008 6:47 am

Hi Chris,

Congrats on getting it up and running! It's always a good feeling to get a model working consistently.

Marker placement is handled through cues in the xml file as you know. The main way I've gone about adjusting things is below(unfortunately, you can't click and drag the 'expected' location at this point to my knowledge).

Use the "preview static pose" option and visually analyze how far the marker placements are from the locations in the model. If they agree pretty well, the Adjust Model Marker will take care of the small difference without a problem. If not, adjust the expected location in the xml file a bit so they start out closer together. Once you've found the location on one model, it will scale correctly for other subjects if marker placement is consistent.

The move tool moves the location on the skeletal model to the experimentally collected location. Like I mentioned above, it works very well if the two points are pretty close. Not as much if they're far apart in my experience, though I'm using the very simple Plug-In-Gait marker set so things are pretty sensitive to placement. Your model may be less sensitive to differences in placement. I'm a little removed from using OpenSim at the moment, I'm not sure what the exact math there is, though I imagine it uses an algorithm to minimize residual error per marker (rather than a global minimization). Hopefully Dr. Habib can chime in there.

"Frame 509 (t=11): total weighted squared error = 0.000694358, marker error: RMS=0.00658767, max=0.00968109 (R.Toe.Mid3)"

Don't let the term 'Error' worry you too much; in this case, it's not like a software error that might cause major problems, but merely the disagreement between experimental and model data. I believe you're correct in that the length units are all in meters. Again, I'm a little removed from OS right now, but I believe the total weighted squared error reflects the disagreement between all the markers on the model (and joint coordinates if you're using them) and your experimental data, though I'm not sure exactly how they're weighted. In general terms, however, this means that some errors are given more importance than others.

The marker RMS represents the disagreement between where the markers 'should' be and where the experimental data actually is, and the max error is the greatest marker error in the frame with two coordinates (one angle and one marker, if both are being used to drive the model) identified. In your case, you just have the marker present, so it's reporting that the maximum RMS error in that frame was .00968109 and happened at the marker R.Toe.Mid3.

Here's a link to the Wikipedia definition of Root-Mean-Square error:

http://en.wikipedia.org/wiki/Root_mean_square_deviation

All that said, the disagreement in the frame you posted is very small, most likely due to the small size (foot and shank) of the model and good marker placement experimentally. The error in the example files for gait is generally much larger.

Have a good one,

-Dan

User avatar
Ayman Habib
Posts: 2252
Joined: Fri Apr 01, 2005 12:24 pm

RE: Foot model

Post by Ayman Habib » Fri Mar 28, 2008 9:15 am

Thanks Daniel for the response.

Some more info below

1. We don't have graphical editing of markers yet so you'll need to modify the coordinates manually in the XML file. (A possible hack is to make a muscle point at the position of the marker and use graphical editing to position it precisely then remove it after you get the coordinates!)

2. Adjust model marker moves the model’s markers to match experimental marker locations in a static pose. This is done by solving an Inverse Kinematics problem that minimizes the weighted sum of squared errors in marker positions and joint angles (if provided). The weights are specified on the "Static Pose Weights" tab of the scale tool. This total error is what you see in the messages area.

- The units used are meters and radians, if these are not what you want you can change the weights to account for it.

Good luck,
-Ayman



User avatar
Christopher Lee
Posts: 9
Joined: Thu Feb 14, 2008 5:55 am

RE: Foot model

Post by Christopher Lee » Thu Apr 03, 2008 5:12 am


Hello and thank you both,

I really appreciate opensim, now I can continue my research on the human foot for robotics by doing good Inverse Kinematics with my moreless good foot model.

I still have a few questions for you...

In the Gait2392 reference example and in the setup settings for the IK, you are using the option "coordinate data for trial" with a specific .mot file?
What is this option doing?

The next step for me would be an inverse dynamics
I looked in the .mot file because maybe we are planning to buy a foot pressure distribution platform?
Is this .mot file coming from a force reaction plate or from a pressure platform? How do we generate it? Is it the same as for the .trc in Vicon?

I don't understand what is in this file? Can you explain me the lots of "ground_force_vx, ground_force_pz,ground_torque_y..."?



Maybe it is enough for today,

Christopher




User avatar
Ayman Habib
Posts: 2252
Joined: Fri Apr 01, 2005 12:24 pm

RE: Foot model

Post by Ayman Habib » Fri Apr 04, 2008 9:56 am

Hi Christopher,

When running IK (either for marker placement or for proper IK) you can have marker trajectories only or you might also have some "guess" for coordinate values as well (obtained from the motion capture system). If you have the latter, it helps the IK solver converge faster to the correct solution.

The forces you see in the .mot file are the net forces acting on the foot (ground_force_v?), while the location where these forces are applied is specified by (ground_force_p?) Right foot first.

Good luck,
-Ayman

User avatar
Daniel Leib
Posts: 75
Joined: Mon Sep 11, 2006 6:44 am

RE: Foot model

Post by Daniel Leib » Mon Apr 07, 2008 7:41 am

Hi Dr. Habib,

I noticed in the .mot files that come packaged as demos that there's also a ground_torque_x (and _y and _z) in the file. Are these required to get a good solution? What do they represent?

Thanks,

Dan

User avatar
Ayman Habib
Posts: 2252
Joined: Fri Apr 01, 2005 12:24 pm

RE: Foot model

Post by Ayman Habib » Tue Apr 08, 2008 8:31 am

Dan,

Yes, CMC applies these torques along with ground reaction forces.

Typically, the first set corresponds to the ground reaction forces, torques, and center of pressure for the right foot, while the second set corresponds to the analogous data for the left foot.

-Ayman

User avatar
Daniel Leib
Posts: 75
Joined: Mon Sep 11, 2006 6:44 am

RE: Foot model

Post by Daniel Leib » Wed Apr 09, 2008 6:56 am

Great! Thanks.

-Dan

POST REPLY