Elastic foundation

SCONE is a software tool for predictive simulations of biomechanical movement. It uses OpenSim for modeling and simulation, and performs optimization using various control strategies, including feed-forward control, proprioceptic feedback control, and bal
POST REPLY
User avatar
Andrés Hidalgo
Posts: 14
Joined: Wed Jun 09, 2021 2:52 pm

Elastic foundation

Post by Andrés Hidalgo » Wed Aug 04, 2021 5:22 am

Hello,
Is there any way to compute GRF using Elastic foundation forces? I get an error when trying to reproduce a gait simulation from tutorial examples. I have tried by using the GH2010 controller.

Best regards

Andres

User avatar
Thomas Geijtenbeek
Posts: 437
Joined: Wed Mar 12, 2014 8:08 am

Re: Elastic foundation

Post by Thomas Geijtenbeek » Wed Aug 04, 2021 12:46 pm

It should not be a problem, but I have never tested it so it may require some additional development.

If you are willing to send me the model with the elastic foundation forces, I can make sure it will work.

User avatar
Andrés Hidalgo
Posts: 14
Joined: Wed Jun 09, 2021 2:52 pm

Re: Elastic foundation

Post by Andrés Hidalgo » Fri Aug 06, 2021 4:09 am

Hello Thomas,
Thank you for your help. Please find attached the OpenSim model and the SCONE file.
Before going into detail and just to clarify. It is not my final objective to work with Elastic foundation, I wanted to use HuntCrossley method but I have problems to include the contact geometry I need (finite plane or discontinuous surface with an edge) into OpenSim.

I will explain a bit more about what I want to obtain.

Objective
I am intending the OpenSim musculoskeletal model to walk over a block to a certain height and let the model fall from the edge (forcing a free falling simulation after walking). I want the model fall from an edge and see the model during free falling. The physical scenario could be and edge between a horizontal and vertical plane or it could also be an edge between an inclined and vertical plane.
I would prefer to use HuntCrossley contact forces since it seems to be more accurate than Elastic foundation, but I do not know of to include edges in OpenSim without using mesh surfaces.

What I have already tried
In order to introduce an edge in the ground surface to simulate the falling I created a big volume using mesh surface into OpenSim. I used this approach since the alternative for not using mesh from Simbody seems to be to use SmoothHeightMap, but this capability it is not yet implemented in OpenSim (at least I was not able to find it).
Contact forces with mesh surfaces only work using Elastic foundation model forces so, this is why I need to compute Elastic foundation forces in SCONE.

Software used
I am using SCONE build from source with OpenSim 4.2

Notes
The error seems to be detected by the GaitController code. If I use the model with the Standing Balance example, the simulation does not crash.

Error message
GaitStateController
GaitStateController could not find any legs in f0916m.
Please make sure the following values are setup correctly in the Model:
-leg_upper_body(default is femur)
-leg_lower_body(default is two bodies below leg_upper_body)
-leg_contact_force (default is foot)

Please let me know whether you are able to successfully run the walk and free falling simulation or you need more data or additional files.

Best regards

Andres
Attachments
EF_SCONE.rar
(55.66 KiB) Downloaded 72 times

User avatar
Thomas Geijtenbeek
Posts: 437
Joined: Wed Mar 12, 2014 8:08 am

Re: Elastic foundation

Post by Thomas Geijtenbeek » Mon Aug 09, 2021 8:20 am

Thank you for the clear explanation!

I checked the code, and the ElasticFoundationForce indeed wasn't supported by SCONE. This is now fixed, so if you build from the latest version it will be supported (including visualization). It will also be included in the next SCONE release, if you are a Windows user (please let me know and I will make a release).

To get your scenario to work, you only need to specify the name of your contact forces. In your case, you can do so by including the line:

Code: Select all

leg_contact_force = contact
Even though it now works, simulation speed is rather slow. This is probably the result of how collision detection between to meshes works in OpenSim. Changing the foot contact geometry to a sphere may improve speed.

