Issues related to IAA

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Mohammadreza Rezaie
Posts: 400
Joined: Fri Nov 24, 2017 12:48 am

Issues related to IAA

Post by Mohammadreza Rezaie » Thu Aug 20, 2020 9:30 am

Dear Experts

To practice the IAA tool, I added these lines to AnalysisSet:

Code: Select all

<InducedAccelerations name="InducedAccelerations">
	<on>true</on>
	<start_time>0</start_time>
	<end_time>5</end_time>
	<step_interval>10</step_interval>
	<in_degrees>true</in_degrees>
	<coordinate_names> All</coordinate_names>
	<body_names> center_of_mass</body_names>
	<ConstraintSet name="constraintset">
		<objects>
			<RollingOnSurfaceConstraint name="right_foot_contact">
				<isEnforced>false</isEnforced>
				<socket_rolling_body>/bodyset/calcn_r</socket_rolling_body>
				<socket_surface_body>/ground</socket_surface_body>
				<surface_normal>0 1 0</surface_normal>
				<surface_height>0</surface_height>
				<friction_coefficient>0.75</friction_coefficient>
				<contact_radius>0.01</contact_radius>
			</RollingOnSurfaceConstraint>
			<RollingOnSurfaceConstraint name="left_foot_contact">
				<isEnforced>false</isEnforced>
				<socket_rolling_body>/bodyset/calcn_r</socket_rolling_body>
				<socket_surface_body>/ground</socket_surface_body>
				<surface_normal>0 1 0</surface_normal>
				<surface_height>0</surface_height>
				<friction_coefficient>0.75</friction_coefficient>
				<contact_radius>0.01</contact_radius>
			</RollingOnSurfaceConstraint>
		</objects>
	</ConstraintSet>
	<force_threshold>6</force_threshold>
	<compute_potentials_only>false</compute_potentials_only>
	<report_constraint_reactions>true</report_constraint_reactions>
</InducedAccelerations>

The first issue is that although the "socket_rolling_body" is set to "/bodyset/calcn_r" and the nex to "/ground", but when I load the setup file in Analyze tool, these two arguments become empty and I have to write the "calcn_r" and "ground" again.

The second issue is that this error apears:

Performing Induced Accelerations Analysis
time = 0.73
time = 0.733192
time = 0.737745
time = 0.740851
time = 0.745007
External force expressedInBody ground not found.
Exception:
ArrayPtrs.get: Array index out of bounds.



I was reading in the forum that changing the "ground" to the contact segment (e.g calcn_X) in the Eternal_loads.XML file can fix the issue:

<force_expressed_in_body>calcn_r</force_expressed_in_body>
<point_expressed_in_body>calcn_r</point_expressed_in_body>



And the IAA ran successfully without any error.
Is this a right way? If I want to use pipline, I have to create two External_load files, one for ID, RRA and CMC and one IAA.

I wonder if anyone would helm me to fix these two issue.

Your help is much appreciated.

Regards,
Mohammadreza

Tags:

User avatar
Carlos Gonçalves
Posts: 135
Joined: Wed Jun 08, 2016 4:56 am

Re: Issues related to IAA

Post by Carlos Gonçalves » Thu Sep 26, 2024 11:52 pm

Hello Mohammadreza, I'm getting the same behavior in OpenSim 4.4.

It is definitely a bug. When I load the .xml, the IAA field is changed, clearing the information about the bodies in RollingOnSurfaceConstraint.
errorIAA.png
errorIAA.png (151.94 KiB) Viewed 158 times
And it happens as well if you load the .xml file using the API in Python. I manage to update the values using this piece of code:

Code: Select all

iaa = analise2.getAnalysisSet().get(0)
CS = iaa.getPropertyByName('ConstraintSet')
CSo = CS.getValueAsObject()
CS_obj = CSo.getPropertyByIndex(1) # <objects>
constraintR = CS_obj.updValueAsObject(0) #<RollingOnSurface ... >
constraintL = CS_obj.updValueAsObject(1) #<RollingOnSurface ... >
propriedade = constraintR.updPropertyByName('socket_rolling_body')
osim.PropertyHelper.setValueString('/bodyset/calcn_r', propriedade)
propriedade = constraintR.updPropertyByName('socket_surface_body')
osim.PropertyHelper.setValueString('/ground', propriedade)

