Can't Get Forward Dynamics To Run

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
Chris Bates
Posts: 15
Joined: Fri Feb 24, 2012 11:50 am

Re: Can't Get Forward Dynamics To Run

Post by Chris Bates » Thu Jul 26, 2012 3:32 pm

Ayman,

Ok, I've changed it to an .obj file. Now my mesh code is:

<ContactMesh name="chair">
<body_name> chair </body_name>
<location>0 0 0</location>
<orientation>0 0 0</orientation>
<filename> C:\OpenSim2.4.0\Geometry\planechair.obj </filename>
</ContactMesh>

I'm not sure about the filename (I assume that's right) and the body_name is the body I created to have the chair welded to the floor.
When I try to create a Hunt Crossley Force with chair in it OpenSim will crash. I have multiple contact spheres at points on the legs, pelvis, and hands to enable the model to push off the chair. Do I need to specify the mesh in a Hunt Crossley Force?

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

Re: Can't Get Forward Dynamics To Run

Post by Ayman Habib » Sat Jul 28, 2012 2:42 pm

Hi Chris,

You need to specify both the Force and the ContactGeomerty. Please consult the attached .osim file (from the tug of war example) for an example and let us know if you continue to have questions.

Best regards,
-Ayman
Attachments
tugOfWar_model.xml
tugofWar model with contact specification
(22.29 KiB) Downloaded 138 times

User avatar
Chris Bates
Posts: 15
Joined: Fri Feb 24, 2012 11:50 am

Re: Can't Get Forward Dynamics To Run

Post by Chris Bates » Mon Jul 30, 2012 9:30 am

Ayman,

When trying to use the code from the tug of war example, OpenSim crashes just like with the Hunt Crossley Force. I was working with it on Friday and without a force for the chair, I was still able to see the chair mesh in OpenSim as a contact surface. Forward dynamics would start but then fail, even if I just left the model in the sitting position. Here is a sample of what I have for forces and contacts:

