Exchange information between ePucks

Typically: "How do I... ", "How can I... " questions
Post Reply
DavideIng
Posts: 34
Joined: 21 Sep 2017, 17:27

Exchange information between ePucks

Post by DavideIng » 14 Nov 2017, 13:19

I have set up a scene where a swarm of ePuck have to to exchange informations between closer neighbor like position or a color vector read from vision sensor ( there is a screen in front of all vision sensors painted with a uniform color).
Any suggestions?

Many thanks
Davide

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

Re: Exchange information between ePucks

Post by coppelia » 15 Nov 2017, 08:45

Hello,

you have several possibilities for that. For instance:

Code: Select all

--in script 1:
simWriteCustomDataBlock(objectHandle,'myData',simPackTable(myLuaVariable))

--in script 2:
local data=simReadCustomDataBlock(objectHandle,'myData')
local myLuaVariable=simUnpackTable(data)
in above example, myLuaVariable can be a variable of any complexity (e.g. table of table of map of random elements, etc.). Tables, maps, Boolean, nil, numbers, and strings are supported.

Cheers

Post Reply