running scripts

Typically: "How do I... ", "How can I... " questions
Post Reply
luberdis
Posts: 19
Joined: 14 Dec 2018, 16:06

running scripts

Post by luberdis » 13 Mar 2019, 11:59

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?

coppelia
Site Admin
Posts: 7124
Joined: 14 Dec 2012, 00:25

Re: running scripts

Post by coppelia » 13 Mar 2019, 14:14

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

Post Reply