You are on page 1of 6

Proceedings of

Proceedings of the
the 20th
20th World
World Congress
Congress
Proceedings
The
Proceedings
The of
of the
International
the
International 20th
20th World
Federation
World
Federation of Congress
of Automatic
Automatic Control
Congress Control
Proceedings
The of the
International 20th World
Federation of Congress
Automatic Control
Toulouse,
The
Toulouse, France,
International
France, July 9-14,
Federation
July 9-14, 2017
of Available
Automatic
2017 online at www.sciencedirect.com
Control
The International
Toulouse, France, Federation
July 9-14, of Automatic
2017 Control
Toulouse, France, July 9-14, 2017
Toulouse, France, July 9-14, 2017
ScienceDirect
IFAC PapersOnLine 50-1 (2017) 9150–9155
A Khepera IV library for robotic control
A
A Khepera
Khepera IV
IV library
library for robotic
forV-REP
robotic control
control
education using
education using V-REP
∗ ∗∗ ∗
G. Farias
G. E. Fabregas
Farias ∗∗ E. Fabregas ∗∗ E. E. Peralta
Peralta ∗ E. Torres ∗∗
E. Torres
∗∗ ∗
∗ E. Torres ∗
G. Farias
G. Farias ∗ E. Fabregas
Farias E.
∗ S.
E. Fabregas ∗∗ E. Peralta
Dormido
∗∗
S. Dormido
∗∗
E. Peralta
Peralta
∗∗ ∗ Torres ∗∗
E. Torres
G. Fabregas E. ∗∗ E.
S.
S. Dormido
Dormido ∗∗
∗∗

