The goal of this project was to combine the model execution capabilities of GEMOC Studio with the 3D simulation facilities of Blender on the case of the Ozobot robot. This combination should enable the enhanced model-based analysis of robot behavior.
Ozobot is a small robot with an integrated battery and five color sensors on the bottom. The robot is programmable via sequences of colors (color codes). To create Ozobot programs, the OzoBlockly programming language and Web IDE can be used.
Within the project, we developed an executable modeling language for modeling the behavior of Ozobot robots using GEMOC Studio, GEMOC Studio is a language and modeling workbench built on top of the Eclipse Modeling Framework (EMF). The developed language definition artifacts comprise a metamodel defined with EMF Ecore, a graphical concrete syntax developed with Sirius, and an operational semantics implemented with Kermeta 3 (K3). Based on these language definition artifacts GEMOC Studio provides model execution facilities including model animation and model debugging.
The developed executable modeling language basically allows to model Ozobot behavior as a set of commands that are executed sequentially. During the execution of an Ozobot behavior model, the current command and the current position of the Ozobot will be displayed in the model animation.
For the visualization of the actual robot movements we created a 3D simulation with Blender, which is an open source software for 3D creation. This 3D simulation shows the robot movements as defined in a model created with our developed modeling language.
The model execution performed in GEMOC Studio controls the 3D simulation in Blender. This is achieved by sending information about the currently executed command from the model execution to Blender through an MQTT server.
In order to make models executable, one has to define the execution semantics of the modeling language. For this, we have used GEMOC Studio in this project, which offers the action language Kermeta 3 to define operational semantics. To provide model animation in GEMOC Studio that shows information about the progress and the state of the model execution, the graphical concrete syntax of the language needs to be extended with a so-called animation layer.
The figure below shows an Ozobot program with a set of commands. The current command is highlighted in the animation and also displayed in the second box on the right. Above this box, the current position of the Ozobot is displayed.
The developed 3D representation of Ozobot consists of a black cylinder, a transparent black glass ceiling and a light under the glass ceiling. The environment consists of a grass area, which serves as the ground for the Ozobot. There are some boxes placed on the ground, which represent obstacles that Ozobot can shift away.
The simulation is controlled via Python scripts. We have implemented two scrips Controller.py and Server.py. Controller.py contains the logic of the Ozobot commands and will be executed at every frame. Server.py is only executed once and listens for incoming commands from GEMOC Studio that are transmitted via MQTT. Incoming commands are passed on to Controller.py for advancing the 3D simulation.
Possible future work based on this project include:
- Support for an extended set of commands
- Implementation of a code generator for generating color codes out of Ozobot behavior models that can be used to program Ozobot
- Establishing a bi-directional communication between Blender and GEMOC Studio
- Improvements to the 3D simulation
- Provisioning of additional environments
- Support of effects like fragmentation of boxes
- Implementation of logic behavior for Ozobot (e.g. Ozobot recognizes obstacles and avoids collision)
- Source code: https://github.com/CFraller/ame-model-execution.git
- Demonstration video: http://www.youtube.com/watch?v=wPAzQfT9xBk