Your simulator for Programmable Matter Benoit PIRANDA, Andr NAZ, - - PowerPoint PPT Presentation

your simulator for programmable matter
SMART_READER_LITE
LIVE PREVIEW

Your simulator for Programmable Matter Benoit PIRANDA, Andr NAZ, - - PowerPoint PPT Presentation

VisibleSim: Your simulator for Programmable Matter Benoit PIRANDA, Andr NAZ, Julien BOURGEOIS github.com/claytronics/visiblesim Dagstuhl Seminar,"Algorithmic Foundations of Programmable Matter" (16271) Schloss Dagstuhl -


slide-1
SLIDE 1

VisibleSim: Your simulator for Programmable Matter

Benoit PIRANDA, André NAZ, Julien BOURGEOIS

github.com/claytronics/visiblesim

Dagstuhl Seminar,"Algorithmic Foundations of Programmable Matter" (16271) Schloss Dagstuhl - Leibniz-Zentrum für Informatik July 03-08, 2016

1

slide-2
SLIDE 2

Recalls on Programmable Matter?

  • We consider that Matter is composed of micro-robots
  • They execute the same code.
  • They can interact with their environment

– Sensors – Actuators

  • They exchange data with their neighbors

2

Toy y car car : : 427 427,921 ,921 ca catoms toms

Goal of the simulator

  • Schedule events
  • Visualize colored modules

and motions

slide-3
SLIDE 3

VisibleSim: How does it work ?

  • Choose a geometry of robot

– Linked to a lattice and a neighborhood

  • Associate a behavioral program: the Code-block

– Languages: C++, MELD, Java, JavaScript, Python

  • Place copies of these robots in the lattice
  • Run all programs

– Robots exchange messages – Activate actuators – Get sensor data

  • VisibleSim

– Shows effects of actuators – Schedules events

3

slide-4
SLIDE 4
  • 5 different Robots and 4 different Lattices

Geometry of robots and lattices

Robot name Lattice Hardware D Smart Blocks Square 1 cm cubes 4 2D Catoms Hexagonal 1 mm cylinders 6 Blinky Blocks Square Cubic 4 cm cubes 6 Robot Blocks Square Cubic Theoretical 6 3D Catoms Faces Centered Cubic In progress 12

slide-5
SLIDE 5
  • We want to write a distributed Code-block that colors robots

depending on the distance (network) to the Leader.

  • We choose to test our algorithm in Robot Blocks modules, and

we call this algorithm “distanceRB”

  • Rules:

– We decide that the Leader is block with ID = 1 – Initialization: (startup function)

  • Every module has distance=MAX but the Leader has distance=0
  • The leader sends its distance (0) to all its neighbors using BROADCAST(0)

messages

– When a module receives a BROADCAST(d) message,

  • If local distance > d+1

– it updates its distance (= d+1) – it sends a message BROADCAST(distance) to all its neighbors but the sender – It changes its color

5

Algorithm by example

slide-6
SLIDE 6

6

Algorithm by example

Robot #1 distance:=0; distance > d+1 distance := d+1; Change the color d+1 d d+1 distance <= d+1 d Robot #i (i!=1) distance:=max;

slide-7
SLIDE 7
  • Using a web application in the web site:

7

Writing the code-block for VisibleSim

http://ceram.pu-pm.univ-fcomte.fr:5015/visiblesim/doc/codeblock.php

distanceRB.cpp distanceRBCode.h distanceRBCode.cpp Makefile

slide-8
SLIDE 8
  • Completing codes (distanceRBCode.h)

8

Writing the code-block for VisibleSim

#ifndef distanceRBCode_H_ #define distanceRBCode_H_ #include "robotBlocksGeneric.h" static const int BROADCAST_MSG_MSG=1001; using namespace RobotBlocks; class DistanceRBCode : public GenericCodeBlock { private: uint16_t distance; public : DistanceRBCode(RobotBlocksBlock *host):GenericCodeBlock(host) {}; ~DistanceRBCode() {}; void startup(); void myBROADCAST_MSGFunc(const MessageOf<uint16_t>*msg, P2PNetworkInterface *sender); #endif /* distanceRBCode_H_ */

slide-9
SLIDE 9
  • Completing codes (distanceRBCode.cpp 1/2)

9

Writing the code-block for VisibleSim

#include "distanceRBCode.h" void DistanceRBCode::startup() { addMessageEventFunc(BROADCAST_MSG_MSG,_myBROADCAST_MSGFunc); console << "start " << module->blockId << "\n"; if (module->blockId==1) { // leader id is 1 distance = 0; sendMessageToAllNeighbors( new MessageOf<uint16_t>(BROADCAST_MSG,0) ,2000,100,0); setColor(RED); } else { distance = UINT16_MAX; setColor(LIGHTGREY); } }