S. Dormido
∗ Pontificia Universidad Católica de Valparaı́so, Av. Brasil, 2147,
∗ Pontificia Universidad Católica de Valparaı́so, Av. Brasil, 2147,
∗ Pontificia
∗ Universidad
Valparaı́so,
Pontificia Chile Católica
Universidad (e-mails:de
Católica de Valparaı́so, Av. Brasil,
gonzalo.farias@pucv.cl,
Valparaı́so, 2147,
Valparaı́so,
Pontificia Chile
Universidad (e-mails:
Católica Valparaı́so, Av.
Av. Brasil,
Brasil, 2147,
degonzalo.farias@pucv.cl, 2147,
Valparaı́so, Chile
Valparaı́so, Chile (e-mails:
emmanuel.peraltah@gmail.com,
Chile (e-mails:
(e-mails:
emmanuel.peraltah@gmail.com, gonzalo.farias@pucv.cl,
enrique torres1994@hotmail.com)
gonzalo.farias@pucv.cl,
enrique torres1994@hotmail.com)
Valparaı́so, gonzalo.farias@pucv.cl,
∗∗emmanuel.peraltah@gmail.com,
Informática yyenrique torres1994@hotmail.com)
∗∗
Departamento
Departamento de de Informática
emmanuel.peraltah@gmail.com, Automática,
enrique Universidad
Universidad Nacional
torres1994@hotmail.com)
Automática, Nacional
∗∗emmanuel.peraltah@gmail.com, enrique torres1994@hotmail.com)
∗∗
de
∗∗ Departamento
Educación
Departamento
deDepartamento a de
de Informática
Distancia, Juan
Informática
Educación a Distancia, y
del
y Automática,
Rosal, 16,
Automática,
Juan ydelAutomática, Universidad
28040, Nacional
Madrid,
Universidad
Rosal, 16, 28040, Spain
Nacional
Madrid, Spain
de Informática Universidad Nacional
de
de Educación
(emails:a Distancia, Juan del
efabregas@bec.uned.es, Rosal, 16, 28040, Madrid,
sdormido@dia.uned.es) Spain
de Educación a Distancia, Juan del Rosal, 16, 28040, Madrid, Spain
Educación
(emails:a Distancia, Juan del
efabregas@bec.uned.es, Rosal, 16, 28040, Madrid,
sdormido@dia.uned.es) Spain
(emails: efabregas@bec.uned.es,
(emails: efabregas@bec.uned.es, sdormido@dia.uned.es)
efabregas@bec.uned.es, sdormido@dia.uned.es)
sdormido@dia.uned.es)
(emails:
Abstract: This
Abstract: This paper
paper describes
describes a a new
new module
module to to create
create advanced
advanced simulations
simulations with with the the Khepera
Khepera
Abstract:
IV mobile This
IV mobile
Abstract: robotpaper
robot
This in
in V-REP
paper describes
describes
V-REP a
a new
new module
simulator.
simulator. The
module to
to create
The library, create
library, advanced
called KH4VREP,
advanced
called KH4VREP, simulations
simulations allowswith
allows withusers
usersthe
thetoKhepera
add
add aa
Khepera
to
Abstract: This paper describes a new module to create advanced simulations with the Khepera
IV
IV mobile
Khepera
mobile IV robot
model
robot in
in toV-REP
a
V-REP new simulator.
or an The
existing
simulator. The library,
V-REP
library, called
simulation.
called KH4VREP,
The
KH4VREP, KH4VREP allows
allows users
library
users to
to add
depicts
add a
Khepera
IV mobile IV robot
modelintoV-REP a new or an existing
simulator. TheV-REPlibrary,simulation.
called KH4VREP, The KH4VREP allows users add aa
librarytodepicts
Khepera
a graphical
Khepera
a graphical IV
IV model
model to
representation
to a
a new
new ofor
or an
the
an existing
Khepera
existing V-REP
IV
V-REP simulation.
model, and
simulation. also The
The KH4VREP
provides
KH4VREP several library
methods
library depicts
depicts to
Khepera IV representation
model to a newoforthe Khepera V-REP
an existing IV model, and also
simulation. The provides
KH4VREP several methods
library depicts to
a graphical
programmatically representation
read and of
and manipulatethe Khepera
manipulate IV
the sensors
sensors model, and
and actuators
actuators alsoof provides several methods to
a graphical
graphical representation
aprogrammatically read
representation of
of the
the Khepera the
Khepera IV
IV model,and
model, and
and alsoalsoofprovides
the robot.
the
provides robot. The visual
several
The
several visual
methods
methods design
design to
to
programmatically
of
of the
the model
model has
programmatically read
has been
been and
and manipulate
readdeveloped
developed using the
the sensors
using Autodesk
manipulate and
and actuators
sensorsInventor.
Autodesk Inventor. The
The library
actuators of
of the
library robot.
robot. The
the provides
provides visual
visual design
functionality
The
functionality design to
to
programmatically read and manipulate the sensors and actuators of the robot. The visual design
of
test
of
testthe
thethe model
mobile
model has
has been
robot
been developed
under
developed using
different
using Autodesk
control
Autodesk Inventor.
problems
Inventor. The
such
The library
as:
library provides
position
provides functionality
control, trajectory
functionality to
to
of thethe mobile
model has robot under different
been developed control problems
using Autodesk Inventor.such as: position
The library provides control, trajectory
functionality to
test the
tracking,
test the mobile
path robot
path following, under different
obstacle control
avoidance, problems
and
and multi-robot such as:experiments
position control,
with trajectory
with formation
test the mobile
tracking, mobile robot
robot under
following, under different
obstacle
different control
control problems
avoidance, problems such
such as:
multi-robot position
position control,
as:experiments control, trajectory
formation
trajectory
tracking,
control.
tracking,
control. path
path following,
following, obstacle
obstacle avoidance,
avoidance, and
and multi-robot
multi-robot experiments
experiments with
with formation
formation
tracking, path following, obstacle avoidance, and multi-robot experiments with formation
control.
control.
control.
© 2017, IFAC (International Federation of Automatic Control) Hosting by Elsevier Ltd. All rights reserved.
Keywords:
Keywords: Khepera Khepera IV, IV, Control
Control engineering simulations, V-REP
engineering simulations, V-REP simulator.
simulator.
Keywords:
Keywords: Khepera
Khepera IV,
IV, Control
Control engineering
engineering simulations,
simulations, V-REP
V-REP simulator.
simulator.
Keywords: Khepera IV, Control engineering simulations, V-REP simulator.
1. INTRODUCTION
1. INTRODUCTION of these
of these platforms
platforms have have licenses
licenses that that can
can bebe used
used freefree of
of
1.
1. INTRODUCTION
INTRODUCTION of
of these
charge
charge forplatforms
thesefor educational
platforms
educational have licenses
licenses that
havepurposes.
purposes. Mostcan
Most
that of be
be used
of these
can these free
free of
simulators
used
simulators of
1. INTRODUCTION of these platforms have licenses that can be used free of
charge
include for
include
charge for educational
models
educational
models of thepurposes.
of the best
best known
purposes. known Most
Mostand of
of these
and simulators
commercialized
these simulators
commercialized
During
During the the last last years,
years, robotics
robotics has has beenbeen introduced
introduced in in charge
include
robots.
include
for
In
educational
models
some
models of
cases
of the
the
purposes.
thebest
best known
Most
developments
known
of
and
and
these simulators
commercialized
can be exported
commercialized
During the robots.
in include In some cases the developments
models of the best known and commercialized can be exported
education
During
education
During theat
the atlastall years,
all
last
last levels. robotics
levels.
years,
years, Roboticshas
Robotics
robotics
robotics has
hasis been
is been
been
introduced
introduced in
aa multidisciplinary
multidisciplinary
introduced in robots.
to the
robots. In
real
In some
robot
some cases
for
cases the
testing
the developments
after
developmentsusing can
the
can be
simulator.
be exported
exported
education to the
robots. real
In robot
some for
cases testing
the after
developmentsusing the
can simulator.
be exported
subject.
subject. It
education
education It at
at
at
all
all levels.
expands
expands
all to
levels.
Robotics
to several
levels. Robotics
several
Robotics
is
is a
engineering
engineering
is
multidisciplinary
and
and scientific
aa multidisciplinary
multidisciplinary
scientific to to the
the real
real robot
robot for
for testing
testing after
after using
using the
the simulator.
simulator.
subject.
disciplines
subject.
disciplines It
It expands
such
expands
such as
as to
to several
electrical
several
electrical engineering
engineering,
engineering
engineering,
subject. It expands to several engineering and scientific
and
computer
and
computer science, to
scientific
scientific
science, The
The the real
V-REP
V-REP robot
simulator
simulatorfor testing
deserves
deserves after using
aa special
special the simulator.
mention
mention for
for being
being
disciplines
control
disciplines such
engineering,
such as
control engineering, as electrical
and
as electrical
electrical engineering,
mechanical
engineering,
and mechanical among
among computer
computerothers.
others.science,
That
science,
That The The
one
The V-REP
of
V-REP
one V-REP the
of the most simulator
most
simulator widely
widely deserves
used
deserves a
used aafor special
for mention
pedagogical
special for
for being
mention purposes
pedagogical being
purposes
disciplines such engineering, computer science, simulator deserves special mention for being
control
is
is why
control engineering,
why robotics
engineering,
robotics is
is veryand
very mechanical
and interesting
mechanical and
interesting among
among
and others.
versatile
others.from
versatile That
Thataa one
from today.
one
today. of the
of This most
most widely
the simulator
This simulator widely is used
used for
is aa versatile
versatile pedagogical
forand
and scalable purposes
scalable framework
pedagogical purposes
framework
control engineering, and mechanical among others. That one of the most widely used for pedagogical purposes
is
is why
pedagogical
why
pedagogicalrobotics
robotics point is
is ofvery
view
very
pointisofvery interesting
Farias
interesting
viewinteresting et
Farias et al. and
al.
and versatile
(2015).
versatile
(2015). from
from a
a today.
for
today. This
creating
This
for creating simulator
3D simulations
simulator
3D simulations is
is a
a versatile
in
versatile a and scalable
relatively
and
in a relatively short
scalable framework
period
period of
framework
shortframework of
is why robotics and versatile from a today. This simulator is a versatile and scalable
pedagogical
pedagogical point
point of
of view
view Farias
Farias et
et al.
al. (2015).
(2015). for
time
for
time creating
(Rohmer
creating
(Rohmer 3D
3D et
etsimulations
al. (2013)).
simulations
al. (2013)). in
in aa relatively
relatively short
short period
period of
of
pedagogical
Robotics is point
also aof view
vast Farias
area, it et
hasal.
Robotics is also a vast area, it has a large number of time (2015).
a large number of for creating 3D simulations in a relatively short period of
time (Rohmer
(Rohmer et
et al.
al. (2013)).
(2013)).
Robotics
branches. is
branches.
Robotics
Robotics
also
also a
isMobile
Mobile
is also
vast
vast area,
aarobotics
robotics
vast is the
area,
is
area, theit has
has a
branch
it branch
it has
large
that number
that
aa large
large deals
deals with
number
number withof time
of
of V-REP
V-REP (Rohmer
has
has anan et al.
integrated
integrated (2013)). development
development environment
environment (IDE) (IDE)
branches.
robots
branches.
robots that
that Mobile
are
Mobile
are not
notrobotics
robotics is
physically
is
physically the
the branch
fixed
branch
fixed during
during that
that deals
their
deals
their with
opera-
with
opera- V-REP
that
V-REP
that is
is has
based
has
based an
an integrated
on a
integrated
on a development
distributed
development
distributed and
and environment
script-driven
environment
script-driven (IDE)
archi-
(IDE)
archi-
branches. Mobile robotics is the branch that deals with V-REP has an integrated development environment (IDE)
robots
tion.
tion. In
robots Inthat
the are
the
that are not
not physically
literature
literature mobilefixed
aa mobile
physically robotduring
fixed
robot is defined
during
is their
defined opera-
as:
their as: “an that
opera-
“an tecture:
that
tecture:is
is based
each
each scene
based on
on aaa object
scene distributed
distributed
object can
can have and
and an
have script-driven
embedded archi-
embedded
script-driven
an script
archi-
script
robots that are not physically fixed during their opera- that is based on distributed and script-driven archi-
tion.
tion. In
automatic
In
automatic the
the literature
machine
literature
machine that a
a ismobile
capable
mobile
thata ismobile
capable robot
of
robot is
is defined
locomotion”
defined
of locomotion” as:
as: “an
Peralta
“an
Peralta tecture:
attached,
tecture:
attached,eacheach
all
each scene
operating
scene
all operating object
objectat the
at the can
can samehave
have an
time,
an embedded
in a
embedded threaded script
or
script
tion. In the literature robot is defined as: “an tecture: scene object cansame havetime, in a threaded
an embedded or
script
automatic
et al.
automatic(2016).
et al. (2016). machine
The
machine that
students
that
The students is
is capable
can
capable see of
of
can seeofthis locomotion”
this kind
locomotion” of
kind of robots Peralta
robots
Peraltaas attached,
non-threaded
attached,
as attached,
non-threaded all
all operating
fashion.
operating
fashion. V-REP at
V-REP
at the
the same
comes
same time,
with
time,
comestime, in
ina a threaded
large
a
withina alarge number
threaded
number or
or
automatic machine that is capable locomotion” Peralta all operating at the same threaded or
et
justal.
et (2016).
(2016). The
attractive
al.attractive
just toys,students
The
toys, but with
students
but with can
can see
see this
mobile
mobile robots,
this
robots,kind of
of robots
students
kind students
robotscan as
as non-threaded
can of examples,
examples, models
non-threaded
of fashion.
models
fashion.of ofV-REP
robots,comes
V-REP
robots, sensors
comes
sensorswith
withand
andaa large number
actuators
large number
actuators to
to
et al. (2016). The students can see this kind of robots as non-threaded fashion. V-REP comes with a large number
just
just attractive
analyze, test
attractive
analyze, test and toys,
and
toys, but
understandwith
but with
understand mobile
fundamental
with mobile
mobile
fundamental robots, students
concepts
robots,concepts
studentsthat can
that
can of of
of examples,
create a
examples,
create virtual
a virtual models
world
models
worldof of and
ofand robots,
to
robots, sensors
interact and
with
sensorswith
to interact actuators
it in
and itactuators running
actuators
in running to
to
just attractive toys, but robots, students can examples, models robots, sensors and to
analyze,
are
are difficult
analyze, test
test to
difficult and
and
to understand
explain from aafundamental
from
understand
explain theoretical
theoretical point
fundamental concepts
concepts
point of that
that create
of view
view time.
time. New
create aa virtual
New models
virtual
models world
can and
can
world be
be also
and to
to interact
also designedwith
designed
interact and it
and
with in
in running
itadded
added to
to V-
running V-
analyze, test and understand fundamental concepts that create a virtual world and to interact with it in running
are
are difficult
Fabregas
difficult
Fabregas et
et al. to
al.
to explain
(2011);
explain from
Neamtu
from a
a ettheoretical
al. (2011);
theoretical point
Merdan
point of
of view
et al.
view time.
REP
time. New
to
New models
implement
models can be
customized
can be also
also designed
simulation
designed and
and added
experiments.
added to
to V-
V-
are difficult to (2011);
explainNeamtu from aettheoretical
al. (2011); point Merdan of et al. time.
view REP to New implement
models can customized simulation
be also designed andexperiments.
added to V-
Fabregas
(2016). et
Fabregas
(2016). et al.
al. (2011);
(2011); Neamtu
Neamtu et et al.
al. (2011);
(2011); MerdanMerdan et et al.
al. REP REP to
to implement
implement customized
customizedofsimulation simulation experiments.
experiments.
Fabregas et al. (2011); Neamtu et al. (2011); Merdan et al. REP
This to
paperimplement
is customized
aa continuation simulation
the previous experiments.
work
(2016).
(2016). This paper is continuation of the previous work of of the
the
(2016).
In most research fields, simulators are
In most research fields, simulators are very important to This very important to This
authors
This paper
paper is
Peralta
is a
a continuation
et al.
continuation (2016). of
of the
The
the previous
paper
previous work
describes
work of
of the
the
authors paper Peralta et al. (2016).of The
is a continuation paper describes
the previous work of the
In
testmost
In
testmost research
theories,
research
theories, ideas,
ideas,fields,
fields,
and simulators
and designs
designs
simulators are
before
are the
before very
the
veryrealimportant
real implemen-
important
implemen- to
to authors
authors
library Peralta
Peralta et
library KH4VREP,
KH4VREP, al.
al. (2016).
which
et which allowsThe
(2016).
allows users
The
userspaper
to add
paper
to adddescribes
a Khepera
describes
a Kheperathe
the
In most research fields, simulators are very important to authors Peralta et al. (2016). The paper describes the
test
test theories,
tation. But
theories, inideas,
the
ideas, and
field designs
of
and designs
designs before
robotics,
beforethese the
these real
the real
real implemen-
simulators
implemen- are library
IV robot
library KH4VREP,
model
KH4VREP, to which
a new
which allows
or existing
allows users to
V-REP
usersV-REP add
to add a Khepera
simulation.
add simulation.
tation.
test But inideas,
theories, the fieldand of robotics,before the simulators
implemen- are library
IV robot model to awhich
KH4VREP, new or existing
allows users to aa Khepera
Khepera
tation.
even
even much But
Butmore in
in the field
field of
important of robotics,
since
since advanced these simulators
these robots are are
are IV
are still Therobot
The model modelhas to
beenaaa new
new or existing
existing with
encapsulated V-REP simulation.
tation.
tation.muchBut more
in the
theimportant
field of robotics,
robotics, advanced
these simulators
robots
simulators still
are IV
IV robot
model
robot model
modelhas to been
to new or existing with
or
encapsulated V-REP
V-REP many
many built-in
simulation.
built-in
simulation.
even
very
even
very much
expensive.
much
expensive.more
more important
Currently,
important
Currently, since
there
since
there advanced
are many
advanced
are many robots
robots are
simulators
are
simulators still
for
still
for The
The model
functions
model
functions to
to has
has been
manipulate
been
manipulate encapsulated
and
encapsulated
and control
control with
the
with
the many
robot
many
robot built-in
in very
built-in
in very
even much more important since advanced robots are still The model has been encapsulated with many built-in
very
very expensive.
different robotic Currently,
robotic
expensive.
different branches
branches with
Currently, there
there
with very
veryare many
many simulators
aresophisticated
sophisticated simulators for
for functions
features.
features. easy way.
functions
easy way. to
This
to
This manipulate
new
manipulate
new version
version and
and control
includes
control
includes the
several
the
several robot
examples,
robot
examples, in
in very
such
very
such
very expensive. Currently, there are many simulators for functions to manipulate and control the robot in very
different
Among
Among others,
different robotic
robotic branches
others, it
it cancan be
branches bewithfound
with
foundvery
very thesophisticated
the following features.
sophisticated
following popular easy
features.
popular as: aa way.
as:
easy new This
new
way. algorithm
This
algorithmnew
new version for includes
for obstacles
version includes
obstacles several
several examples,
avoidance
avoidance (VFH,
(VFH, Ulrich
examples, such
such
Ulrich
different robotic branches with very sophisticated features. easy way. This new version includes several examples, such
Among
simulators:
Among
simulators: others,
Webots
others,
Webots it
it can
can be
(Michel
be
(Michel found
(2004)),
found
(2004)),thethe
theGazebo
Gazebofollowing
following(Koenig
(Koenigpopular
and
popular
and as: as:
and
as: a
a new
new
andaBorenstein algorithm
Borenstein
algorithm (2000));
(2000)); for
for obstacles
and some
obstacles avoidance
multi-robot
avoidance (VFH, Ulrich
experiments
(VFH, Ulrich
Among others, it can be found following popular new algorithm for and some multi-robot
obstacles avoidance (VFH, experiments
Ulrich
simulators:
Howard (2004)),
simulators:
Howard Webots
(2004)),
Webots RFCSIM
RFCSIM(Michel (2004)),
(2004)), Gazebo
(Fabregas
(Michel(Fabregas et al.
Gazebo
et (Koenig
al. (2014))
(2014))
(Koenig andand
and V- and
and
V- (withBorenstein
and
(with several kheperas
Borenstein
several (2000));
kheperas
(2000));or orand
andother
othersome
some multi-robot
existing modelsexperiments
multi-robot
existing models in V-REP
V-REP ))
experiments
in
simulators: Webots (Michel (2004)), Gazebo (Koenig and and Borenstein (2000)); and some multi-robot experiments
Howard
REP
Howard
REP (2004)),
(Coppelia RFCSIM
Robotics
(2004)),Robotics
(Coppelia RFCSIMGmbH (Fabregas
GmbH
(Fabregas (2015)).
(2015)).et
et al.al.
al. (2014))
These
(2014))
These and
simulators
and V-
simulatorsV-
V- (with (with
to several
perform
(with several
to perform kheperas
formation
kheperascontrol.
formation or other
control.
or other existing
other existing models
models in
existing models in V-REP
V-REP )))
Howard (2004)), RFCSIM (Fabregas et (2014)) and several kheperas or in V-REP
REP
have
REP (Coppelia
have several
(Coppelia
several Robotics
specific
Robotics
specific GmbH
GmbH (2015)).
characteristics,
characteristics, but These
but
(2015)). in
in general
These simulators of to
all of
simulators
general all to perform
perform formation
formation control. control.
REP (Coppelia Robotics GmbH (2015)). These simulators to perform formation control.
have
them
have several
are well
several
them several specific
made
specific
are wellspecific
made and characteristics,
and have a
characteristics, good
have a goodbut but
but in general
performance.
in general
performance. all
Some
all of
of
have characteristics, in general Some all of
them
them are are well
well mademade and and havehave a good
good performance.
performance. Some
them are well made and have aa good performance. Some
Some
Copyright
2405-8963 ©
Copyright © 2017
2017 IFAC
© 2017, IFAC 9489
9489Hosting by Elsevier Ltd. All rights reserved.
IFAC (International Federation of Automatic Control)
Copyright
Peer review© 2017
under IFAC
responsibility of International Federation of 9489
Automatic
Copyright © 2017 IFAC
Copyright © 2017 IFAC 9489Control.
9489
10.1016/j.ifacol.2017.08.1721
Proceedings of the 20th IFAC World Congress
Toulouse, France, July 9-14, 2017 G. Farias et al. / IFAC PapersOnLine 50-1 (2017) 9150–9155 9151

The remainder of the paper is organized as follows: Section VREP and copy it in the following path: ..\V-REP3\V-REP_
2, presents some characteristics of the V-REP simulator PRO_EDU\models\robots\mobile. Once the file is copied,
and the Khepera IV robot; Section 3 describes the library it will appear in the list of models of V-REP, as it can be
KH4VREP ; Section 4 shows the implementation and the seen on the left side of Figure 1.
results of some test experiments developed with the li-
brary; and Section 5 presents the main conclusions and
future works.
2. V-REP AND KHEPERA IV ROBOT

The Virtual Robot Experimentation Platform (V-REP ) is


a versatile and scalable framework to develop 3D simula-
tions in a relatively short period of time. This simulator
was created in 2010 and has been growing during the last
years. Nowadays, this is one of the most used simulators
for education in the robotics field (with a free licence for
educational purposes). As its authors say: “V-REP is the
Swiss army knife among robot simulators.”
V-REP has an integrated development environment (IDE)
that is based on a distributed control architecture: each ob- Fig. 1. Integration of the model in V-REP
ject/model can be individually controlled via an embedded
script, a plug-in, a Robot Operating System (ROS) node, To add the model to the simulation you need to drag and
a remote API client, or a custom solution. The controllers drop the robot to the workspace. The result is shown on
can be written in different languages: C/C++, Python, the right side of the Figure 1.
Java, Lua, Matlab, Octave or Urbi (Coppelia Robotics
GmbH (2015)). V-REP comes with a large number of The library is titled KH4VREP and it is divided into two
examples, models of robots, sensors and actuators to create parts: 1) the graphical model of the Khepera IV robot
a virtual world and to interact with it in running time. (visual components); and 2) a set of software functions to
carry out some specific tasks.
2.1 Khepera IV robot
3.1 Visual components
The Khepera IV robot is the most recent development of
the Swiss company K-Team (2015). This version is newest The Khepera IV is a rigid body with a differential be-
generation of Khepera family. From its first version, these havior, due to it is equipped with two wheels that are
robots have been designed with research and educational driven by DC motors with encoder and gearbox. The
purposes in mind. minimum controlled speed of the robot is 3 mm/s and
the maximum speed is about 813 mm/s. In the case of the
It offers wifi and bluetooth communications, color camera,
caster wheels, both are considered as fixed spheres in the
USB host, a large number of advanced features such as:
model. Note that the gyroscope and accelerometer sensors
8 infra-reds sensors, 5 ultrasonics sensors, accelerometer,
were not included in the model since that information is
gyroscope, microphone, a large duration battery (5 hours),
given directly by the V-REP simulator for each included
loudspeaker, 3 top RGB LED, improved odometry and
model.
precision. The CPU is a 800MHz ARM Cortex-A8 Pro-
cessor (with linux core running) and additional micro- To design and to implement the model, all visual parts of
controller for peripherals management. the robot (case, base, wheels, etc...) were modeled using
Autodesk Inventor and assembled in V-REP. The obtained
The robot can be programmed from a Linux-based oper-
prototype was imported to V-REP as .stl format. V-REP
ating system and C language. Khepera IV has a modular
allows to add physical properties and dynamics to this kind
configuration, with a cylindrical shape to minimize the
of prototypes. The model also has 5 ultrasonic sensors, 8
damage and negative effects in its parts under collision
infrared sensors (eight around the case and four in the
conditions. Khepera is a differential wheeled robot whose
bottom of the robot to perform line following), one color
movement is based on two separately driven wheels placed
camera, two wheel motors, and two caster wheels. All these
on each side of its body. The device can be used for differ-
sensors and actuators were added and configured using
ent experiments such as: line following, obstacle detection
existing elements of V-REP. Figure 2 shows the assembling
and avoidance in a dynamic environment, advanced signal
process of the robot in V-REP.
processing, motion control, wireless communication, image
processing, formation control, and many other advanced
topics. Undoubtedly, this robot is a powerful tool for 3.2 Software components
teaching robotics.
The software components of the library are in a script
3. KH4VREP LIBRARY associated to the model. This script is a main thread
with an infinite loop that contains calls to functions that
To use the library you need to include it in V-REP sim- carry out some specific tasks during the simulation. The
ulator. To do it you need to download the file Khep- following code segment shows the structure of the main
eraIV.ttm from: https://github.com/EAPH/K4_Model_ function for the example of position control.

