Questions about weld constraint

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Zu Xueying
Posts: 7
Joined: Wed Apr 21, 2021 5:59 am

Questions about weld constraint

Post by Zu Xueying » Fri Jul 02, 2021 12:41 am

Hello all, I tried to add a weld constraint to my model ,but I encountered some problems. When I write the code like this

Code: Select all

<ConstraintSet name="constraintset">
	<objects>
		<WeldConstraint name="tuigan1_qiufu">
			<frame1name>qiufu1_offset</frame1name>
			<frame2name>tuigan1_offset</frame2name>
		</WeldConstraint>
	</objects>
</ConstraintSet>


Then there will be an error message:
Failed to connect Socket 'frame1' of type PhysicalFrame (details: Connectee for Socket 'frame1' of type PhysicalFrame in WeldConstraint at /constraintset/tuigan1_qiufu is unspecified. If this model was built programmatically, perhaps finalizeConnections() was not called before printing.
Thrown at Component.h:3344 in finalizeConnection().).
In Object 'tuigan1_qiufu' of type WeldConstraint.
Thrown at Component.cpp:313 in finalizeConnections()
And if I write the code like this

Code: Select all

		<ConstraintSet name="constraintset">
			<objects>
				<WeldConstraint name="tuigan1_qiufu">
					<frame1name>qiufu1_offset</frame1name>
					<frame2name>tuigan1_offset</frame2name>
					<frames>
						<PhysicalOffsetFrame name="tuigan1_offset">
							<!--The geometry used to display the axes of this Frame.-->
							<FrameGeometry name="frame_geometry">
								<!--Path to a Component that satisfies the Socket 'frame' of type Frame.-->
								<socket_frame>..</socket_frame>
								<!--Scale factors in X, Y, Z directions respectively.-->
								<scale_factors>0.20000000000000001 0.20000000000000001 0.20000000000000001</scale_factors>
							</FrameGeometry>
							<!--Path to a Component that satisfies the Socket 'parent' of type C (description: The parent frame to this frame.).-->
							<socket_parent>/bodyset/tuigan1</socket_parent>
							<!--Translational offset (in meters) of this frame's origin from the parent frame's origin, expressed in the parent frame.-->
							<translation>0 0.021250000000000002 0.00080000000000000004</translation>
							<!--Orientation offset (in radians) of this frame in its parent frame, expressed as a frame-fixed x-y-z rotation sequence.-->
							<orientation>3.1416927000000001 0 0</orientation>
						</PhysicalOffsetFrame>
						<PhysicalOffsetFrame name="qiufu1_offset">
							<!--The geometry used to display the axes of this Frame.-->
							<FrameGeometry name="frame_geometry">
								<!--Path to a Component that satisfies the Socket 'frame' of type Frame.-->
								<socket_frame>..</socket_frame>
								<!--Scale factors in X, Y, Z directions respectively.-->
								<scale_factors>0.20000000000000001 0.20000000000000001 0.20000000000000001</scale_factors>
							</FrameGeometry>
							<!--Path to a Component that satisfies the Socket 'parent' of type C (description: The parent frame to this frame.).-->
							<socket_parent>/bodyset/qiufu1</socket_parent>
							<!--Translational offset (in meters) of this frame's origin from the parent frame's origin, expressed in the parent frame.-->
							<translation>0 0.02 0</translation>
							<!--Orientation offset (in radians) of this frame in its parent frame, expressed as a frame-fixed x-y-z rotation sequence.-->
							<orientation>1.5708 0 0</orientation>
						</PhysicalOffsetFrame>
					</frames>
			</WeldConstraint>
			</objects>
		</ConstraintSet>
Then the model cannot be shown in Opensim. I wonder why did this happen and how should I correct the code.
Thanks for your help!

Tags:

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

Re: Questions about weld constraint

Post by Ayman Habib » Fri Jul 02, 2021 10:46 am

Hello,

As of version 4.0, the specification of objects/components in the model file has been made more strict, and a full path (e.g. /bodyset/tuigan1) is now required where only name (tuigan1) was needed in the past.

When you refer to a frame by name only within a constraint set, it looks for the frame under the constraint set, and it fails because it can't find it. If this is not the intention and you want a frame that lives under the bodyset then you would need to prepend /bodyset to the frame name. The class ComponentPath describes how you need to specify a component in the model https://simtk.org/api_docs/opensim/api_ ... tPath.html

In the application/GUI, when you hover over the node corresponding to a component, the full component path is shown in a tooltip.

Hope this helps,
-Ayman

User avatar
Zu Xueying
Posts: 7
Joined: Wed Apr 21, 2021 5:59 am

Re: Questions about weld constraint

Post by Zu Xueying » Sun Jul 11, 2021 11:40 pm

aymanh wrote:
Fri Jul 02, 2021 10:46 am
Hello,

As of version 4.0, the specification of objects/components in the model file has been made more strict, and a full path (e.g. /bodyset/tuigan1) is now required where only name (tuigan1) was needed in the past.

When you refer to a frame by name only within a constraint set, it looks for the frame under the constraint set, and it fails because it can't find it. If this is not the intention and you want a frame that lives under the bodyset then you would need to prepend /bodyset to the frame name. The class ComponentPath describes how you need to specify a component in the model https://simtk.org/api_docs/opensim/api_ ... tPath.html

In the application/GUI, when you hover over the node corresponding to a component, the full component path is shown in a tooltip.

Hope this helps,
-Ayman
thanks a lot!

POST REPLY