Page 1 of 1

Neural delay in the scriptcontroller

Posted: Tue Sep 05, 2023 6:34 am
by yzhao2018
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

Re: Neural delay in the scriptcontroller

Posted: Tue Sep 05, 2023 7:12 am
by tgeijten
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!

Re: Neural delay in the scriptcontroller

Posted: Thu Sep 07, 2023 2:30 am
by yzhao2018
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

Re: Neural delay in the scriptcontroller

Posted: Thu Sep 07, 2023 5:01 am
by tgeijten
It appears you have misspelled the first child controller, so only one child controller is created.

Re: Neural delay in the scriptcontroller

Posted: Fri Sep 08, 2023 3:48 am
by yzhao2018
Thanks Thomas!