7 min read

Collective intelligence (CI) is shared or group intelligence that emerges from the collaboration, collective efforts, and competition of many individuals and appears in consensus decision making. Swarm intelligence (SI) is a subset of collective intelligence and defines the collective behavior of decentralized, self-organized systems, natural or artificial.

In this tutorial, we will talk about how to design a multi-robot cooperation model using swarm intelligence.

This article is an excerpt from Intelligent IoT Projects in 7 Days by Agus Kurniawan. In this book, you will learn how to build your own Intelligent Internet of Things projects.

What is swarm intelligence

Swarm intelligence is inspired by the collective behavior of social animal colonies such as ants, birds, wasps, and honey bees. These animals work together to achieve a common goal.

Swarm intelligence phenomena can be found in our environment. You can see swarm intelligence in deep-sea animals, shown in the following image of a school of fish in a formation that was captured by a photographer in Cabo Pulmo:

Cabo PulmoImage source: http://octavioaburto.com/cabo-pulmo

Using information from swarm intelligence studies, swarm intelligence is applied to coordinate among autonomous robots. Each robot can be described as a self-organization system. Each one negotiates with the others on how to achieve the goal.

There are various algorithms to implement swarm intelligence. The following is a list of swarm intelligence types that researchers and developers apply to their problems:

  • Particle swarm optimization
  • Ant system
  • Ant colony system
  • Bees algorithm
  • Bacterial foraging optimization algorithm

The Particle Swarm Optimization (PSO) algorithm is inspired by the social foraging behavior of some animals such as the flocking behavior of birds and the schooling behavior of fish. A sample of PSO algorithm in Python can be found at https://gist.github.com/btbytes/79877. This program needs the numpy library. numpy (Numerical Python) is a package for scientific computing with Python. Your computer should have installed Python. If not, you can download and install on this site, https://www.python.org. If your computer does not have numpy , you can install it by typing this command in the terminal ( Linux and Mac platforms):

    $ pip install numpy

For Windows platform, please install numpy refer to this https://www.scipy.org/install.html.

You can copy the following code into your editor. Save it as code_1.py and then run it on your computer using terminal:

from numpy import array 
from random import random 
from math import sin, sqrt 
iter_max = 10000 
pop_size = 100 
dimensions = 2 
c1 = 2 
c2 = 2 
err_crit = 0.00001 
class Particle: 
def f6(param): 
    '''Schaffer's F6 function''' 
    para = param*10 
    para = param[0:2] 
    num = (sin(sqrt((para[0] * para[0]) + (para[1] * para[1])))) *  
        (sin(sqrt((para[0] * para[0]) + (para[1] * para[1])))) - 0.5 
    denom = (1.0 + 0.001 * ((para[0] * para[0]) + (para[1] * para[1]))) *  
            (1.0 + 0.001 * ((para[0] * para[0]) + (para[1] * para[1]))) 
    f6 =  0.5 - (num/denom) 
    errorf6 = 1 - f6 
    return f6, errorf6; 
#initialize the particles 
particles = [] 
for i in range(pop_size): 
    p = Particle() 
    p.params = array([random() for i in range(dimensions)]) 
    p.fitness = 0.0 
    p.v = 0.0 
# let the first particle be the global best 
gbest = particles[0] 
err = 999999999 
while i  p.fitness: 
            p.fitness = fitness 
            p.best = p.params 
        if fitness > gbest.fitness: 
            gbest = p 
        v = p.v + c1 * random() * (p.best - p.params)  
                + c2 * random() * (gbest.params - p.params) 
        p.params = p.params + v 
    i  += 1 
    if err 

You can run this program by typing this command:

    $ python code_1.py.py

This program will generate PSO output parameters based on input. You can see PARAMETERS value on program output.  At the end of the code, we can print all PSO particle parameter while iteration process.

Introducing multi-robot cooperation

Communicating and negotiating among robots is challenging. We should ensure our robots address collision while they are moving. Meanwhile, these robots should achieve their goals collectively.

For example, Keisuke Uto has created a multi-robot implementation to create a specific formation. They take input from their cameras. Then, these robots arrange themselves to create a formation. To get the correct robot formation, this system uses a camera to detect the current robot formation. Each robot has been labeled so it makes the system able to identify the robot formation.

By implementing image processing, Keisuke shows how multiple robots create a formation using multi-robot cooperation. If you are interested, you can read about the project at https://www.digi.com/blog/xbee/multi-robot-formation-control-by-self-made-robots/.

Designing a multi-robot cooperation model using swarm intelligence

A multi-robot cooperation model enables some robots to work collectively to achieve a specific purpose. Having multi-robot cooperation is challenging. Several aspects should be considered in order to get an optimized implementation. The objective, hardware, pricing, and algorithm can have an impact on your multi-robot design.

In this section, we will review some key aspects of designing multi-robot cooperation. This is important since developing a robot needs multi-disciplinary skills.

Define objectives

The first step to developing multi-robot swarm intelligence is to define the objectives. We should state clearly what the goal of the multi-robot implementation is. For instance, we can develop a multi-robot system for soccer games or to find and fight fire.

After defining the objectives, we can continue to gather all the material to achieve them: robot platform, sensors, and algorithms are components that we should have.

Selecting a robot platform

The robot platform is the MCU model that will be used. There are several MCU platforms that you use for a multi-robot implementation. Arduino, Raspberry Pi, ESP8266, ESP32, TI LaunchPad, and BeagleBone are samples of MCU platforms that can probably be applied for your case.

Sometimes, you may nee to consider the price parameter to decide upon a robot platform. Some researchers and makers make their robot devices with minimum hardware to get optimized functionalities. They also share their hardware and software designs. I recommend you visit Open Robotics, https://www.osrfoundation.org, to explore robot projects that might fit your problem.

Alternatively, you can consider using robot kits. Using a kit means you don’t need to solder electronic components. It is ready to use. You can find robot kits in online stores such as Pololu (https://www.pololu.com), SparkFun (https://www.sparkfun.com), DFRobot (https://www.dfrobot.com), and Makeblock (http://www.makeblock.com).

You can see my robots from Pololu and DFRobot here:

Pololu and DFRobot

Selecting the algorithm for swarm intelligence

The choice of algorithm, especially for swarm intelligence, should be connected to what kind of robot platform is used. We already know that some hardware for robots have computational limitations. Applying complex algorithms to limited computation devices can drain the hardware battery. You must research the best parameters for implementing multi-robot systems.

Implementing swarm intelligence in swarm robots can be described as in the following figure. A swarm robot system will perform sensing to gather its environmental information, including detecting peer robot presence.

Swarm robotBy combining inputs from sensors and peers, we can actuate the robots based on the result of our swarm intelligence computation. Actuation can be movement and actions.
We designed a multi-robot cooperation model using swarm intelligence. To know how to create more smart IoT projects, check out this book Intelligent IoT Projects in 7 Days.

Read Next

Subscribe to the weekly Packt Hub newsletter. We'll send you the results of our AI Now Survey, featuring data and insights from across the tech landscape.


Please enter your comment!
Please enter your name here