Molecubes Simulator Design

From molecubes
Jump to navigation Jump to search
Screenshot of a Molecubes robot in the simulator.
Simulator software architecture, overview diagram.

This page describes the design of Molecubes simulation software. Check the PC Software Setup section for guidance on how to install the simulator. The simulator is composed of the following five main parts:

  • Graphical user interface to interact with the simulator using OGRE and BetaGUI
  • NxOgre using the physical engine PhysX
  • Morphology representation MolecubeMorphology
  • Evolutionary engine
  • Controller CubeInterface

We discuss each of them in the following sections.

Graphical User Interface

The Graphical User Interface uses BetaGUI. This library is very minimal and capable of creating push buttons, windows, and textual inputs. This library is included in Eihort.h. All the declarations of the buttons and textual inputs of the simulator are in this file. The simulator user interface includes the following functional components:

  • Initialization: sets the orientation (face on the top) of the first cube and its vertical position in the environment. The last button restarts the world with the previously saved parameters.
  • Morphology: this part is to edit the morphology of the robot and add new cubes. These functions are described in CubeInterface.cpp
  • Control: apply movement commands (rotation) to the actuator cubes.
  • Evolution: "evolve" button starts to evolve a controller for the robot, "play result" replays the best creatures, and "get data" saves and displays the best evolved result.
  • File: Saves and Loads the morphology of the robot. Note: same file names, but different extensions are used to save the robot morphology and evolved movement control patterns.

Physical Engine NxOgre

NxOgre is a library used by CubeInterface to interface with the physics engine PhysX. For the instructions on installing Physx, please see the the software setup page. The parameters of the physics engine are defined at the beginning of the cubeInterface.cpp file. The collision shapes for each type of Molecube modules are saved in mesh file format. We generated these files in 3DStudio (see [[Simulator_Software_Setup#LEXI_Exporter_for_3DS_Max| this page] on model import into mesh file format). The collision shapes are loaded into the function createCube in cubeInterface.cpp and associated with the respective display mesh files.

Molecube Morphology

The morphology of Molecube robots is described in accordance with the Molecube morphology file specification. The pertinent simulator functions, including reconstruction, visualization, saving, and loading of morphology files, are implemented in the following classes: MolecubeMorphology, ModuleDescriptor, LinkDescriptor, and StateDescriptor. Their source code is available in this GitHub folder.

Evolutionary Engine

Please see Evolving Robot Behaviors.

CubeInterface Controller

This is the main part of the software. This part controls the user interface, the physical engine, the morphology of the robot and the evolution and the control of the robot.