Also, the upcoming version of Hyfydy (see https://hyfydy.com) will support Hunt-Crossley forces between boxes and spheres (at much faster simulation speed). It will also be available in SCONE, so it might be an option to look out for that.

User avatar
Andrés Hidalgo
Posts: 14
Joined: Wed Jun 09, 2021 2:52 pm

Re: Elastic foundation

Post by Andrés Hidalgo » Tue Aug 10, 2021 5:45 am

Hi Thomas, thank you for your help.
Regarding your question, yes, I am a Windows user.
The example is still not working to me. In this sense I have two questions.
The first one is related to the version I am building, I do not know if I am using the version with your corrections. I have just cloned again the repo from github. I supposed your updates were included but I see the latest updates come from months ago, is the github version the latest SCONE source code version to build in order to solve the EF problem? Then, I do not know where should I include the code (leg_contact_force = contact). I included as a line into the gaitcontroller file (ControllerGH2010asym.scone) but I still have the same error. Can you please tell me where should I include this code?

Hyfydy
Before you mentioned in your answer, I had downloaded the latest SCONE Beta version with Hyfydy and installed it. The problem I have is that when I open the GUI I cannot run any scenario because I have the following errors (depending on the scenario I open).
If I try to open the scenario (Gait - H0914 - OpenSim4.scone) I have this error message:
SimTK Exception thrown at State.cpp:974:
Error detected by Simbody method getCacheEntry: State Cache entry was out of date at Stage Dynamics. This entry depends on version 9 of Stage Dynamics but was last updated at version 7.
(Required condition 'version == m_dependsOnVersionWhenLastComputed' was not met.)
If I try to open the scenario (Standing High Jump - OpenSim3.scone) I have the following error:
SimTK Exception thrown at StateImpl.h:1678:
State Cache entry was out of date at Stage Dynamics. This entry depends on version 10 of Stage Dynamics but was last updated at version 9.
I still do not have the Fyfydy license, can be these errors due to this?

Best regards

Andres

User avatar
Thomas Geijtenbeek
Posts: 437
Joined: Wed Mar 12, 2014 8:08 am

Re: Elastic foundation

Post by Thomas Geijtenbeek » Tue Aug 10, 2021 9:13 am

Hi Andres, I'm sorry for the trouble! The SCONE github repository has moved, it is now located at:

https://github.com/tgeijten/scone-studio

This is where the updates for the ElasticFoundationForce have been applied, so if you build from there you should be fine.

The leg_contact_force setting should be added somewhere inside the ModelOpenSim4 section:

Code: Select all

ModelOpenSim4 {
	model_file = data/Human0916_Import_HightEdgeV4.osim
	leg_contact_force = contact
	
	...
}
You do not need to update the Controller, it will work automatically once this setting is defined.

The issues you mention with 2.0.0 BETA 5 I have not seen before -- it almost appears as if a wrong DLL has been loaded. Did you install to the default folder (i.e. C:/Program Files/SCONE)? It might help to uninstall and reinstall SCONE. Otherwise, does the problem remain if you install an earlier 2.0.0 release of SCONE?

A Hyfydy license will be send to you shortly. This is not likely the cause of this issue though.

User avatar
Andrés Hidalgo
Posts: 14
Joined: Wed Jun 09, 2021 2:52 pm

Re: Elastic foundation

Post by Andrés Hidalgo » Wed Aug 11, 2021 11:31 pm

Hi Thomas,
Thank you for your reply and the trial license.

SCONE build from source and SCONE-2.0.0-BETA-5
I installed and build the latest version of SCONE from scone-studio repo. The problem now is that I have the same error with SCONE build from source than with SCONE-2.0.0-BETA-5 downloaded from Hyfydy Web site. The error is this one:


SimTK Exception thrown at State.cpp:974:
Error detected by Simbody method getCacheEntry: State Cache entry was out of date at Stage Dynamics. This entry depends on version 9 of Stage Dynamics but was last updated at version 7.
(Required condition (version == m_dependsOnVersionWhenLastComputed) was not met.)


One point to note is that the error with SCONE-2.0.0-BETA-5 does not appear when using (ModelHyfydy) instead of (ModelOpenSim4), i.e. when I open any of the scenarios (...-Hyfydy.scone) SCONE loads the scenario without error. On the contrary, when I try to load any of the other scenarios based on ModelOpenSim4, the same SimTK errors previously reported show up.
It seems this latest release have some issues with OpenSim 4.2.
Note:
When building SCONE from source the OpenSim directory I am pointing to in cmake is an OpenSim build from source (OpenSim 4.2). In this case, the Simbody dir used in cmake configuration is the Simbody distribution provided by OpenSim 4.2.

SCONE-1.5.0
This version does not have any error. But only works with OpenSim3 and does not include the latest EF forces improvement you added.

Hyfydy
This is a new multibody engine? How can the musculoskeletal models be modified or how can we include robotic devices?

Please let me know whether you need more data in order to solve this issue.

Best regards

Andres

User avatar
Andrés Hidalgo
Posts: 14
Joined: Wed Jun 09, 2021 2:52 pm

Re: Elastic foundation

Post by Andrés Hidalgo » Thu Aug 12, 2021 2:10 am

Hi Thomas,
Thank you again for your support. Fortunately and I do not exactly why, everything start working after some uninstalling and installing processes. I also have some Windows updates yesterday. I do not know, but the good thing is that both (SCONE from source and SCONE from Hyfydy) seems to be working correctly now.

User avatar
Thomas Geijtenbeek
Posts: 437
Joined: Wed Mar 12, 2014 8:08 am

Re: Elastic foundation

Post by Thomas Geijtenbeek » Thu Aug 12, 2021 3:21 am

That's good to hear! Please let me know if the issue ever comes up again.

POST REPLY