Page 1 of 1

running scripts

Posted: 13 Mar 2019, 11:59
by luberdis
Hi Coppellia

I use non-threaded child script to run my simulation. The problem is that I want to use two algorithms which the first must be completed before the second starts. From the moment that the entire script executes iteratively like a giant while loop process, how can I use two controllers in series not parallel?

Re: running scripts

Posted: 13 Mar 2019, 14:14
by coppelia
Hello,

since non-threaded child scripts are constantly called (and also constantly need to give control back), you could do something like:

Code: Select all

function sysCall_init()
    task1Finished=false
    task2Finished=false
end

function sysCall_actuation()
    if not task1Finished then
        -- compute iteratively task1
    else
        if not task2Finished then
            -- compute iteratively task2
        end
    end
end
But better would be to use a threaded child script.

Cheers