Page 1 of 1

Exchange information between ePucks

Posted: 14 Nov 2017, 13:19
by DavideIng
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

Re: Exchange information between ePucks

Posted: 15 Nov 2017, 08:45
by coppelia
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