problem in adding a ligament as 'acl' to the a model

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Mehran Razzaghi
Posts: 18
Joined: Wed Dec 02, 2015 9:49 am

problem in adding a ligament as 'acl' to the a model

Post by Mehran Razzaghi » Thu Oct 28, 2021 1:31 pm

Hi there,
I have a problem in adding a ligament(https://simtk.org/frs/?group_id=933) same as 'ACL' to the model(gait2354). there is an error with the ''Add finalize Connections()'' issue. I followed the answers but it still not working and the error exists. what is your suggestion to solve it?
I attached the picture of the error and the codes.
Thanks.
Attachments
error.JPG
error.JPG (141.04 KiB) Viewed 865 times
code 1.JPG
code 1.JPG (351.07 KiB) Viewed 865 times
code2.JPG
code2.JPG (365.05 KiB) Viewed 865 times

User avatar
Thomas Uchida
Posts: 1793
Joined: Wed May 16, 2012 11:40 am

Re: problem in adding a ligament as 'acl' to the a model

Post by Thomas Uchida » Thu Oct 28, 2021 10:35 pm

what is your suggestion to solve it?
In your script that adds the ligament to the model, perhaps you have forgotten to call finalizeConnections() (or initSystem()) before saving the new model?

User avatar
Mehran Razzaghi
Posts: 18
Joined: Wed Dec 02, 2015 9:49 am

Re: problem in adding a ligament as 'acl' to the a model

Post by Mehran Razzaghi » Thu Oct 28, 2021 11:57 pm

Thanks for your response. I tried to add the ''finalize Connections()'' but it doesn't work. Maybe I added in the wrong position. In which line should I add the ''finalize Connections()''?

User avatar
Thomas Uchida
Posts: 1793
Joined: Wed May 16, 2012 11:40 am

Re: problem in adding a ligament as 'acl' to the a model

Post by Thomas Uchida » Fri Oct 29, 2021 5:43 pm

In what way doesn't it work? If an error is returned, there may be another issue. As an alternative, you could try calling initSystem() just before printing the model to file.

User avatar
Mehran Razzaghi
Posts: 18
Joined: Wed Dec 02, 2015 9:49 am

Re: problem in adding a ligament as 'acl' to the a model

Post by Mehran Razzaghi » Sat Oct 30, 2021 2:49 am

The ''finalizeConnections()'' error will appear.
I copied the codes here. Is it your mean? I added at the end of the codes(blue line).

<Ligament name="aACL">
<isDisabled>false</isDisabled>
<GeometryPath name="">
<PathPointSet name="">
<objects>
<PathPoint name="aACL_f">
<location> -0.009 -0.453 0.011 </location>
<VisibleObject name="">
<!--Set of geometry files and associated attributes, allow .vtp, .stl,
.obj-->
<GeometrySet name="">
<objects/>
<groups/>
</GeometrySet>
<!--Three scale factors for display purposes: scaleX scaleY scaleZ-->
<scale_factors> 1.00000000 1.00000000 1.00000000 </scale_factors>
<!--transform relative to owner specified as 3 rotations (rad) followed by
3 translations rX rY rZ tx ty tz-->
<transform> -0.00000000 0.00000000 -0.00000000 0.00000000 0.00000000 0.00000000 </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> femur_r </body>
</PathPoint>
<PathPoint name="aACL_t">
<location> 0.011 -0.034 0 </location>
<VisibleObject name="">
<!--Set of geometry files and associated attributes, allow .vtp, .stl,
.obj-->
<GeometrySet name="">
<objects/>
<groups/>
</GeometrySet>
<!--Three scale factors for display purposes: scaleX scaleY scaleZ-->
<scale_factors> 1.00000000 1.00000000 1.00000000 </scale_factors>
<!--transform relative to owner specified as 3 rotations (rad) followed by
3 translations rX rY rZ tx ty tz-->
<transform> -0.00000000 0.00000000 -0.00000000 0.00000000 0.00000000 0.00000000 </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> tibia_r </body>
</PathPoint>
</objects>
</PathPointSet>
<VisibleObject name="">
<!--Set of geometry files and associated attributes, allow .vtp, .stl,
.obj-->
<GeometrySet name="">
<objects/>
<groups/>
</GeometrySet>
<!--Three scale factors for display purposes: scaleX scaleY scaleZ-->
<scale_factors> 1.00000000 1.00000000 1.00000000 </scale_factors>
<!--transform relative to owner specified as 3 rotations (rad) followed by
3 translations rX rY rZ tx ty tz-->
<transform> -0.00000000 0.00000000 -0.00000000 0.00000000 0.00000000 0.00000000 </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>
</GeometryPath>
<resting_length>0.037</resting_length>
<!--stiffness of ligament in N/strain-->
<pcsa_force>3600</pcsa_force>
<SimmSpline name="force_length_curve">
<!--x is stretch, y is force in N-->
<x> 0.990000000000000 0.995000000000000 1 1.00500000000000 1.01000000000000 1.01500000000000 1.02000000000000 1.02500000000000 1.03000000000000 1.04000000000000 1.09000000000000 1.14000000000000 1.19000000000000 1.24000000000000 1.29000000000000 </x>
<y> 0 0 0 0.000208333333333333 0.000833333333333333 0.00187500000000000 0.00333333333333333 0.00520833333333333 0.00750000000000000 0.0133333333333333 0.0600000000000000 0.110000000000000 0.160000000000000 0.210000000000000 0.260000000000000 </y>
</SimmSpline>
</finalizeConnections(aACL)>
</Ligament>

Also, I tried with ''initSystem()''. It that same, it did not work. what's the problem can be?

User avatar
Thomas Uchida
Posts: 1793
Joined: Wed May 16, 2012 11:40 am

Re: problem in adding a ligament as 'acl' to the a model

Post by Thomas Uchida » Sat Oct 30, 2021 10:15 am

It is generally not recommended to add components to a model by editing the .osim file manually (particularly in version 4.0 and later). finalizeConnections() is something you would run in a script (e.g., Matlab or Python) before saving the .osim file, not something you add inside the .osim file.

User avatar
Mehran Razzaghi
Posts: 18
Joined: Wed Dec 02, 2015 9:49 am

Re: problem in adding a ligament as 'acl' to the a model

Post by Mehran Razzaghi » Sun Oct 31, 2021 2:37 am

Thanks. I got what is your mean. I just want to try to edit by Notepad++ to see the result. Nevertheless, in this case, (without using e.g., MATLAB or Python ) the there is no way to solve the error of '' finalizeConnections()''?

User avatar
Thomas Uchida
Posts: 1793
Joined: Wed May 16, 2012 11:40 am

Re: problem in adding a ligament as 'acl' to the a model

Post by Thomas Uchida » Sun Oct 31, 2021 6:53 am

The expected contents/format of the .osim file depends on the "OpenSimDocument Version" number at the top. For example, if the version number is greater than 40000, then I believe the PathPoints need a "socket_parent_frame" property that provides the full path to the parent frame. For example:

Code: Select all

<PathPoint name="myPathPoint1">
    <!--Path to a Component that satisfies the Socket 'parent_frame' of type PhysicalFrame (description: The frame in which this path point is defined.).-->
    <socket_parent_frame>/bodyset/femur_r</socket_parent_frame>
    <!--The fixed location of the path point expressed in its parent frame.-->
    <location>1.1 1.2 1.3</location>
</PathPoint>

User avatar
Mehran Razzaghi
Posts: 18
Joined: Wed Dec 02, 2015 9:49 am

Re: problem in adding a ligament as 'acl' to the a model

Post by Mehran Razzaghi » Tue Nov 02, 2021 5:43 am

Thanks a lot for your help.
I tried the structure codes witch you mentioned. It was helpful an worked. The new ligament add to my model. but there is problem the ligaments movement. I mean when I move the knee-angler-r (in the coordinate tab) the body will move without ligaments. I attached the Gif file of the it and also, the picture of the codes. what can be the problem?
Attachments
Codes.JPG
Codes.JPG (372.26 KiB) Viewed 681 times
ezgif.com-gif-maker (.gif
ezgif.com-gif-maker (.gif (723.21 KiB) Viewed 681 times

User avatar
Mehran Razzaghi
Posts: 18
Joined: Wed Dec 02, 2015 9:49 am

Re: problem in adding a ligament as 'acl' to the a model

Post by Mehran Razzaghi » Fri Nov 05, 2021 1:05 am

tkuchida wrote:
Sun Oct 31, 2021 6:53 am
The expected contents/format of the .osim file depends on the "OpenSimDocument Version" number at the top. For example, if the version number is greater than 40000, then I believe the PathPoints need a "socket_parent_frame" property that provides the full path to the parent frame. For example:

Code: Select all

<PathPoint name="myPathPoint1">
    <!--Path to a Component that satisfies the Socket 'parent_frame' of type PhysicalFrame (description: The frame in which this path point is defined.).-->
    <socket_parent_frame>/bodyset/femur_r</socket_parent_frame>
    <!--The fixed location of the path point expressed in its parent frame.-->
    <location>1.1 1.2 1.3</location>
</PathPoint>
I found the solution. it was because of the wrong coding in some parts and coordinates. thanks for your help.

POST REPLY