0% found this document useful (0 votes)
78 views6 pages

Swarm Intelligence Simulation With NXT R

Uploaded by

Schiller Viktor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views6 pages

Swarm Intelligence Simulation With NXT R

Uploaded by

Schiller Viktor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Swarm Intelligence Simulation with NXT Robots

Using Piconet and Scatternet


Attila Pásztor*, Tamás Kovács,* and Zoltán Istenes**
* Kecskemét College, Faculty of GAMF, Department of Information Technology, Kecskemét, Hungary
**Eötvös Loránd University, Faculty of Informatics, Department of Software Technology and Methodology, Budapest
Hungary

[email protected]
[email protected]
[email protected]

Abstract— This study deals with swarm intelligence servomotors and the Bluetooth techniques, it became very
simulation through simple Lego NXT robots using Piconet popular. The main part of the robot is the programmable
and Scatternet networks. In this research, held at the brick. This brick basically consists of: an Atmel® 32-bit
Kecskemét College faculty of GAMF, we simulated the ants’ ARM® processor AT91SAM7S256 as a main processor,
food collecting habits, in an artificial area, with low-cost an Atmel® 8-bit AVR processor ATmega48 as a co-
NXT robots. These autonomous robots formed groups and processor and a CSR BlueCoreTM 4 v2.0 +EDR System
collected objects/foods. They communicated with each other for the Bluetooth wireless communication.
via Bluetooth and they used several sensors, such as touch, An NXT brick can be connected wirelessly to three
light and ultrasonic ones, to resolve their tasks. other ones (see Fig. 1) at the same time. The
In the first part of the research, the group consisted of one
communication is set up as a “master-slave”
master and three slave robots, similarly to the Piconet
communication channel. The master can communicate
network.
only with one of the slaves at a given moment. The slaves
Then in the second part, we improved the communication
system to a better one, allowing communication in a bigger
cannot communicate directly with each other.
group than a Piconet network, similar to the Scatternet
network.
This research could be a good starting point to other
practical applications, such as, for example rescuing people
and values from a polluted area or for solving collective
topographical tasks.

I. INTRODUCTION

A. Swarm Intelligence researches


Nowadays there is a “relatively” new scientific research
field of Artificial Intelligence: the swarm intelligence [1].
Several researchers study attitudes and habits of those
animals naturally living in colony and try to adopt their
researches for robot groups [2][3]. Since these
autonomous robot groups are multi-agent systems, they
communicate and cooperate amongst themselves similarly Figure 1. The NXT Piconet Network
to some animals in the nature [4].
The brick has three output ports and four input ports.
II. THE FIRST PART OF THE RESEARCH WITH FOUR We can connect servomotors and lamps to the output
ROBOTS ports, and touch, light, sound and distance sensors to the
input ports. Currently, several companies sell new sensors,
A. About the Lego NXT such as for example: magnetic compass, colour or rotation
As in our experiments we used some NXT robots it is sensors, etc.
important to describe briefly the structure of our robots Furthermore, several programming languages, like
regarding their communication and programmable NQC, NXC, NBC, LeJOS are being developed as well,
capabilities. and in addition to this an icon-directed Mindstorms NXT
In 2006 the Lego Company brought out its third programming language developed by LEGO, which made
generation of NXT sign robot, which actually won the it more popular. Nowadays the MATLAB programming
innovative first prize of the Nürnberg toy exhibition. environment is the one mostly applied in the NXT
Thanks to its new sensors (sound and distance), the programming.
B. The first simulation coordinate unit (the African desert ants count their steps),
We made a simulation, where the robots imitated some so these units measure the location of the robots and their
animals’ food collecting habits. In this experiment we discs (food). During our simulation the starting point was
used the food collecting habits of the African Desert Ants. the origin (0;0) (ant hill) and one rotation of the wheel
The “explorer” ants, first explored the area, and then, increased one vertical coordinate unit. At the edge of the
when they found food they marked the places with territory the robot turned back. One turning back made
“pheromone”. Finally the workers gathered the found one horizontal coordinate unit.
food.
In the simulation there were two types of robots, since food
there were two types of tasks. The first task was for the
“explorer” robot, (called “master”) (see Fig. 2) to discover
the artificial area ( 6m × 6m ) and to memorize the
Descartes coordinates of the random spread green discs
(food). This robot had three light sensors for monitoring
the edges of the area and to find the green discs (food
places). It also had one ultrasonic distance sensor for
monitoring the other robots, so that they do not crash to
each other. The master had two motors to change position ANT-
and another one to move its ultrasonic distance sensor HILL
(ant’s head).

Figure 4. The anthill and the odometry method

