Neural delay in the scriptcontroller

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
Yihui Zhao
Posts: 7
Joined: Thu Mar 15, 2018 8:11 am

Neural delay in the scriptcontroller

Post by Yihui Zhao » Tue Sep 05, 2023 6:34 am

Dear Thomas,

I hope this email finds you well.

I am currently starting to use SCONE. It is wonderful and powerful to implement the prediction simulation.

Now I am trying to build up the controller via the script controller.
I have a question regarding the neural delay in the script controller.

I am starting to study the spinal circuit and want to use the script controller to perform the simulation.

Is there any way to apply the neural delay in the script controller?

The method I think is to use the model: time()/delta_time(), if statement, add_input () to add some reflex inputs into the muscle excitation/actuator input parallel with default excitation.

Sincerely regards,
Yihui

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

Re: Neural delay in the scriptcontroller

Post by Thomas Geijtenbeek » Tue Sep 05, 2023 7:12 am

In order to get accurate neural delays with good simulation performance, it is advised to always use the ReflexController.

If you need the ScriptController to activate/deactivate different reflexes during the simulation, you can use the ReflexController in combination with the ScriptController and get the best of both worlds. In order to do so, add any number of ReflexControllers as children to your ScriptController:

Code: Select all

ScriptController {
	script_file = "data/my_script_file.lua"
	ReflexController {
		...
	}
	ReflexController {
		...
	}
}
After that, you can enable/disable individual ReflexControllers in the update() function of your script:

Code: Select all

function update( model, time, controller )
	-- enable only the first ReflexController
	controller:set_child_enabled( 1, true )
	controller:set_child_enabled( 2, false )
end
Please let me know if this helps!

User avatar
Yihui Zhao
Posts: 7
Joined: Thu Mar 15, 2018 8:11 am

Re: Neural delay in the scriptcontroller

Post by Yihui Zhao » Thu Sep 07, 2023 2:30 am

Dear Thomas,

Thanks for your reply.

I was away for a workshop yesterday.

I got an error pop up when I implement the enable/disable the controller, which shows that the index should between 1 and 1.

Many thanks,
Yihui
Attachments
Screenshot 2023-09-07 102954.jpg
Screenshot 2023-09-07 102954.jpg (72.12 KiB) Viewed 249 times

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

Re: Neural delay in the scriptcontroller

Post by Thomas Geijtenbeek » Thu Sep 07, 2023 5:01 am

It appears you have misspelled the first child controller, so only one child controller is created.

User avatar
Yihui Zhao
Posts: 7
Joined: Thu Mar 15, 2018 8:11 am

Re: Neural delay in the scriptcontroller

Post by Yihui Zhao » Fri Sep 08, 2023 3:48 am

Thanks Thomas!

POST REPLY