ghostwan / robotkit

RobotKit it's a Kotlin Robot SDK
Apache License 2.0
8 stars 0 forks source link

Allow multiples task in parallel #25

Closed ghostwan closed 6 years ago

ghostwan commented 6 years ago
val t1 : Task= {myPepper.say("Nous voilà dans la cuisine!")}
val t2 : Task ={myPepper.animate(R.raw.exclamation_both_hands_a003)}
val t3 : Task = {nao.animate(R.raw.exclamation_both_hands_a003)}

Tasks.Parallele(t1, t2).execute()
ghostwan commented 6 years ago

It's done by couroutine mechanisum in kotlin :

val t1 = uiAsync { myPepper.say("Nous voilà dans la cuisine!") }
val t2 = uiAsync { myPepper.animate(R.raw.exclamation_both_hands_a003) }
val t3 = uiAsync { nao.animate(R.raw.exclamation_both_hands_a003) }

println("Task are done ${t1.await()} ${t2.await()} ${t3.await()}")