9490
Proceedings of the 20th IFAC World Congress
9152
Toulouse, France, July 9-14, 2017 G. Farias et al. / IFAC PapersOnLine 50-1 (2017) 9150–9155

θ, where α is the current angle to the target point and θ


is the current orientation of the robot. At the same time,
the robot tries to reduce the distance to the target point
(d ≈ 0).

Fig. 2. Assembling the model of the Khepera IV


1 s e t R o b o t ( vmax , wmax , L , x i , y i , t h e t a i )
2 t h r e a d F u n c t i o n=f u n c t i o n ( )
3 w h i l e ( l o o p ==1) do Fig. 4. Position control experiment
4 −−Get p o s i t i o n and o r i e n t a t i o n o f t h e r o b o t
5 xc , yc , t h e t a=g e t R o b o t P o s i t i o n ( ) Equations (1) and (2) are implemented in the block
6 −−Get t a r g e t p o s i t i o n
7 xp , yp=g e t T a r g e t P o s i t i o n ( )
Compute; by using as reference the target point (Tp ) and
8 −−Apply p o s i t i o n c o n t r o l the current position of the robot (C).
9 v , w=p o s i t i o n C o n t r o l ( xp , yp , xc , yc , t h e t a ) 
2 2
10 −−Update r o b o t v e l o c i t i e s d = (yp − yr ) + (xp − xr ) (1)
11 u p d a t e V e l o c i t i e s ( v , w)  
12 end y p − yr
13 end α = tan−1 (2)
xp − xr
The code starts by setting the initial conditions, for With the outputs of the block Compute the block Control
example: function setRobot to establish the initialization Law calculates the linear velocity (ν) and the angular
parameters of the robot (line 1). Line 2 is the definition of velocity (ω) of the robot as it is shown in equations (3)
the thread main function (threadFunction). In line 3 starts and (4) (Villela et al. (2004)).
the infinite while loop. Line 5 obtains the current position 
and orientation of the robot with the function getPosition.
νmax  if |d| > kr
ν= νmax (3)
Line 7 obtains the coordinates of the target point with the d if |d| ≤ kr
function getTarget. Line 9 executes the position control of kr
the robot with function positionControl. Line 11 updates ω = ωmax sin (α − θ) (4)
the angular and linear velocities of the robot model.
where νmax is the maximum linear velocity, kr is the radius
of a docking area (around the target point) and ωmax is
3.3 Position control experiment
the maximum angular velocity of the robot.
This experiment is to drive the wheeled mobile robot The following code segment represents the implementation
from its current position to a predefined target point. of the function positionControl in the KH4VREP library.
This problem has been widely studied during the last Note that this function is called in line 9 of the main
years, due to the kinematic model of these robots may function in the previous example.
seem deceptively simple, but nonholonomic constraints 1 p o s i t i o n C o n t r o l=f u n c t i o n ( xp , yp , xc , yc , t h e t a )
introduce a challenging problems in the designing of the 2 d = m a t h . s q r t ( ( ( xp−xc ) ˆ 2 ) + ( ( yp−yc ) ˆ 2 ) )
control law (Fabregas et al. (2016)). Figure 3 shows the 3 a l p h a = m a t h . a t a n 2 ( yp−yc , xp−xc ) −−T a r g e t a n g l e
4 Oc = alp ha−t h e t a −−E r r o r a n g l e
blocks diagram of this experiment. 5 i f ( d>=0. 0 5 ) t h e n
6 w=Wmax∗ m a t h . s i n ( Oc ) −−Angular v e l o c i t y
Tp
d ν 7 v=(vmax/ k r ) ∗ d −−L i n e a r v e l o c i t y
x, y, θ
Compute Motors 8 i f ( v>vmax ) t h e n −−L i n e a r v e l o c i t y s a t u r a t i o n
α Control Law ω
9 v=vmax
10 end
C 11 e l s e v=0 , w=0
Position Sensor 12 end
13 r e t u r n v , w −−V a l u e s r e t u r n e d
14 end