In the first step of the task, the master robot started to


explore the territory. For the optimal solution of the task,
when the master robot found the first disc it gave
immediately its coordinates via Bluetooth to the first slave
waiting at the starting point. Then the master went on
exploring and gave the coordinates of the next found disc
to the next free slave. The master made such little turns,
that there was no opportunity to miss any of the discs. If
the master found another disc, and all of the slaves were
busy, it remained there until one of the slaves got free.
The algorithm of the explorer can be summarised as
follows:
Figure 2. The ‘explorer’ robot Algorithm Master
while (not end_of_field()) do
The second task was for the “worker” robots (called scan_field_using_odometry(onestep)
slaves) to gather the green discs (food). These robots had if (object_founded) then
two light sensors, a distance sensor and two robotic while (not free_robot) do wait(1sec)
tentacles (ant antennae) (see Fig. 3) The communication
between the master and the slaves was implemented via slave=search_first_free_robot()
Bluetooth. calculate_odometry()
send_coordinetes(slave)
endif
end
broadcast(end_collecting)
endalgorithm.
While the master robot was working the slaves were
queuing at the starting point waiting for the master’s
rectangular coordinates of the newly found disc. To find
the optimal way to the disc, the slaves changed the
rectangular coordinates to “Polar” ones (see Fig. 5).
Thanks to this change, they immediately chose the
shortest way to the discs. Because of rounding errors, even
the slaves need to do a local search for the discs.
In that special case, when the master and a slave moved
too close to each other, the master gave way to that slave.
Figure 3. The ‘workers’ robot
The simulation ended, when the robots carried back all the
There are many possibilities to walk all over the discs to the given point. In the nature, the ants gather food
territory; due to the construction of the master robot we until sunset, unless it begins to rain or the master gives
used a method based on odometry (see Fig. 4). This alarm for some reason, for example: an enemy appears on
method uses one rotation of the robot wheel as a their territory.
The second problem is that the specific roles (explorer,
worker) cannot be interchanged between the robots, i.e.
the roles in the swarm are predefined. Thus, in case of any
damages, the roles could not be passed to each other.
However, such a change of the roles can be useful in
many cases. For example, if the master could not work
any longer, it would immediately disconnect the Bluetooth
connection and the first slave would take its role in
Figure 5. Transferring the coordinates
exploring the area and controlling the communication
[7][8].
Algorithm Slave

while (not received(end_collecting)) do III. NXT SCATTERNET NETVORK STRUCTURE


while ( not anhill_exit ) do
To solve the problem of the limited roles within the
if (robot_front_of_me ) then wait(1sec) group, instead of the Piconet network we applied a “static
else go_forward(onestep) Scatternet” network. In this new group a so called “super-
endif master” robot worked as the only master. The super-
end master could only communicate directly with its “sub-
coordinates=received_coordinates(master) master” robots. These sub-masters worked like bridges in
(angle,distance)=calculate_polar(coordinates) the network (see Fig. 7).
turn(angle) Super-master
go_forward(distance)
search_object()
if (object_founded) then pick_up_object()
go_back_to_anthill()
if (object_founded) then put down_object() Sub-masters
end Bridges:
endalgorithm. master/slave

The robots, working in a group together, fulfilled the Slaves


