forces in joints

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
Uwe Mittag
Posts: 23
Joined: Mon Dec 06, 2010 2:09 am

Re: forces in joints

Post by Uwe Mittag » Wed Jul 03, 2013 4:00 am

Thanks Ayman and Jiang,

again shortly what I want to implement:
two sticks with a principally free joint in between, but the joint producing resistance when bended (bushing force?). And of course I need the possibility to induce this bending by pressing against the body who is not ground.
Below my approach so far, using an actuator. Actuator does not seem to be the right choice as Ayman said, but how else to apply a simple force?

Thanks in advance and best kind regards
Uwe

Here the model (again my question, if there is no way to upload a textfile for this purpose). As far as I believe, it has two cylinders scaled to 2cm length with a rotational stiffness of 0.1 (whatever that means). I have already reduced that value, because I was afraid not to see the effect because the stiffness is to high.

<?xml version="1.0" encoding="UTF-8" ?>
<OpenSimDocument Version="30000">
<Model name="multisegment_test">
<credits>The OpenSim Development Team (Reinbolt, J; Seth, A; Habib, A; Hamner, S)</credits>
<publications>This is an example model distributed with OpenSim</publications>
<length_units>meters</length_units>
<force_units>N</force_units>
<!--Acceleration due to gravity.-->
<gravity> 0 0 0</gravity>
<!--Bodies in the model.-->
<BodySet>
<objects>
<Body name="ground">
<mass>0</mass>
<mass_center> 0 0 0</mass_center>
<inertia_xx>0.1</inertia_xx>
<inertia_yy>0.1</inertia_yy>
<inertia_zz>0.02</inertia_zz>
<inertia_xy>0</inertia_xy>
<inertia_xz>0</inertia_xz>
<inertia_yz>0</inertia_yz>
<!--Joint that connects this body with the parent body.-->
<Joint />
<VisibleObject>
<!--Set of geometry files and associated attributes, allow .vtp, .stl, .obj-->
<GeometrySet>
<objects>
<DisplayGeometry>
<!--Name of geometry file .vtp, .stl, .obj-->
<geometry_file>cyl_small.stl</geometry_file>
<!--Color used to display the geometry when visible-->
<color> 1 1 1</color>
<!--Name of texture file .jpg, .bmp-->
<texture_file />
<!--in body transform specified as 3 rotations (rad) followed by 3 translations rX rY rZ tx ty tz-->
<transform> -0 0 -0 0 0 0</transform>
<!--Three scale factors for display purposes: scaleX scaleY scaleZ-->
<scale_factors> 0.01 0.01 0.01</scale_factors>
<!--Display Pref. 0:Hide 1:Wire 3:Flat 4:Shaded-->
<display_preference>4</display_preference>
<!--Display opacity between 0.0 and 1.0-->
<opacity>1</opacity>
</DisplayGeometry>
</objects>
<groups />
</GeometrySet>
<!--Three scale factors for display purposes: scaleX scaleY scaleZ-->
<scale_factors> 1 1 1</scale_factors>
<!--transform relative to owner specified as 3 rotations (rad) followed by 3 translations rX rY rZ tx ty tz-->
<transform> -0 0 -0 0 0 0</transform>
<!--Whether to show a coordinate frame-->
<show_axes>false</show_axes>
<!--Display Pref. 0:Hide 1:Wire 3:Flat 4:Shaded Can be overriden for individual geometries-->
<display_preference>4</display_preference>
</VisibleObject>
</Body>
<Body name="cyl2">
<mass>0.1</mass>
<mass_center> 0 0 0</mass_center>
<inertia_xx>0.1</inertia_xx>
<inertia_yy>0.1</inertia_yy>
<inertia_zz>0.02</inertia_zz>
<inertia_xy>0</inertia_xy>
<inertia_xz>0</inertia_xz>
<inertia_yz>0</inertia_yz>
<!--Joint that connects this body with the parent body.-->
<Joint>
<FreeJoint name="joint1">
<!--Name of the parent body to which this joint connects its owner body.-->
<parent_body>ground</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.01</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.01</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="_xRotation">
<!--Coordinate can describe rotational, translational, or coupled motion. Defaults to rotational.-->
<motion_type>rotational</motion_type>
<!--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="_yRotation">
<!--Coordinate can describe rotational, translational, or coupled motion. Defaults to rotational.-->
<motion_type>rotational</motion_type>
<!--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="_zRotation">
<!--Coordinate can describe rotational, translational, or coupled motion. Defaults to rotational.-->
<motion_type>rotational</motion_type>
<!--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="_xTranslation">
<!--Coordinate can describe rotational, translational, or coupled motion. Defaults to rotational.-->
<motion_type>translational</motion_type>
<!--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="_yTranslation">
<!--Coordinate can describe rotational, translational, or coupled motion. Defaults to rotational.-->
<motion_type>translational</motion_type>
<!--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="_zTranslation">
<!--Coordinate can describe rotational, translational, or coupled motion. Defaults to rotational.-->
<motion_type>translational</motion_type>
<!--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>
</FreeJoint>
</Joint>
<VisibleObject>
<!--Set of geometry files and associated attributes, allow .vtp, .stl, .obj-->
<GeometrySet>
<objects>
<DisplayGeometry>
<!--Name of geometry file .vtp, .stl, .obj-->
<geometry_file>cyl_small.stl</geometry_file>
<!--Color used to display the geometry when visible-->
<color> 1 1 1</color>
<!--Name of texture file .jpg, .bmp-->
<texture_file />
<!--in body transform specified as 3 rotations (rad) followed by 3 translations rX rY rZ tx ty tz-->
<transform> -0 0 -0 0 0 0</transform>
<!--Three scale factors for display purposes: scaleX scaleY scaleZ-->
<scale_factors> 0.01 0.01 0.01</scale_factors>
<!--Display Pref. 0:Hide 1:Wire 3:Flat 4:Shaded-->
<display_preference>4</display_preference>
<!--Display opacity between 0.0 and 1.0-->
<opacity>1</opacity>
</DisplayGeometry>
</objects>
<groups />
</GeometrySet>
<!--Three scale factors for display purposes: scaleX scaleY scaleZ-->
<scale_factors> 1 1 1</scale_factors>
<!--transform relative to owner specified as 3 rotations (rad) followed by 3 translations rX rY rZ tx ty tz-->
<transform> -0 0 -0 0 0 0</transform>
<!--Whether to show a coordinate frame-->
<show_axes>false</show_axes>
<!--Display Pref. 0:Hide 1:Wire 3:Flat 4:Shaded Can be overriden for individual geometries-->
<display_preference>4</display_preference>
</VisibleObject>
</Body>
</objects>
</BodySet>
<!--Constraints in the model.-->
<ConstraintSet>
<objects />
<groups />
</ConstraintSet>
<!--Forces in the model.-->
<ForceSet>
<objects>
<BushingForce name="Joint1Bushing">
<!--One of the two bodies connected by the bushing.-->
<body_1>ground</body_1>
<!--The other of the two bodies connected by the bushing.-->
<body_2>cyl2</body_2>
<!--Location of bushing frame on body 1.-->
<location_body_1>0 0 0.01</location_body_1>
<!--Orientation of bushing frame in body 1 as x-y-z, body fixed Euler rotations.-->
<orientation_body_1>0 0 0</orientation_body_1>
<!--Location of bushing frame on body 2.-->
<location_body_2>0 0 -0.01</location_body_2>
<!--Orientation of bushing frame in body 2 as x-y-z, body fixed Euler rotations.-->
<orientation_body_2>0 0 0</orientation_body_2>
<!--Stiffness parameters resisting relative rotation (Nm/rad).-->
<rotational_stiffness>0.1 0.1 0.1</rotational_stiffness>
<!--Stiffness parameters resisting relative translation (N/m).-->
<translational_stiffness>0 0 0</translational_stiffness>
<!--Damping parameters resisting relative angular velocity. (Nm/(rad/s))-->
<rotational_damping>0 0 0</rotational_damping>
<!--Damping parameters resisting relative translational velocity. (N/(m/s)-->
<translational_damping>0 0 0</translational_damping>
</BushingForce>
<PointActuator name="bending_force">
<!--Name of Body to which this actuator is applied.-->
<body>cyl2</body>
<!--Location of application point; in body frame unless point_is_global=true-->
<point>0 0 0.01</point>
<!--Interpret point in Ground frame if true; otherwise, body frame.-->
<point_is_global>false</point_is_global>
<!--Force application direction; in body frame unless force_is_global=true.-->
<direction>1 0 0</direction>
<!--Interpret direction in Ground frame if true; otherwise, body frame.-->
<force_is_global>true</force_is_global>
<!--The maximum force produced by this actuator when fully activated.-->
<optimal_force>80</optimal_force>
</PointActuator>
</objects>
<groups />
</ForceSet>
<!--Markers in the model.-->
<MarkerSet>
<objects />
<groups />
</MarkerSet>
<!--ContactGeometries in the model.-->
<ContactGeometrySet>
<objects />
<groups />
</ContactGeometrySet>
</Model>
</OpenSimDocument>

User avatar
Jiang Ping
Posts: 132
Joined: Sun Aug 26, 2012 4:09 am

Re: forces in joints

Post by Jiang Ping » Wed Jul 03, 2013 8:55 am

Hi,

You specified actuator but forgot to specify a controller to control it.
If you just want to add a force to the body, you can try this:

<PrescribedForce>
<!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
<isDisabled>false</isDisabled>
<!--Name of the body the force is applied to.-->
<body></body>
<!--Flag indicating whether the point (specified in pointFunctions) is in global frame.-->
<pointIsGlobal>false</pointIsGlobal>
<!--Flag indicating whether the quantities (specified in force/torqueFunctions) is in global frame.-->
<forceIsGlobal>true</forceIsGlobal>
<!--Three functions describing the force to be applied.-->
<FunctionSet name="forceFunctions">
<objects />
<groups />
</FunctionSet>
<!--Three functions describing the location at which the force is applied.-->
<FunctionSet name="pointFunctions">
<objects />
<groups />
</FunctionSet>
<!--Three functions describing the torque the PrescribedForce applies.-->
<FunctionSet name="torqueFunctions">
<objects />
<groups />
</FunctionSet>
</PrescribedForce>

best regards,
Jiang

User avatar
Uwe Mittag
Posts: 23
Joined: Mon Dec 06, 2010 2:09 am

Re: forces in joints

Post by Uwe Mittag » Thu Jul 04, 2013 4:21 am

Thank you Jiang,

it seems to work now. I first had problems to find how to manage the functions for the prescribedforce, but I found a functionset somewhere in the examples. But I am astonished, how long the integration is running for this little task. It is at 100% since a long time and always working. But the behaviour is as expected: moving to a bended situation and staying at an equilibrium position.

Thanks and kind regards
Uwe

User avatar
Fabian Bayerlein
Posts: 18
Joined: Fri Apr 05, 2013 2:12 pm

Re: forces in joints

Post by Fabian Bayerlein » Thu Jul 04, 2013 1:26 pm

Hallo Uwe,

see picture for uploading of attachments.

Best,
Fabian
Attachments
attachment.jpg
Comment

User avatar
Jiang Ping
Posts: 132
Joined: Sun Aug 26, 2012 4:09 am

Re: forces in joints

Post by Jiang Ping » Wed Jul 10, 2013 4:11 pm

mittag wrote:Thank you Jiang,

it seems to work now. I first had problems to find how to manage the functions for the prescribedforce, but I found a functionset somewhere in the examples. But I am astonished, how long the integration is running for this little task. It is at 100% since a long time and always working. But the behaviour is as expected: moving to a bended situation and staying at an equilibrium position.

Thanks and kind regards
Uwe
Hi,

I'm not familiar with the .xml.
If you want to add a constant force on a body, try this

PrescribedForce *f=new PrescribedForce(*body yourbody)
f->setForceFunction=(new constant(fx),new constant(fy),new constant(fz))
f->setPointFunction=(new constant(px),new constant(py),new constant(pz))
model.addforce(f)

Hope this will help you, thanks

Jiang

User avatar
Uwe Mittag
Posts: 23
Joined: Mon Dec 06, 2010 2:09 am

Re: forces in joints

Post by Uwe Mittag » Tue Jul 23, 2013 12:29 am

Hi thanks,

I have a 6-segment tibia now working more or less (using a prescribed force), but the dynamics runs seems to crash after some few ten of milliseconds. Up to may be 20 millisecs it reacts on stop commands and I can see the expected behaviour of bending with small oscillations. Would be nice to find the reason for that.

Now I want to integrate my bending tibia into one of your gate models. Is it possible to define the 6-segment tibia together with its bushing forces and joint as a body group, that can be aligned and scaled as a whole?

Thanks again and best regards
Uwe

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

Re: forces in joints

Post by Ayman Habib » Thu Jul 25, 2013 1:21 pm

Hi Uwe,

If you're using our components (so we can reproduce the crash you reported in house), then please file a bug report and attach the model and all necessary files and we'll troubleshoot.

As it stands, the scale tool works on individual segments rather than groups although you can apply the same scale factor to multiple segments. BushingForces do not scale altogether so you'll have to scale their geometry and properties manually.

Hope this helps,
-Ayman

User avatar
Uwe Mittag
Posts: 23
Joined: Mon Dec 06, 2010 2:09 am

Re: forces in joints

Post by Uwe Mittag » Wed Nov 12, 2014 8:03 am

Hi,
I found the time to continue with this subject. I have added my segments manually to the model. It looks nice when I load the model. But when I run the inverse kinematics, the joints between my segments do not behave as they should. They show lot of translation in the joints. The bushing forces do not seem to work in the inverse kinematics. How can I influence the translation stiffness of my free joints in the inverse kinematics?

Best regards
Uwe

User avatar
Ajay Seth
Posts: 136
Joined: Thu Mar 15, 2007 10:39 am

Re: forces in joints

Post by Ajay Seth » Wed Nov 12, 2014 11:49 am

An inverse kinematics analysis is a purely kinematic analysis. There is no evaluation of any forces (no system dynamics). Specifically, it is the solution for the generalized (or internal) coordinates (joint angles, etc...) that match measurements of spatial (or absolute) coordinate measurements such as marker positions in ground (lab). If you are looking to have a dynamical system (model dynamics) follow experimental data then that it is generally the solution to a tracking problem.

CMC is a tracking controller, but it tracks the internal coordinates (not markers) from IK. It also has the requirement that each coordinate be controllable- that is each coordinate is accelerated by at least one actuator. That is why residual actuators are applied to the pelvis dofs.

User avatar
Uwe Mittag
Posts: 23
Joined: Mon Dec 06, 2010 2:09 am

Re: forces in joints

Post by Uwe Mittag » Thu Nov 13, 2014 4:51 am

Thank you Ajay,

I have now introduced very tight ranges for the translation DOF of my tibia segments and I checked carefully, whether parent and child positions of the joints are at the right place using a marker. Narrow translation ranges should have an effect already for the inverse kinematic, is'nt it? But again the segments have been shifted much more than the joints should allow. Do you have an example for me how to configure freejoints properly?

Kind regards
Uwe

POST REPLY