Page 1 of 1

Fixing "Loose" Weldconstraint

Posted: Tue Oct 07, 2014 5:42 am
by drewc47
Hi guys, been starting to work with OpenSim as part of my thesis, and so far it's been going alright, forum answers have generally been really helpful to here.

I am currently modelling a 4bar linkage prosthetic knee, and am finding a slight problem when using Weldconstraint (and also Pointconstraint). The constraint is loose, likely due to the following error message:

Model unable to assemble: AssemblySolver::assemble() Failed: SimTK Exception thrown at Assembler.cpp:843:
Method Assembler::assemble() failed because:
Optimizer failed with message: SimTK Exception thrown at InteriorPointOptimizer.cpp:261:
Optimizer failed: Ipopt: Restoration failed (status -2)
Assembly error tolerance achieved: 6.42970780784236e-011 required: 1e-009.
Model relaxing constraints and trying again.

The weldconstraint code:
<WeldConstraint name="pros_u_l_weld">
<isDisabled> false </isDisabled>
<body_1> pros_uaxle </body_1>
<body_2> pros_laxle </body_2>
<location_body_1> 0.00000000 0.00000000 -0.03750000 </location_body_1>
<orientation_body_1> 0 0 0 </orientation_body_1>
<location_body_2> 0.00000000 0.00000000 -0.03750000 </location_body_2>
<orientation_body_2> 0 0 0 </orientation_body_2>
</WeldConstraint>

Any suggestions to fix this constraint?

Re: Fixing "Loose" Weldconstraint

Posted: Tue Oct 07, 2014 6:22 am
by ex10192
Hi,

Just one doubt, I noticed that the location you have provided for both the bodies are same. In my previous studies, I had taken 2 bodies and wanted to weld them, and for which I took points on each body based on its own local coordinate and not a common point.

I might be wrong but you could try.

Nithin

Re: Fixing "Loose" Weldconstraint

Posted: Tue Oct 07, 2014 7:20 am
by drewc47
Hi Nithin,

Both of the bodies are copies of the same original. It is essentially 2 axles and connecting bars split along the midpoint. The local coordinate for the connecting point would be the same for each, as they are copies (Splitting the 4th link in a 4bar linkage due to joint limitations, and using a weldconstraint to close the loop).

Re: Fixing "Loose" Weldconstraint

Posted: Tue Oct 07, 2014 11:04 am
by aseth
A few thoughts: 1) Can the mechanism be assembled to the accuracy specified? It isn't the case that the solution is just out of reach for any value of q considering the precision of the segment lengths? 2) If you know the solution is reachable, what are the initial conditions? Would the violation have to get worse before getting better? Ipopt cannot do that. 3) The assembler tries hard to respect the default values provided, so if you don't care about the individual angles or just care about 1 (as the driver) set the <is_free_to_satisfy_constraints> flag to true for the coordinates you don't care about. The assembler will free up those dofs and will not try to satisfy the default value provided.

Re: Fixing "Loose" Weldconstraint

Posted: Tue Oct 07, 2014 5:05 pm
by drewc47
Hi Ajay,

Brilliant, adding <is_free_to_satisfy_constraints>true</is_free_to_satisfy_constraints> worked perfectly. Thanks for your help.

Re: Fixing "Loose" Weldconstraint

Posted: Thu Jul 06, 2023 5:10 am
by sxp
Hi,I am sorry to bother you,would you be convenient to share that where should I write the code'<is_free_to_satisfy_constraints>true</is_free_to_satisfy_constraints>' ?Is it supposed to be written in <Coordinate> part of the <Joint>? I will appreciate it very much if you could spare your valuable time to reply to me!

Re: Fixing "Loose" Weldconstraint

Posted: Thu Jul 06, 2023 5:36 am
by syretted
Hi XiPeng,
Here is an example of this option for a medial condylar joint when used in a model based on the Lerner knee model. Hope this helps:

Code: Select all

<CustomJoint name="med_cond_joint_r">
<!--Path to a Component that satisfies the Socket 'parent_frame' of type PhysicalFrame (description: The parent frame for the joint.).--><socket_parent_frame>sagittal_articulation_frame_r_offset</socket_parent_frame>
<!--Path to a Component that satisfies the Socket 'child_frame' of type PhysicalFrame (description: The child frame for the joint.).-->
<socket_child_frame>med_cond_r_offset</socket_child_frame>
<!--List containing the generalized coordinates (q's) that parameterize this joint.-->
<coordinates>
	<Coordinate name="med_cond_adduction_r">
	<!--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.0943950999999998 2.0943950999999998</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 identifies whether or not this coordinate can change freely when posing the model to satisfy kinematic constraints.  When true, the coordinate's initial or specified value is ignored when considering constraints. This allows values for important coordinates, which have this flag set to false, to dictate the value of unimportant coordinates if they are linked via constraints.-->
	<is_free_to_satisfy_constraints>true</is_free_to_satisfy_constraints>
	</Coordinate>
</coordinates>

Re: Fixing "Loose" Weldconstraint

Posted: Fri Jul 07, 2023 1:43 am
by sxp
Hi Edward,thank you for your reply and it does help me figure out the question I posted.However,I find that this method can not solve my problem .:cry:In my operation,I met this kind of error like following:

Method Assembler::assemble() failed because:
Optimizer failed with message: SimTK Exception thrown at InteriorPointOptimizer.cpp:264:
Optimizer failed: Ipopt: Not enough degrees of freedom (status -10)
Assembly error tolerance achieved: 0.029999999999999971 required: 1e-10..Model relaxing constraints and trying again.

And I am trying to fix the simple exoskeleton model to the body model using the 'WeldConstraint'.This error make me unable to use the 'simulate' function in opensim.I am curious if you know how to solve this problem.And I also wonder what is the rule of the evaluation of assembly tolerance,that is,how can I improve the tolerance when I assemble the exoskeloton model to the human body?

Best wishes!