Mergeable nervous systems for robots: source code for the robot controllers

Nithin MathewsAnders Lyhne ChristensenRehan O'GradyFrancesco MondadaMarco Dorigo

Here we provide the source code of the robot controllers we used to conduct the experiments presented in the paper. The robot controllers are programmed using a forked version of ARGoS2 -- the predecessor of the open source project ARGoS3 (or just ARGoS) that can be used to develop controllers for both simulated and real robots. In this study, we used the forked version to develop controllers for a standard marXbot and a marXbot with a magnetic gripper. This ARGoS version includes multiple customizations such as (i) the possibility for the user to interact with the robots (to inject faults) and with the stimulus (light source) during an ongoing simulation using built-in UI-elements, (ii) the real time visualization of messages sent through a merged nervous system (MNS) and the body plan available to the brain robot, (iii) the use of a behavioral toolkit enabling seamless reusage and combination of independent behavioral components, (iv) the implementation of SWARMORPH-script, and (v) wireless Ethernet-based communication for physically attached real (i.e., not simulated) marXbots.

Acquiring ARGoS2

The ARGoS2 framework enables the execution of MNS controllers both in simulation and on the real marXbots. Follow these steps to acquire ARGoS2 and to set up the MNS experiments on a Linux-based system.

Make sure your system meets these requirements in terms of required libraries and packages:

cmake >= 2.6
make >=3.81
Xi >= 1.0.4
FreeImage >=3.9.3
GLUT >= 3.6
GSL with dev package
PNG libPng and headers
libboost >=1.32.0
libboost_dev >=1.32.0
OpenCV >=2.1
Python >=2.7

For systems that support apt-get, executing the following command line should be sufficient to meet the requirements:
 sudo apt-get install cmake libxmu-dev libxi-dev freeglut3-dev libqt4-opengl-dev libgsl0-dev g++ libfreeimage-dev imagemagick python

Download and extract the source tree:
 >> wget
 >> sudo tar xvjf argos2.tar.gz

Compile the simulation framework:
 >> cd argos2
 >> ./

In order to compile the controller for the real marXbot (also referred to as "foot-bot"), download the toolchain from Then, untar the corresponding archive on your computer such that the toolchain gets installed at /usr/local/angstrom. Cross-compile the controller using the following command: .
 >> ./ footbot

Please refer to this document to see how you can copy and execute the controller on a real marXbot. The document also provides assistance in case of issues related to the cross-compilation of the controller.

Test your setup by running the first experiment:
 >> ./build/simulator/argos -c user/nithin/experiments/mns/basic.xml

When executed, the experiment shows the formation of an "x"-like MNS-robot composed of 9 robots. The formation is initiated by a brain robot (pre-defined in basic.xml) only if the stimulus (i.e., the light source) illuminates in the green color. When the stimulus is perceived to be blue, the MNS-robot reacts by shrinking its size, i.e., by disconnecting one robotic unit after the other. A red stimulus halts both the growth and the shrinkage process.

Follow the instruction provided in this document to see how the same controller can be executed on real marXbots. All MNS-related logic is compiled into a single controller called bt_swarmorph_behavioral_controller which needs to be copied onto each marXbot part of the experiment. Also, *.xml (in this case basic.xml) use for configuring each experiment and the SWARMORPH-script (i.e., *.ml file linked in the *.xml ) need to be copied. Therefore, the execution of the test controller on a real marXbot would require you to (i) copy the controller and the two other files, (ii) log on to the marXbot, and (ii) execute the following command:
 >> cd nithin
 >> ./bt_swarmorph_behavioral_controller -c basic.xml -i fsmc

image-1 image-1
Figure 1. Snapshot of the experiment executed using simulated (left) and real marXbots (right). The result of the real robot experiment can be also seen in this video. Click on the images for an enlarged view.

Running the experiments presented in the paper using ARGoS2

The mergeable nervous system concept. MNS robots are able to physically connect to one another and thereby merge into larger MNS robots of different shapes and sizes. First, MNS robots consisting of a single robotic unit self-assemble into a larger spiral-shaped MNS robot with a single brain unit. Then, the MNS robot splits and each of its robotic units becomes a one-unit MNS robot. The process is repeated three times during which the MNS robots merge into three larger MNS robots with different shapes. Execute the following command to run the experiment in ARGoS2:
 >> ./build/simulator/argos -c user/nithin/experiments/mns/concept.xml

Morphology-independent sensorimotor coordination. Independently of shape and size, MNS robots display consistent sensorimotor reactions to a stimulus, whilst autonomously merging their bodies and robot nervous systems. We programmed the robotic units so that when a green stimulus (of which the position and color can be changed during simulation using the UI-elements on the top) enters a robot’s sensor range, the robot "points" at the stimulus by illuminating its three closest green LEDs (in a composite MNS robot, these are the closest LEDs on the closest constituent robotic unit). When the stimulus is "too" close (i.e., proximity to any part of the MNS robot’s body exceeds a threshold), the robot retreats from the stimulus. Execute the following command to run the experiment in ARGoS2:
 >> ./build/simulator/argos -c user/nithin/experiments/mns/sensorimotor_coordination.xml

Body representation. When a merge between two MNS robots occurs, only a single message needs to be passed up the merged nervous system from the connecting MNS robot to the brain of the MNS robot to which it connects. The information contained in the message is incrementally updated by each intermediate unit with local topological information, and the newly formed MNS robot incorporates all the sensing, actuation and computational capabilities of the units in the new body. In this experiment, two differently configured marXbots (one has a magnetic gripper able to grip previously prepaired objects) merge into a single MNS robot. Note that marXbots able to grip other objects are not implemented in simulation -- the experiment can therefore only be executed using real robots. Copy the files bt_swarmorph_behavioral_controller, magnetic_gripper.xml, to a marXbot with a magnetic gripper, log on to the robot and execute the following commands:
 >> ./bt_swarmorph_behavioral_controller -c magnetic_gripper.xml -i fsmc

A self-healing MNS robot. The experiment forms an "x-"like shape. When fault is injected in the brain or any other unit (for instance by inputting the marXbot ID into the input field on the top in ARGoS2), the MNS robot detects the fault and self-heals from it using a heartbeat mechanism. Execute the following command to run the experiment in ARGoS2:
    >> ./build/simulator/argos -c user/nithin/experiments/mns/self_healing.xml