Adding degrees of freedom to the knee joint

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Cai Birch
Posts: 31
Joined: Tue Jan 02, 2018 7:40 am

Adding degrees of freedom to the knee joint

Post by Cai Birch » Wed Nov 21, 2018 7:06 am

Hi, I'm using the Hamner full body model and want to add a rotational degree of freedom around the X axis to allow for slight genu valgum/varum when scaling the model. Does anyone know how this is accomplishable? So far my attempts have resulted in my model displaying extreme genu varum...

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>true</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>
									<Coordinate name="knee_adduction_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>-0.34 0.34</range>
										<!--Flag indicating whether or not the values of the coordinates should be limited to the range, above.-->
										<clamped>true</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>knee_adduction_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>
										<Constant>
											<value>1 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>

Tags:

User avatar
Nicos Haralabidis
Posts: 188
Joined: Tue Aug 16, 2016 1:46 am

Re: Adding degrees of freedom to the knee joint

Post by Nicos Haralabidis » Wed Nov 21, 2018 7:29 am

Hello Cai,

From the code snippet it looks like your range of knee adduction/abduction is +- 19.4 deg. The 'range' tag is in radians - have you tried to lower the range value?

Kind regards,

Nicos Haralabidis

User avatar
Cai Birch
Posts: 31
Joined: Tue Jan 02, 2018 7:40 am

Re: Adding degrees of freedom to the knee joint

Post by Cai Birch » Wed Nov 21, 2018 7:37 am

Hi Nicos,

Yeah, I've tried reducing the knee abduction/aduction range to +-0.1 radians but it hasn't had any effect. The scaling still results in an extreme genu varum (approx 30ish deg) :/

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Adding degrees of freedom to the knee joint

Post by jimmy d » Wed Nov 21, 2018 9:12 am

It may help to change the <TransformAxis> function from a Constant to a Linear function (similar to knee_angle_r)

User avatar
Cai Birch
Posts: 31
Joined: Tue Jan 02, 2018 7:40 am

Re: Adding degrees of freedom to the knee joint

Post by Cai Birch » Wed Nov 28, 2018 5:00 am

Thanks James, That worked grand.

POST REPLY