Fig. 3. Block diagram of the position control problem


Line 1 is the definition of the positionControl function
Figure 4 shows the variables involved in this experiment. which receives as parameters the coordinates of the current
The robot tries to minimize its orientation error, θe = α − target point (xp; yp) and the current position (xc; yc) and

9491
Proceedings of the 20th IFAC World Congress
Toulouse, France, July 9-14, 2017 G. Farias et al. / IFAC PapersOnLine 50-1 (2017) 9150–9155 9153

orientation (theta) of the robot. Lines 2 and 3 calculate 4 f o r i =1 ,8 ,1 do


5 Vl=Vl+WLS[ i ] ∗ ( 1 − ( S [ i ] / Smax ) )
equations (1) and (2). Line 4 obtains the orientation angle
6 Vr=Vr+WRS[ i ] ∗ ( 1 − ( S [ i ] / Smax ) )
error. Lines 6 calculates equation (4) and line 7 calculates 7 end
equation (3). Lines 8 to 10 are the saturation of the 8 v=(Vr+Vl ) / 2
calculated linear velocity (ν). Lines 12 and 13 set the 9 w=(Vr−Vl ) / L
10 end
velocities to zero if the robot is very close to the destination
11 r e t u r n v , w
point (less than 0.05 m). The function returns the values 12 end
of the velocities in line 15.
The function Braitenberg is called after the function po-
3.4 Obstacles avoidance experiment sitionControl in the main threadFunction.Line 1 is the
definition of this function. Line 2 asks for the obstacle de-
The obstacles avoidance problem has been widely studied tection. If one of the 8 sensors does not has the maximum
using different techniques. Note that this problem is a value, is because an obstacle has been detected. Lines 5
next step of the position control. The robot must be and 6 implement equations (5), (6) and (7). Lines 8 and
able to avoid the obstacles that appear on its way to the 9 calculate ν and ω from the differential model. Line 11
destination. To do that, the block Avoidance is added after returns the values of the calculated velocities.
the Control Law block. This block calculates new velocities
(ν’ and ω’) if the sensors detect obstacles. In the absence VFH algorithm. This method allows a fast and smooth
of obstacles ν’=ν and ω’=ω. Figure 5 shows the block motion of the robot avoiding obstacles in a dynamical
diagram of this experiment. environment. The speed is the maximum in the absence of
obstacles. The robot tries to maintain this speed during the
Proximity Sensors trajectory unless being forced to slow down by the VFH
algorithm to the instantaneous speed ν and to change the
Tp
d ν ν’
angular velocity according to equations (8) and (9).
x, y, θ
Compute α Control Law ω Avoidance ω’ Motors  
ω
ν = ν 1 − (8)
ωmax
C
Position Sensor
ω = ωmax sin (θe ) (9)
where ωmax is the maximal allowable angular velocity for
Fig. 5. Control block diagram with obstacle avoidance the robot that will be achieved when the orientation error,
θe = ±90◦ , and ν  is defined in equations (10 and 11).
 