<HuntCrossleyForce name="foot_r">
<isDisabled> false </isDisabled>
<HuntCrossleyForce::ContactParametersSet name="">
<objects>
<HuntCrossleyForce::ContactParameters name="">
<geometry> floor r_heel_lat r_heel_med r_toe_lat r_toe_med r_toe </geometry>
<stiffness> 100000000.00000000000000000000 </stiffness>
<dissipation> 0.50000000000000000000 </dissipation>
<static_friction> 0.90000000000000002000 </static_friction>
<dynamic_friction> 0.90000000000000002000 </dynamic_friction>
<viscous_friction> 0.6 </viscous_friction>
</HuntCrossleyForce::ContactParameters>
</objects>
<groups/>
</HuntCrossleyForce::ContactParametersSet>
<transition_velocity> 0.10000000000000001000 </transition_velocity>
</HuntCrossleyForce>
<HuntCrossleyForce name="foot_l">
<isDisabled> false </isDisabled>
<HuntCrossleyForce::ContactParametersSet name="">
<objects>
<HuntCrossleyForce::ContactParameters name="">
<geometry> floor l_heel_lat l_heel_med l_toe_lat l_toe_med l_toe </geometry>
<stiffness> 100000000.00000000000000000000 </stiffness>
<dissipation> 0.50000000000000000000 </dissipation>
<static_friction> 0.90000000000000002000 </static_friction>
<dynamic_friction> 0.90000000000000002000 </dynamic_friction>
<viscous_friction> 0.6 </viscous_friction>
</HuntCrossleyForce::ContactParameters>
</objects>
<groups/>
</HuntCrossleyForce::ContactParametersSet>
<transition_velocity> 0.10000000000000001000 </transition_velocity>
</HuntCrossleyForce>
<HuntCrossleyForce name="leg_r">
<isDisabled> false </isDisabled>
<HuntCrossleyForce::ContactParametersSet name="">
<objects>
<HuntCrossleyForce::ContactParameters name="">
<geometry> floor r_leg_ant_lat r_leg_mid_lat r_leg_post_lat r_leg_ant_med r_leg_mid_med r_leg_post_med </geometry>
<stiffness> 100000000.00000000000000000000 </stiffness>
<dissipation> 0.50000000000000000000 </dissipation>
<static_friction> 0.90000000000000002000 </static_friction>
<dynamic_friction> 0.90000000000000002000 </dynamic_friction>
<viscous_friction> 0.6 </viscous_friction>
</HuntCrossleyForce::ContactParameters>
</objects>
<groups/>
</HuntCrossleyForce::ContactParametersSet>
<transition_velocity> 0.10000000000000001000 </transition_velocity>
</HuntCrossleyForce>
<HuntCrossleyForce name="leg_l">
<isDisabled> false </isDisabled>
<HuntCrossleyForce::ContactParametersSet name="">
<objects>
<HuntCrossleyForce::ContactParameters name="">
<geometry> floor l_leg_ant_lat l_leg_mid_lat l_leg_post_lat l_leg_ant_med l_leg_mid_med l_leg_post_med </geometry>
<stiffness> 100000000.00000000000000000000 </stiffness>
<dissipation> 0.50000000000000000000 </dissipation>
<static_friction> 0.90000000000000002000 </static_friction>
<dynamic_friction> 0.90000000000000002000 </dynamic_friction>
<viscous_friction> 0.6 </viscous_friction>
</HuntCrossleyForce::ContactParameters>
</objects>
<groups/>
</HuntCrossleyForce::ContactParametersSet>
<transition_velocity> 0.10000000000000001000 </transition_velocity>
</HuntCrossleyForce>
<HuntCrossleyForce name="pelvis">
<isDisabled> false </isDisabled>
<HuntCrossleyForce::ContactParametersSet name="">
<objects>
<HuntCrossleyForce::ContactParameters name="">
<geometry> floor pelvis_r_lat pelvis_post pelvis_ant pelvis_l_lat </geometry>
<stiffness> 100000000.00000000000000000000 </stiffness>
<dissipation> 0.50000000000000000000 </dissipation>
<static_friction> 0.90000000000000002000 </static_friction>
<dynamic_friction> 0.90000000000000002000 </dynamic_friction>
<viscous_friction> 0.6 </viscous_friction>
</HuntCrossleyForce::ContactParameters>
</objects>
<groups/>
</HuntCrossleyForce::ContactParametersSet>
<transition_velocity> 0.10000000000000001000 </transition_velocity>
</HuntCrossleyForce>
<HuntCrossleyForce name="arm_r">
<isDisabled> false </isDisabled>
<HuntCrossleyForce::ContactParametersSet name="">
<objects>
<HuntCrossleyForce::ContactParameters name="">
<geometry> floor hand_r_index_inf hand_r_5mc_inf hand_r_5mc_sup hand_r_heel hand_r_1mc </geometry>
<stiffness> 100000000.00000000000000000000 </stiffness>
<dissipation> 0.50000000000000000000 </dissipation>
<static_friction> 0.90000000000000002000 </static_friction>
<dynamic_friction> 0.90000000000000002000 </dynamic_friction>
<viscous_friction> 0.6 </viscous_friction>
</HuntCrossleyForce::ContactParameters>
</objects>
<groups/>
</HuntCrossleyForce::ContactParametersSet>
<transition_velocity> 0.10000000000000001000 </transition_velocity>
</HuntCrossleyForce>
<HuntCrossleyForce name="arm_l">
<isDisabled> false </isDisabled>
<HuntCrossleyForce::ContactParametersSet name="">
<objects>
<HuntCrossleyForce::ContactParameters name="">
<geometry> floor hand_l_index_inf hand_l_5mc_inf hand_l_5mc_sup hand_l_heel hand_l_1mc </geometry>
<stiffness> 100000000.00000000000000000000 </stiffness>
<dissipation> 0.50000000000000000000 </dissipation>
<static_friction> 0.90000000000000002000 </static_friction>
<dynamic_friction> 0.90000000000000002000 </dynamic_friction>
<viscous_friction> 0.6 </viscous_friction>
</HuntCrossleyForce::ContactParameters>
</objects>
<groups/>
</HuntCrossleyForce::ContactParametersSet>
<transition_velocity> 0.10000000000000001000 </transition_velocity>
</HuntCrossleyForce>
<ElasticFoundationForce name="contactForce">
<!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
<isDisabled>false</isDisabled>
<ElasticFoundationForce::ContactParametersSet name="contact_parameters">
<objects>
<ElasticFoundationForce::ContactParameters>
<!--Names of geometry objects affected by these parameters.-->
<geometry>chair floor</geometry>
<stiffness>10000000</stiffness>
<dissipation>0.1</dissipation>
<static_friction>0.2</static_friction>
<dynamic_friction>0.2</dynamic_friction>
<viscous_friction>0.01</viscous_friction>
</ElasticFoundationForce::ContactParameters>
</objects>
<groups />
</ElasticFoundationForce::ContactParametersSet>
<transition_velocity>0.01</transition_velocity>
</ElasticFoundationForce>
<PrescribedForce name="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> chair </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.-->
<forceFunctions>
<PiecewiseLinearFunction>
<x> 0 3</x>
<y> 0 588.399</y>
</PiecewiseLinearFunction>
<Constant>
<value>0</value>
</Constant>
<Constant>
<value>0</value>
</Constant>
</forceFunctions>
<!--Three functions describing the location at which the force is applied.-->
<pointFunctions>
<Constant>
<value>0</value>
</Constant>
<Constant>
<value>0</value>
</Constant>
<Constant>
<value>0</value>
</Constant>
</pointFunctions>
<!--Three functions describing the torque the PrescribedForce applies.-->
<torqueFunctions />
</PrescribedForce>