slide-10
SLIDE 10
  • Completing codes (distanceRBCode.cpp 2/2)

10

Writing the code-block for VisibleSim

void DistanceRBCode::myBROADCAST_MSGFunc( const MessageOf<uint16_t>*msg, P2PNetworkInterface*sender) { uint16_t d = *msg->getData()+1; if (distance>d) { distance = d; setColor(Colors[distance % 9]); sendMessageToAllNeighbors("Broadcast", new MessageOf<uint16_t>(BROADCAST_MSG, distance), 2000,100, 1,sender); } };

slide-11
SLIDE 11
  • XML description of the scene (config.xml)

11

Configuration file

<world gridSize="5,5,6"> <camera target="25,20,10" directionSpherical="10,20,100" angle="45" near="0.01" far="1000.0"/> <spotlight target="25,25,0" directionSpherical="-35,40,150" angle="30"/> <blockList color="128,128,128" blockSize="10,10,10"> <block position="1,1,1" color="255,255,64"/> <block position="2,1,1" color="255,64,255"/> <block position="1,0,1" color="64,255,255"/> <block position="0,0,1"/> <block position="1,2,1" color="255,153,10"/> <block position="0,1,1"/> <block position="0,2,1"/> <block position="0,1,2"/> </blockList> </world>

slide-12
SLIDE 12

12

Examples of execution

slide-13
SLIDE 13

13

Adding the ‘tap’ event

  • When the user hits a module, the module becomes the new

leader and sends messages again.

  • Manage conflicts with previous assets

– Memorize current stage

  • Need to transmit more complex message data

– distance – stage number

  • If a block receives a message (d,s)

– If (distance>d+1 || currentStage!=s)

  • update distance
  • update currentStage
  • send distance to neighbors but the sender
slide-14
SLIDE 14
  • Completing codes (distanceRBCode.h)

14

Writing the code-block for VisibleSim

class DistanceMessage { public: uint16_t distance; uint8_t stage; DistanceMessage(uint16_t d,uint8_t s):distance(d),stage(s) {}; }; class DistanceRBCode : public GenericCodeBlock { private: uint16_t distance; uint8_t currentStage; public: DistanceRBCode(RobotBlocksBlock *host):GenericCodeBlock(host) {}; ~DistanceRBCode() {}; void startup(); void myBROADCAST_MSGFunc(const MessageOf<DistanceMessage>*msg, P2PNetworkInterface *sender); void onTap();

slide-15
SLIDE 15
  • Completing codes (distanceRBCode.cpp 1/3)

15

Writing the code-block for VisibleSim

void DistanceRBCode::startup() { currentStage = 0; if (module->blockId==1) { // master id is 1 distance = 0; setColor(RED); sendMessageToAllNeighbors("Broadcast", new MessageOf<DistanceMessage> (BROADCAST_MSG,DistanceMessage(0,1)), 200,50,0); } else { distance=UINT16_MAX; setColor(LIGHTGREY); } }

slide-16
SLIDE 16
  • Completing codes (distanceRBCode.cpp 2/3)

16

Writing the code-block for VisibleSim

void DistanceRBCode::myBROADCAST_MSGFunc( const MessageOf<DistanceMessage>*msg, P2PNetworkInterface*sender) { DistanceMessage *dm = msg->getData(); uint16_t d = dm->distance+1; uint8_t stage = dm->stage; if (distance>d || stage!=currentStage) { distance = d; currentStage = stage; setColor(Colors[distance % 9]); sendMessageToAllNeighbors("Broadcast", new MessageOf<DistanceMessage> (BROADCAST_MSG,DistanceMessage(distance,stage)), 200,50,1,sender); } };

slide-17
SLIDE 17
  • Completing codes (distanceRBCode.cpp 3/3)

17

Writing the code-block for VisibleSim

void DistanceRBCode::onTap() { distance=0; setColor(RED); currentStage = currentStage+1; sendMessageToAllNeighbors("Broadcast", new MessageOf<DistanceMessage> (BROADCAST_MSG,DistanceMessage(0,currentStage)) ,200,50,0); }

slide-18
SLIDE 18

18

Compile and run

slide-19
SLIDE 19

19

VisibleSim applications

  • Reconfiguration
slide-20
SLIDE 20

20

Online version of VisibleSim

  • No installation, just sends 2 files

– Code-block – and xml config file. http://ceram.pu-pm.univ-fcomte.fr:5015/visiblesim/

slide-21
SLIDE 21

21

Conclusion and future works

  • Conclusion

– VisibleSim is a 3D simulator for distributed robots in a simulated environments. – Is able to schedule execution of programs in huge set of robots – Deterministic process

  • Future Works

– More robot geometries in the online Version – More physics in VisibleSim

  • Interaction with gravity
  • Collision forces and sensors