The block Avoidance can be implemented with different h
ν  = νmax 1 − c (10)
algorithms depending of the obstacles sensors and its hm
location on the robot. In this case, to test the library hc = min (hc , hm ) (11)
two algorithms have been implemented: Braitenberg (Yang
et al. (2006)) and (VFH ) Vector Field Histogram (Ulrich where νmax is the maximum linear velocity, hm is a
and Borenstein (2000)). constant empirically determined to cause a reduction in
the speed in presence of obstacles, and hc is the value of
Braitenberg algorithm. This algorithm creates a weighted the histogram of the distance between the robot and the
matrix that converts the sensor inputs into motors speeds. obstacles. If hc > 0 then an obstacle lies ahead of the robot.
This matrix is a two-dimensional array with the number of Large values of hc means a bigger obstacle lies ahead or an
columns corresponding to the eight sensors, and the rows obstacle is very close to the robot. In both cases a change
corresponding to the two motors. Equation (5) represents of the direction is required. This means that a reduction in
such matrix, where WLS1 is the weight of sensor S1 in the the linear velocity is needed to turn to the new direction.
speed of the left motor. Equation (6) represents the values
of the sensors at each
 time.  3.5 Multi-robot experiment
WLS1 WLS2 . . . WLS8
W = (5)
WRS1 WRS2 . . . WRS8
This experiment is a formation maneuver of a group of
T
S = (S1 S2 . . . S8 ) (6) robots. Where one of them is the leader and the rest are
the followers. The position of the leader is controlled using
With these matrices, the velocities for each motor are the aforementioned algorithm. The followers also control
calculated as shown in equation (7), where (Smax ) is the their positions, but taking the position of the leader as
maximum value of the proximity sensors if no obstacle is reference to make a formation around him. For example a
detected. circle with the leader located at the center (Lawton et al.
νL,R = W ∗ (1 − (S/Smax )) (7) (2003)).
Velocities ν’ and ω’ are calculated from νR and νL using The followers have three parameters in the function tar-
the differential model equations. The following code seg- getPosition to modify their destination points: 1) the
ment shows the implementation of this algorithm. coordinates of the leader robot; 2) the distance to the
1 b r a i t e n b e r g C o n t r o l=f u n c t i o n ( )
leader in the formation; and 3) the angle with respect to
2 i f ( S [ 1 ] + S [ 2 ] + S [ 3 ] + S [ 4 ] + S [ 5 ] . . −−O b s t a c l e detected the leader’s position. This configuration allows different
3 . . +S [ 6 ] + S [ 7 ] + S[8] <=Smax ∗ 8 ) t h e n formation around the leader robot. The coordinates of the

