running scripts

Typically: "How do I... ", "How can I... " questions
Post Reply
luberdis

running scripts

Post 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?

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

Re: running scripts

Post 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

Post Reply