Thanks,
Chris

User avatar
Chris Bates
Posts: 15
Joined: Fri Feb 24, 2012 11:50 am

Re: Can't Get Forward Dynamics To Run

Post by Chris Bates » Thu Aug 02, 2012 9:36 am

Ok, so with no force set detailing the chair I actually managed to get forward dynamics to run out to about 15% before it fails. I have 5 contact points on each foot, 6 on each leg, 4 on the pelvis, and 5 on each hand. All of these are only interacting with the floor (contact half space) in their own force set (right foot, left foot, right leg, etc...). Because of this, the model falls through the chair. When I open the model tree in the Navigator, I'm able to see the chair as a contact surface. Now I just need to have the model interact with the chair itself. Like I've said before, any time I try to put the chair in a force set, OpenSim will crash with a Java runtime error.

Thanks,
Chris

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

Re: Can't Get Forward Dynamics To Run

Post by Ayman Habib » Thu Aug 02, 2012 12:31 pm

Hi Chris,

Good progress. Including the chair may introduce additional problems because:
1. The surface has to be water tight closed.
2. The normals have to be assigned correctly and consistently between adjacent faces.

You may want to replace the chair with two blocks for the back and bottom of the chair and add more contact spheres on the skeleton and retry or you can send us the full model (only parts relevant to troubleshoot and we will look into it using the tools we internally have to troubleshoot contact problems as in 1 & 2 above.

Best of luck,
-Ayman

User avatar
Chris Bates
Posts: 15
Joined: Fri Feb 24, 2012 11:50 am

Re: Can't Get Forward Dynamics To Run

Post by Chris Bates » Thu Aug 02, 2012 2:53 pm

Ayman,

THANK YOU! The water tight closed got me thinking. I built the chair in SolidWorks as extruded solids. Unfortunately, I did not combine them all into one and kept them as pieces when importing into OpenSim. I created a more basic chair that was combined into one solid and OpenSim doesn't crash. Now, Forward Dynamics will run a bit farther until the model falls all the way through the floor. I've tried using the Elastic Foundation Force as well as Hunt Crossley for the hands, pelvis, and legs, but the model still falls.

Thanks,
Chris

POST REPLY