9492
Proceedings of the 20th IFAC World Congress
9154
Toulouse, France, July 9-14, 2017 G. Farias et al. / IFAC PapersOnLine 50-1 (2017) 9150–9155

target point (xp , yp ) of the followers in the formation are VFH algorithm. In both cases, the robot has to reach its
obtained in equation (12). destination point (red semi-sphere). The configuration in
 both cases is similar: a wall (in green and black colors) and
xp = xL + rcos(β + θ)
(12) an obstacle in (yellow and black colors) on the way to the
yp = yL + rsin(β + θ) target point.
where the position of the leader robot is (xL ,yL ). r is the
distance of the follower to the leader (for example: radius
of the circle). β is the angle to the leader and θ is the
orientation of the leader robot.
The following code segment shows an example of the
implementation of this function for a follower robot located
at 0.5 meters and 180◦ with respect to the leader robot.
1 xp , yp=g e t T a r g e t P o s i t i o n ( ’ Khepera IV0 ’ , 0 . 5 , 1 8 0 )
2 ...
3 t a r g e t P o s i t i o n=f u n c t i o n ( ob j , o b j D i s t , objAng )
4 d i s t a n c e M a s t e r=o b j D i s t
5 a n g l e M a s t e r=objAng ∗ m a t h . p i /180
6 t a r g e t=s i m G e t O b j e c t H a n d l e ( o b j )
7 s i m S e t O b j e c t P a r e n t ( t a r g e t , −1 , t r u e )
8 t a r=s i m G e t O b j e c t P o s i t i o n ( t a r g e t , −1)
9 o r i T a r=s i m G e t O b j e c t O r i e n t a t i o n ( t a r g e t , −1)
10 xp=t a r [ 1 ] + d i s t M a s t e r ∗ m a t h . c o s ( angMaster+o r i T a r [ 3 ] )
11 yp=t a r [ 2 ] + d i s t M a s t e r ∗ m a t h . s i n ( angMaster+o r i T a r [ 3 ] )
12 r e t u r n xp , yp
13 end
14 ...
15 v , w=p o s i t i o n C o n t r o l ( xp , yp , xc , yc , t h e t a )
Fig. 6. Braitenberg vs VFH
Line 1 is the invocation of this function from the main As can be seen with the Braitenberg algorithm the robot
thread. Line 3 is the definition of the function with three reaches the destination point in a much more direct and
parameters: 1) leader robot name; 2) distance to the leader smoothed way. That is why the robot reaches the destina-
robot in the formation; and 3) angle with respect to tion point in less time. In the case of VFH, the robot moves
the leader robot in the formation. Lines 4 to 9 obtain with a zigzag path because the built histogram has “blind
the parameters of the leader robot (handle, position and zones” between the sensors due to the localization of the
orientation). Lines 10 and 11 implement equation (12). sensors around the robot. For this reason the histogram is
Line 12 returns the target coordinates (xp , yp ). After that, not continuous and the algorithm does not work properly
in the main thread the position control is executed (line as expected.
15).
Table 1 shows a summary of implemented functions and 4.2 Multi-robots experiment
their different tasks.
Table 1. KH4VREP Library methods Figure 7 shows an example of the multi-robot experiment
including obstacles avoidance (Braitenberg). In this case,
Methods Characteristics
five robots have been used (one leader and four followers).
setRobot Sets the parameters of the robot.
getPosition Obtain the position of the robot.
The configuration shows obstacles (in light gray color)
plot Creates a 2D line plot of the data. with different shapes and sizes.
getTarget Obtain the target point.
positionControl Controls the position of the robot.
braitenbergControl Executes the Braitenberg algorithm.
updateVelocities Updates the velocities of the robot.

