## Streaming function. Multiple functions.

Typically: "How do I... ", "How can I... " questions
ArthurS
Posts: 19
Joined: 25 Jul 2021, 20:00

### Streaming function. Multiple functions.

This is a multi-threaded script (part of the coroutine Main ())
I need to loop my workflow. But the next step should only be performed when the isnextTest variable becomes true. I try to read at every step of the StringSignal loop, which contains an array with an array of bool type representing the readiness of the drones, and if all the values ​​of the array == true, then the operations in the loop can start again. But this check for some reason goes beyond the time frame and everything crashes.

I will give a part of the code where I am trying to do this:

Code: Select all

function coroutineMain()
-- my initialization...
while true do
local testssolved=0
if testssolved>0 and  waitingforNextTest() then
if Testcount>0  then

--my functions are executed, which needs to be looped

else
print("END!!!!!!!!!!!!")
end
end
end
end

--somewhere below one of my functions...

function waitingforNextTest()

local 	isAtstartpoint=sim.callScriptFunction("isAtstartpoint@"..sim.getScriptName(copterscript),copterscript,isAtstartpoint)
if isAtstartpoint==false then
return false
end
end
return true

end



maybe I'm doing something wrong. Or do I need a separate multi-threaded function where I can check safely? Help me please!!
If possible please insert a short pseudocode into my patch code.

coppelia
Posts: 8893
Joined: 14 Dec 2012, 00:25

### Re: Streaming function. Multiple functions.

Hello,

please post some minimalistic scene that illustrates your problem. I am not sure I understand what exactly you are trying to achieve.

Cheers

ArthurS
Posts: 19
Joined: 25 Jul 2021, 20:00

### Re: Streaming function. Multiple functions.

Hello. I am sending you the main scene and 3 models that are used there.
You should scale this folder to the path "C:\Program Files\CoppeliaRobotics\CoppeliaSimEdu\projects" (or otherwise change some of the loading paths in the MAIN file).
Start MAIN. It contains that problematic part of the program.
script "Scripts" contains everything you need.

coppelia
Posts: 8893
Joined: 14 Dec 2012, 00:25

### Re: Streaming function. Multiple functions.

Sorry, this is not what I mean when I say minimalistic scene: we don't have the time to read all your code and try to figure out what you intended to do. Instead, put a little bit of effort into at least trying to simplify your scene or problem to a minimum, in order to facilitate us to help you. Did you at least try the few code snippets we posted to your other question? it seems not, you didn't even bother commenting or giving a thank you.

Cheers

ArthurS
Posts: 19
Joined: 25 Jul 2021, 20:00

### Re: Streaming function. Multiple functions.

Hello, sorry, I did not understand you correctly, and in order to show all the details of what is happening, I threw off the entire code. I simplified the scene and rewrote everything in a simple way in a couple of lines. Now this is one scene file.