Page 1 of 1

Knee Joint Definition

Posted: Sat Jun 26, 2021 12:07 am
by ngchiho
Hello all,

I have a question about the knee joint definition in the model "gait2354", which is why the joint location in both parent and child frame are (0 0 0). Isn't this mean these two frames coincide with each other?(But the model is normal in the GUI)

Thank you for your attention! Hope to get the answer.

Chiho Ng

Code: Select all

<Joint>
	<CustomJoint name="knee_r">
	<!--Name of the parent body to which this joint connects its owner body.-->
	<parent_body>femur_r</parent_body>
	<!--Location of the joint in the parent body specified in the parent reference frame. Default is (0,0,0).-->
	<location_in_parent>0 0 0</location_in_parent>
	<!--Orientation of the joint in the parent body specified in the parent reference frame. Euler XYZ body-fixed rotation angles are used to express the orientation. Default is (0,0,0).-->
	<orientation_in_parent>0 0 0</orientation_in_parent>
	<!--Location of the joint in the child body specified in the child reference frame. For SIMM models, this vector is always the zero vector (i.e., the body reference frame coincides with the joint). -->
	<location>0 0 0</location>
	<!--Orientation of the joint in the owing body specified in the owning body reference frame.  Euler XYZ body-fixed rotation angles are used to express the orientation. -->
	<orientation>0 0 0</orientation>
	<!--Set holding the generalized coordinates (q's) that parmeterize this joint.-->
	<CoordinateSet>

Re: Knee Joint Definition

Posted: Sat Jun 26, 2021 4:42 am
by tkuchida
The motion of the knee is defined by a CustomJoint, where "the child body moves with respect to the parent as a function of the generalized coordinates." The SpatialTransform (just below the code you posted) contains the functions that define how the joint moves.

Re: Knee Joint Definition

Posted: Sun Jun 27, 2021 12:45 am
by ngchiho
Thank you so much for your reply!!!

But I wonder, as the code I posted, which axis is the rotation axis of knee flexion/extension. Is it the z axis of parent body(thigh) or the child body(tibia)?

And since there is no translation or rotation between parent frame and child frame (as my understanding of the code I posted), should these two segments overlap each other?

Hope for your reply.

Sincerely.

Re: Knee Joint Definition

Posted: Sun Jun 27, 2021 2:20 pm
by tkuchida
Here is the code that defines the right knee joint:

Code: Select all

<Joint>
    <CustomJoint name="knee_r">
        <!--Name of the parent body to which this joint connects its owner body.-->
        <parent_body>femur_r</parent_body>
        <!--Location of the joint in the parent body specified in the parent reference frame. Default is (0,0,0).-->
        <location_in_parent>0 0 0</location_in_parent>
        <!--Orientation of the joint in the parent body specified in the parent reference frame. Euler XYZ body-fixed rotation angles are used to express the orientation. Default is (0,0,0).-->
        <orientation_in_parent>0 0 0</orientation_in_parent>
        <!--Location of the joint in the child body specified in the child reference frame. For SIMM models, this vector is always the zero vector (i.e., the body reference frame coincides with the joint). -->
        <location>0 0 0</location>
        <!--Orientation of the joint in the owing body specified in the owning body reference frame.  Euler XYZ body-fixed rotation angles are used to express the orientation. -->
        <orientation>0 0 0</orientation>
        <!--Set holding the generalized coordinates (q's) that parmeterize this joint.-->
        <CoordinateSet>
            <objects>
                <Coordinate name="knee_angle_r">
                    <!--Coordinate can describe rotational, translational, or coupled motion. Defaults to rotational.-->
                    <motion_type>rotational</motion_type>
                    <!--The value of this coordinate before any value has been set. Rotational coordinate value is in radians and Translational in meters.-->
                    <default_value>0</default_value>
                    <!--The speed value of this coordinate before any value has been set. Rotational coordinate value is in rad/s and Translational in m/s.-->
                    <default_speed_value>0</default_speed_value>
                    <!--The minimum and maximum values that the coordinate can range between. Rotational coordinate range in radians and Translational in meters.-->
                    <range>-2.0943951 0.17453293</range>
                    <!--Flag indicating whether or not the values of the coordinates should be limited to the range, above.-->
                    <clamped>false</clamped>
                    <!--Flag indicating whether or not the values of the coordinates should be constrained to the current (e.g. default) value, above.-->
                    <locked>false</locked>
                    <!--If specified, the coordinate can be prescribed by a function of time. It can be any OpenSim Function with valid second order derivatives.-->
                    <prescribed_function />
                    <!--Flag indicating whether or not the values of the coordinates should be prescribed according to the function above. It is ignored if the no prescribed function is specified.-->
                    <prescribed>false</prescribed>
                </Coordinate>
            </objects>
            <groups />
        </CoordinateSet>
        <!--Whether the joint transform defines parent->child or child->parent.-->
        <reverse>false</reverse>
        <!--Defines how the child body moves with respect to the parent as a function of the generalized coordinates.-->
        <SpatialTransform>
            <!--3 Axes for rotations are listed first.-->
            <TransformAxis name="rotation1">
                <!--Names of the coordinates that serve as the independent variables of the transform function.-->
                <coordinates>knee_angle_r</coordinates>
                <!--Rotation or translation axis for the transform.-->
                <axis>0 0 1</axis>
                <!--Transform function of the generalized coordinates used to represent the amount of transformation along a specified axis.-->
                <function>
                    <LinearFunction>
                        <coefficients> 1 0</coefficients>
                    </LinearFunction>
                </function>
            </TransformAxis>
            <TransformAxis name="rotation2">
                <!--Names of the coordinates that serve as the independent variables of the transform function.-->
                <coordinates></coordinates>
                <!--Rotation or translation axis for the transform.-->
                <axis>0 1 0</axis>
                <!--Transform function of the generalized coordinates used to represent the amount of transformation along a specified axis.-->
                <function>
                    <Constant>
                        <value>0</value>
                    </Constant>
                </function>
            </TransformAxis>
            <TransformAxis name="rotation3">
                <!--Names of the coordinates that serve as the independent variables of the transform function.-->
                <coordinates></coordinates>
                <!--Rotation or translation axis for the transform.-->
                <axis>1 0 0</axis>
                <!--Transform function of the generalized coordinates used to represent the amount of transformation along a specified axis.-->
                <function>
                    <Constant>
                        <value>0</value>
                    </Constant>
                </function>
            </TransformAxis>
            <!--3 Axes for translations are listed next.-->
            <TransformAxis name="translation1">
                <!--Names of the coordinates that serve as the independent variables of the transform function.-->
                <coordinates>knee_angle_r</coordinates>
                <!--Rotation or translation axis for the transform.-->
                <axis>1 0 0</axis>
                <!--Transform function of the generalized coordinates used to represent the amount of transformation along a specified axis.-->
                <function>
                    <SimmSpline>
                        <x> -2.0944 -1.74533 -1.39626 -1.0472 -0.698132 -0.349066 -0.174533 0.197344 0.337395 0.490178 1.52146 2.0944</x>
                        <y> -0.0032 0.00179 0.00411 0.0041 0.00212 -0.001 -0.0031 -0.005227 -0.005435 -0.005574 -0.005435 -0.00525</y>
                    </SimmSpline>
                </function>
            </TransformAxis>
            <TransformAxis name="translation2">
                <!--Names of the coordinates that serve as the independent variables of the transform function.-->
                <coordinates>knee_angle_r</coordinates>
                <!--Rotation or translation axis for the transform.-->
                <axis>0 1 0</axis>
                <!--Transform function of the generalized coordinates used to represent the amount of transformation along a specified axis.-->
                <function>
                    <SimmSpline>
                        <x> -2.0944 -1.22173 -0.523599 -0.349066 -0.174533 0.159149 2.0944</x>
                        <y> -0.4226 -0.4082 -0.399 -0.3976 -0.3966 -0.395264 -0.396</y>
                    </SimmSpline>
                </function>
            </TransformAxis>
            <TransformAxis name="translation3">
                <!--Names of the coordinates that serve as the independent variables of the transform function.-->
                <coordinates></coordinates>
                <!--Rotation or translation axis for the transform.-->
                <axis>0 0 1</axis>
                <!--Transform function of the generalized coordinates used to represent the amount of transformation along a specified axis.-->
                <function>
                    <Constant>
                        <value>0</value>
                    </Constant>
                </function>
            </TransformAxis>
        </SpatialTransform>
    </CustomJoint>
</Joint>
The joint has 1 degree of freedom. The child frame translates and rotates relative to the parent frame as defined by the SpatialTransform.

Re: Knee Joint Definition

Posted: Sun Jun 27, 2021 7:07 pm
by ngchiho
Thank you so much for your answers! I would learn deeper and have some try on the model building.