4. RESULTS

In this section the implemented control problems are


presented to test the library: obstacles avoidance and
multi-robots. Note that these experiments implement the
position control of the robot.

4.1 Collision Avoidance (Braitenberg vs VFH Algorithms)

Figure 6 shows a sequence of the comparison of these two


algorithms. On the left side the robot implements the po-
sition control experiment with the Braitenberg algorithm
for obstacles avoidance and on the right side, with the Fig. 7. Multi-robots performing formation control

9493
Proceedings of the 20th IFAC World Congress
Toulouse, France, July 9-14, 2017 G. Farias et al. / IFAC PapersOnLine 50-1 (2017) 9150–9155 9155

The goal is to make a formation with cross form with the ACKNOWLEDGEMENTS
leader robot in the center as reference. All robots start
stopped occupying their respective positions in the forma- This work has been funded by the Chilean Ministry of
tion. Then the leader tries to reach its destination point Education under the Project FONDECYT 1161584, the
avoiding the obstacles that appear on its way. The traces Projects DPI2012-31303 and DPI2014-55932-C2-1-R of
of the positions of the robots show the trajectories followed the Spanish Ministry of Economy and Competitiveness.
to reach the destinations. As can be seen, formation is lost
during the displacement due to two aspects: 1) the targets REFERENCES
points of the followers are relative to the position of the
guide and it is moving; 2) follower avoid the obstacles that Coppelia Robotics GmbH (2015). V-REP simulator.
appear in their path. Fabregas, E., Farias, G., Dormido-Canto, S., and Dormido,
S. (2014). RFCSIM simulador interactivo de robótica
Another example of multi-robots experiment have been móvil para control de formación con evitación de
implemented to test the integration of the library with the obstáculos. In XVI Congreso Latinoamericano de Con-
existing models of V-REP. The experience consists in a trol Automático, Cancún, Quintana Roo, México.
Khepera IV that performs a position control experiment Fabregas, E., Farias, G., Dormido-Canto, S., Dormido,
and a quadcopter that must follows the Khepera IV using S., and Esquembre, F. (2011). Developing a remote
its position as reference (x, y) maintaining constant height laboratory for engineering education. Computers &
(z) relative to the ground. Figure 8 shows an image of this Education, 57(2), 1686–1697.
experiment: the on-board camera of the Khepera (bottom Fabregas, E., Farias, G., Dormido-Canto, S., Guinaldo, M.,
left side) and the on-board camera of the quadcopter Sánchez, J., and Dormido Bencomo, S. (2016). Platform
(bottom right side). As can be seen the quadcopter follows for teaching mobile robotics. Journal of Intelligent &
the Khepera IV robot in acceptable way. Robotic Systems, 81(1), 131–143.
Farias, G., Muñoz, D., Gómez-Estern, F., De la Torre, L.,
Sánchez, C., and Dormido, S. (2015). Adding automatic
evaluation to interactive virtual labs. Interactive Learn-
ing Environments, 1–21.
K-Team (2015). K team mobile robotics.
Koenig, N. and Howard, A. (2004). Design and use
paradigms for gazebo, an open-source multi-robot simu-
lator. In IEEE/RSJ International Conference on Intel-
ligent Robots and Systems, 2149–2154. Sendai, Japan.
Lawton, J., Beard, R., and Young, B. (2003). A de-
centralized approach to formation maneuvers. IEEE
Transactions on Robotics and Automation, 19(6).
Merdan, M., Lepuschitz, W., Koppensteiner, G., and
Balogh, R. (2016). Robotics in Education. Springer.
Michel, O. (2004). WebotsTM: Professional mobile robot
simulation. arXiv preprint cs/0412052.
Neamtu, D., Fabregas, E., Wyns, B., De Keyser, R.,
Fig. 8. A quadcopter follows a Khepera IV that performs Dormido, S., and Ionescu, C. (2011). A remote labora-
position control tory for mobile robot applications. In 18th IFAC World
Congress, volume 44, 7280–7285.
5. CONCLUSION Peralta, E., Fabregas, E., Farias, G., Vargas, H., and
Dormido, S. (2016). Development of a Khepera IV
Library for the V-REP Simulator. In 11th IFAC Sym-
In this paper the library KH4VREP for V-REP simulator
posium on Advances in Control Education ACE 2016,
has been presented. The library is an encapsulation of the
volume 49, 81–86. Bratislava, Slovakia.
model of the Khepera IV and includes built-in methods to
Rohmer, E., Singh, S., and Freese, M. (2013). V-REP:
manipulate the robot, and also a set of simulations to show
A versatile and scalable robot simulation framework. In
many control problems with mobile robots. The result of
2013 IEEE/RSJ International Conference on Intelligent
this development is a ready to use tool that allows the
Robots and Systems, 1321–1326.
implementation of experiments with these robots in an
Ulrich, I. and Borenstein, J. (2000). VFH∗ : Local obstacle
interactive and attractive environment. The library allows
avoidance with look-ahead verification. In ICRA, 2505–
to test and understand theoretical concepts in a dynamic
2511.
way in order to teach engineering control.
Villela, V.J.G., Parkin, R., Parra, M.L., González, J.M.D.,
In the near future, the library will be included in a pilot Liho, M.J.G., and Way, H. (2004). A wheeled mobile
platform that has been developed in our laboratories. robot with obstacle avoidance capability. Tecnologı́a Y
The main objective of the future work will be to design Desarrollo, 1(5), 159–166.
advanced control algorithms using the library and the Yang, X., Patel, R., and Moallem, M. (2006). A fuzzy
simulation environment. Among other, multi-agents ex- braitenberg navigation strategy for differential drive mo-
periments with consensus control problem and event-based bile robots. Journal of Intelligent and Robotic Systems,
communications between the robots could be included in 47(2), 101–124.
the library.

9494

You might also like