A question about computeControls frequency

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
kaiyang yin
Posts: 2
Joined: Fri Aug 03, 2018 6:13 am

A question about computeControls frequency

Post by kaiyang yin » Thu Aug 23, 2018 2:25 am

Hello,everyone!
I have a question about the computeControls's control frequency.
We doing a forward dynamics simulation. we writed a Controller class and the computeControls function was used. But we don't the control frequency and can't set the control frequency.
Can you give me some advice on how to solve this problem?
Thanks!

Tags:

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: A question about computeControls frequency

Post by Dimitar Stanev » Thu Aug 23, 2018 5:30 am

The computeControls is called each time the integrator steps the system. It is possible that the stepping algorithm invalidates a step and goes back in time to ensure that the integration tolerance is not violated. Ideally, your compute controls function should be a pure function (its return value is the same for the same arguments) and you should try to avoid local state as much as possible because this may lead to unexpected behavior. Why is so important to know the frequency in your application? Maybe there is some other way around.

User avatar
kaiyang yin
Posts: 2
Joined: Fri Aug 03, 2018 6:13 am

Re: A question about computeControls frequency

Post by kaiyang yin » Thu Aug 23, 2018 5:38 pm

Thank you very much, Dimitar.
" Why is so important to know the frequency in your application?" The reason is my work is to simulate human CNS control, and the control loop involves
"sensory delay" and "command delay". I want to design a delay algorithm, but i don't know the control frequency. When the computeControls is called, i cout the "State.getTime()" to a .txt file. But the time interval for each run is not fixed. Sometimes late timestamps appear before in the files. below is a partial "State.getTime()" data.
And how do i set the integrator steps time?
Thanks!
Attachments
StateTime.txt
(564.59 KiB) Downloaded 16 times

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: A question about computeControls frequency

Post by Dimitar Stanev » Sat Aug 25, 2018 8:34 am

We have done something similar in the past and its a bit tricky. Please look at the following branch and particularly at the DelaySignal class

https://github.com/opensim-org/opensim- ... ered_delay

This is an old branch that was created when the OpenSim component features were under development.

POST REPLY