Page 1 of 1

Cannot open model after editing the file

Posted: Fri Feb 11, 2022 2:25 am
by choyj1085
Hi everyone.

I tried to observe ankle angle with Opensim but there is no subtalar angle in coordinate windows.
I checked the .osim file and the subtalar joint is constructed as WeldJoint. I guess they can't be shown in coordinates window because they are WeldJoint so I edited it as a CustomJoint. I changed it as a CustomJoint and add the coordinates
However, after I edited the model, I cannot open it. When I open the model, the thing shown below appears.
Image
this is the original code

Code: Select all

<WeldJoint name="subtalar_r">
					<socket_parent_frame>talus_r_offset</socket_parent_frame>
					<socket_child_frame>calcn_r_offset</socket_child_frame>
					<frames>
						<PhysicalOffsetFrame name="talus_r_offset">
							<FrameGeometry name="frame_geometry">
								<socket_frame>..</socket_frame>
								<scale_factors>0.2 0.2 0.2</scale_factors>
							</FrameGeometry>
							<socket_parent>/bodyset/talus_r</socket_parent>
							<translation>-0.055751700000000001 -0.069668900000000006 0.0118604</translation>
							<orientation>-1.7681899999999999 0.906223 1.8196000000000001</orientation>
						</PhysicalOffsetFrame>
						<PhysicalOffsetFrame name="calcn_r_offset">
							<FrameGeometry name="frame_geometry">
								<socket_frame>..</socket_frame>
								<scale_factors>0.2 0.2 0.2</scale_factors>
							</FrameGeometry>
							<socket_parent>/bodyset/calcn_r</socket_parent>
							<translation>0 0 0</translation>
							<orientation>-1.7681899999999999 0.906223 1.8196000000000001</orientation>
						</PhysicalOffsetFrame>
					</frames>
and this is the code I edited

Code: Select all

				<CustomJoint name="subtalar_r">
					
					<socket_parent_frame>talus_r_offset</socket_parent_frame>
					<socket_child_frame>calcn_r_offset</socket_child_frame>
					<coordinates>
						<Coordinate name="subtalar_r">
							<default_value>0</default_value>
							<default_speed_value>0</default_speed_value>
							<range>-1.57079633 1.57079633</range>
							<clamped>true</clamped>
							<locked>false</locked>
							<prescribed_function />
							<prescribed>false</prescribed>
						</Coordinate>
					</coordinates>
					<frames>
						<PhysicalOffsetFrame name="talus_r_offset">
							<FrameGeometry name="frame_geometry">
								<socket_frame>..</socket_frame>
								<scale_factors>0.2 0.2 0.2</scale_factors>
							</FrameGeometry>
							<socket_parent>/bodyset/talus_r</socket_parent>
							<translation>-0.055751700000000001 -0.069668900000000006 0.0118604</translation>
							<orientation>-1.7681899999999999 0.906223 1.8196000000000001</orientation>
						</PhysicalOffsetFrame>
						<PhysicalOffsetFrame name="calcn_r_offset">
							<FrameGeometry name="frame_geometry">
								<socket_frame>..</socket_frame>
								<scale_factors>0.2 0.2 0.2</scale_factors>
							</FrameGeometry>
							<socket_parent>/bodyset/calcn_r</socket_parent>
							<translation>0 0 0</translation>
							<orientation>-1.7681899999999999 0.906223 1.8196000000000001</orientation>
						</PhysicalOffsetFrame>
					</frames>
				</CustomJoint>
Any adivce will be very appreciated to me.

Thanks

Re: Cannot open model after editing the file

Posted: Fri Feb 11, 2022 9:47 am
by aymanh
Hi Yongjin,

While our model files contain CustomJoints, and these are very powerful and versatile, these are typically more complex than you actually need. As such I recommend you use a PinJoint or multiple PinJoints instead to replace the WeldJoint. PinJoints have only one axis, and one coordinate to control and a much simpler XML syntax.

Troubleshooting a snippet of a model file is hard since objects are connected to form the model, also because model file formats change over time so we can't tell if the block you inserted is in sync. with the rest of the file/DocumentVersion up top. AS such it's easier if you copy the XML snippet of a Joint from the same model file to make sure you use the same/consistent format.

Hope this helps,
-Ayman