tasks rapidly and effectively.
The robot controlling program was written in the NXC
programming language and the programming environment
was the Brixc Command Center version 3.3.17., with the Figure 7. The Scatternet network
firmware 1.03 running on the robots.
They played two different roles: the first is a slave,
C. The problems of the simulation while communicating with the super-master and then,
after the super-master’s disconnection the second is a
During our simulation, we had two main problems to be master role, while communicating with their slaves. The
solved. The first one was the extend safe coverage of the super-master could communicate with the slaves only
applied Bluetooth technology. Originally it was trough its sub-masters. Still, the sub-master could play
approximately ten meters, so the borders of the artificial only one role at a time, either it was a slave for the super-
territory were very limited. We had to find a new kind of master or it was a master itself for the slaves. When it was
communication system to increase both the size of the playing the role of a slave for the super-master, only the
artificial territory and the number of robots (see Fig. 6) super-master had the right to connect or disconnect to it.
[5][6]. In the other case, when it was playing the role of a master,
only the sub-master had the right to connect or disconnect
to the slaves. The super-master could not make connection
with the sub-master while it was in connection with the
slaves. For this reason, it was very important to reduce the
sub-master’s communication time as much as possible, to
let them back to their “waiting for connection” positions.
In order to implement the communication scheme
above, a connector, a disconnector and a message-sender
function were written in the NXC programming language.
The NXC language includes Bluetooth functions:
BluetoothConnect, BtDisconnect, SendRemoteMessages,
which are based on the host controller interface (HCI) of
the Bluetooth radio. These functions were used to write
our protocols.
To be able to use the HCI functions, a new firmware
had to be installed into the robots.
(Ims_arm_nbc_nxc_105.rfw).
Figure 6. The NXT colony
Only this new firmware could use correctly the above
mentioned Bluetooth functions. The programming
environment also had to be changed to the latest version
of the Bricx Command Center (3. 3.7.19). At the Work-zone 3
beginning, the programs did not run correctly, it only
started working well, when we set the compiler into the
“enhanced firmware” mode.
We also had to apply a static “rooting” hierarchy to Sub-master
compensate the unreliability of the Bluetooth technology
used in NXT robots. In this way, the number of
connections and disconnections was reduced. The super-
master and the sub-masters both had a “routing table”, Work-zone 2
containing the names of all the connectable slaves, their Super-master
connection numbers and the fact, whether the connection
to the connectable slaves is connected or disconnected.
This “routing table” could not be extended, that is, each
master-robot could be connected or disconnected with Sub-master
only the three slaves originally assigned to it. The super-
master could be connected or disconnected with the sub-
masters, the sub-masters could be connected or
disconnected with only its slaves. The slaves in the bottom Work-zone 1
level of the hierarchy had no “routing table” at all. They Slave working
could not connect any robots, they could only be
connected by their own sub-masters.
To reduce the unreliability of the Bluetooth Food
communication, the connecting, disconnecting and
Sub-master
sending messages had to be repeated with inserted
timeouts and retries amongst them.
Slave in Slave out
IV. COLLECTING SIMULATION WITH THIRTEEN ROBOTS
Thanks to the network protocol mentioned in the third Base
part we could increase the number of our robots to
thirteen. The task remained the same (gathering food) as
described in the first part, but with more robots and in a
bigger area. (see Fig. 8). Figure 8. The collecting simulation with more robots and in larger
During the simulation, the super-master robot, started area
first, with dividing the artificial territory into three parts
and only then could the three sub-masters start to explore
their own designated areas. Differently from the first V. GOALS, IMPROVEMENTS AND POSSIBILITIES IN THE
simulation, the sub-masters did not send immediately the FUTURE
coordinates of their first found disc (food). They went on
exploring their own territory, memorizing the coordinates A. Scalability of tasks
of each of the found discs. To reduce the number of The 1-3 structured Master-Slaves group, used in the
connections and disconnections, the sub-masters only send first simulation, was increased into a 1-3-9 structured
the coordinates in a package to the slaves after they have group in the second simulation. This group structure, of
explored all of their designated territory (distributing the course, could be increased in a vertical and a horizontal
coordinates amongst the slaves). During the sub-masters direction as well (width and depth scalability). As a first
exploration tour, each 3 groups of slaves followed its own possibility, the colony structure of the group could be a 1-
sub-master to its designated territory, to be within the 3-9-27 scheme, so new slaves would be connected to the
needed communication range. Once the coordinates original slaves (vertical increase) (see Fig. 9).
received, first the slaves memorized them all and then,
they started to take the discs, one by one, to the base.
Since the slaves started their work only after the Master
memorization of the coordinates, the sub-masters could
disconnect from them quickly, so as to return to their Sub-masters
“waiting position“.
From time to time, the super-master checked on its sub-
masters in order to control their work, and so did the sub- Sub-masters
masters with their own slaves.
In case of any danger, the super-master sent an “alarm ......
broadcast message” (evacuation) to the slaves, through the Slaves
sub-masters, to leave the territory.
Figure 9. The depth increase of the control tree
Master our testing experiments the value of t in the case of the
LEGO NXT robots is in the range of 5-10 seconds, so
with the help of eq. (3) we obtain that for 13 robots the
minimal total broadcast time in the tree is in the range of
Sub-masters 30-55 seconds. This relatively high value is mostly due to
the poorer Bluetooth architecture of the NXT bricks,
which means for example that there are no possibilities
for master/slave or park/active switches in the host
Slaves controller interface (see for example ref. [6]). In the other
hand, our present implemented connection and
Figure 10. The width increase of the control tree acknowledged message sending algorithms can be
improved yet, so that a better value for t is expected.
This improvement is left to our future work.
As a second possibility, more sub-masters can be
connected to the super-master, as the super-master C. Position system for location
disconnects its first three sub-masters and connects other
three sub-masters to itself (horizontal increase) (see Fig. There are a few programming languages for NXT
10). robots (such as for example: LeJOS, NXC), which
implement reliable measuring tool for the signal quality of
the Bluetooth connection between two robots. A function
B. Ad-hoc Scatternet network can be created, corresponding to the measured signal
quality that returns the approximate distance between two
The above-mentioned static structure could be changed robots. Based on this function it is possible to develop an
to a dynamical one, using dynamical routing tables. In this indoor location system for the robot group, since knowing
case, still via Bluetooth, the actual position of a robot in the fixed positions of two robots the locations of the others
the network would determinate its actual role, whether the can be calculated by trigonometry.
robot is a master or a slave one.
Considering the rooted tree structure of the network D. Construction of homogenous groups of robots
given in Figure 9 and 10 the total time, T , needed to send The three light sensors for the accurate rotating and
a message from the root to all of the leafs can be positioning of the super-master and the sub-masters (like
calculated easily (for a similar calculation see for example in our cases above) can be substituted only one magnetic
ref. [9]). If the average number of the children for a parent compass, which is also a perfect solution to the task. In
node is denoted by k , the time T is given as this way the masters can be equipped a new tentacle in the
emptied ports, to be able to gather the discs itself. In this
T = t ⋅n⋅k , (1) case the construction of the slaves and their masters would
be very similar. Since the group would become
homogeneous, any robot could take the role of any other
robots.
where t is the time needed for a parent to build up
connection and pass an acknowledged message to a child ACKNOWLEDGMENT
node, and n is the number of levels in the rooted tree.
The number of the nodes (robots) is calculated as We would like to thank some IT students of the KF
GAMF, especially Tamás Simon who helped us a lot in
building the robots.
k n +1 − 1 REFERENCES
N = 1+ k + k 2 +"+ k n = , (2)
k −1
[1] E. Bonabeau, M. Dorigo, G. Theraulaz, „Swarm intelligence,
From Natural to Artificial Systems”, Oxford University Press,
whence the parameter n can be expressed by k and N , 1999, ISBN13: 9780195131598, ISBN10: 0195131592
so the relation (1) can be written as [2] S. Rutishauser, N. Correll, A. Martinoli, “Collaborative coverage
using a swarm of networked miniature robots”, Robotics and
Autonomous Systems (2008), doi:10.1016/j.robot.2008.10.023
[3] M. Kulich, J. Kout, L. Preucil, R. Mazl, J. Chudoba, J. Saarinen, J.
log[ N (k − 1) + 1] Suomela, A. Halme, F. Driewer, H. Baier, K. Schilling, N.
T (k ) = t ⋅ ⋅k . (3) Ruangpayoongsak and H. Roth, „PeLoTe - a heterogeneous
log k
telematic system for cooperative search and rescue missions”,
in Proc. The IEEE/RSJ International Conference on Intelligent
Robots and Systems, Sendai 2004, Japani: 2004, 8 p.
If k → 1 then T ( k ) → t ⋅ N , which is obvious, since in this [4] M. Dorigo, T. Stützle, “Ant Colony Optimization”, MIT Press,
2004, ISBN-10: 0-262-04219-3 ISBN-13: 978-0-262-04219-2
case the tree is transformed into a linear chain. The other
extreme case is when k ≈ N , so the number of the levels [5] A. Weitzenfeld, L. Martínez-Gómez, J. P. Francois, A. Levin-
Pick, K. Obraczka, J. Boice, „Beyond RoboCup: Ad-Hoc
is only one. In this case T ≈ t ⋅ N , that is the same as in Networking for Autonomous Mobile Robots”, In proc.
the previous case. By determining the minimal value of International Conference on Mechatronics Technology 2006
T (k ) we obtain the optimal choice for k . This value is [6] W. Song, X. Li, Y. Wang, W. Wang, „dBBlue: Low Diameter and
k ≈ 2 when N is in the range of [10..100] . By means of Self-routing Bluetooth Scatternet”, DialM-POMC’03, September
19, 2003, San Diego, California, USA
[7] G. Augusto Silva Pereira, V. Kumar, M. Fernando Montenegro [9] E. J. Jung, “Creation and maintenance of a communication tree in
Campos, “Closed loop motion planning of cooperating mobile wireless sensor networks,” Ph.D. thesis, Texas A & M University
robots using graph connectivity”, Robotics and Autonomous College Station, TX, USA, (2007)
Systems 56 (2008) 373–384, doi:10.1016/j.robot.2007.08.003
[8] M. J.B. Krieger, J. Billeter, „The call of duty: Self-organised task
allocation in a population of up to twelve mobile robots”, Robotics
and Autonomous Systems 30 (2000) 65–84, PII: S0921-
8890(99)00065-2

You might also like