propriedade = constraintL.updPropertyByName('socket_rolling_body')
osim.PropertyHelper.setValueString('/bodyset/calcn_l', propriedade)
propriedade = constraintL.updPropertyByName('socket_surface_body')
osim.PropertyHelper.setValueString('/ground', propriedade)
And the External Forces File can be generated using the options here: https://github.com/opensim-org/opensim-core/issues/2076

But that is not all... When I run the AnalyzeTool, it complains that the State was not loaded. I load the State and it complains that the it has different states number compared to the loaded model...

Any help would be wonderful, since using the GUI is still a limitation with this bug.

Best regards.

User avatar
Carlos Gonçalves
Posts: 135
Joined: Wed Jun 08, 2016 4:56 am

Re: Issues related to IAA

Post by Carlos Gonçalves » Fri Sep 27, 2024 1:31 am

UPDATE,

To make it clearer:

Code: Select all

analise3 = osim.AnalyzeTool('analise.xml')

iaa = analise3.getAnalysisSet().get(0)
CS = iaa.updPropertyByName('ConstraintSet')
CSo = CS.updValueAsObject()
CS_obj = CSo.updPropertyByIndex(1) # <objects>
constraintR = CS_obj.updValueAsObject(0) #<RollingOnSurface ... >
constraintL = CS_obj.updValueAsObject(1) #<RollingOnSurface ... >
propriedade = constraintR.updPropertyByName('socket_rolling_body')
osim.PropertyHelper.setValueString('/bodyset/calcn_r', propriedade)
propriedade = constraintR.updPropertyByName('socket_surface_body')
osim.PropertyHelper.setValueString('/ground', propriedade)

propriedade = constraintL.updPropertyByName('socket_rolling_body')
osim.PropertyHelper.setValueString('/bodyset/calcn_l', propriedade)
propriedade = constraintL.updPropertyByName('socket_surface_body')
osim.PropertyHelper.setValueString('/ground', propriedade)

analise3.verifyControlsStates() ## ok, i passes

analise3.run() # fails

Code: Select all

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Input In [14], in <cell line: 1>()
----> 1 analise3.run()

File c:\Users\Carlo\.conda\envs\opensim44\lib\site-packages\opensim\tools.py:3902, in AnalyzeTool.run(self, *args)
   3901 def run(self, *args) -> "bool":
-> 3902     return _tools.AnalyzeTool_run(self, *args)

RuntimeError: std::exception in 'bool OpenSim::AnalyzeTool::run()': Failed to connect Socket 'rolling_body' of type PhysicalFrame (details: Connectee for Socket 'rolling_body' of type PhysicalFrame in RollingOnSurfaceConstraint at /constraintset/right_foot_contact is unspecified. If this model was built programmatically, perhaps finalizeConnections() was not called before printing.
	Thrown at Component.h:3383 in finalizeConnection().).
	In Object 'right_foot_contact' of type RollingOnSurfaceConstraint.
	Thrown at Component.cpp:313 in finalizeConnections().
The thing is that I specify the PhysicalFrame in both XML and in the code above...
socorro.xml
(8.7 KiB) Downloaded 6 times

User avatar
Carlos Gonçalves
Posts: 135
Joined: Wed Jun 08, 2016 4:56 am

Re: Issues related to IAA

Post by Carlos Gonçalves » Fri Sep 27, 2024 7:03 am

UPDATE,

I took a leap of faith and tested in OpenSim 4.5, but I got the same behavior in OpenSim GUI.

Best regards.

User avatar
Mohammadreza Rezaie
Posts: 400
Joined: Fri Nov 24, 2017 12:48 am

Re: Issues related to IAA

Post by Mohammadreza Rezaie » Fri Sep 27, 2024 1:00 pm

Hi, I just tested IAA using the dataset and setup files available here (https://simtk.org/projects/nmbl_running).
I confirm that after loading the setup file in the GUI, both socket_rolling_body and socket_surface_body fields are empty (the tool doesn't get those parameters from the XML file), and the error appears. If I specify these parameters manually in the GUI, then it works. This is very likely a bug. I suggest you open an Issue on the opensim-core GitHub page: https://github.com/opensim-org/opensim-core/issues

User avatar
Carlos Gonçalves
Posts: 135
Joined: Wed Jun 08, 2016 4:56 am

Re: Issues related to IAA

Post by Carlos Gonçalves » Mon Sep 30, 2024 1:40 pm

Thanks, Mohammadreza!

Has anyone tried creating the configuration of the InducedAcceleration component with code?

Best regards.

POST REPLY