Professional Documents
Culture Documents
DE SISTEMAS Y AUTOMTICA
Robotics
Nicols Vargas Ortega
Exercise 8.1 Potential Fields
In
this
exercise
we
are
going
to
complete
a
code
implementing
a
reactive
navigation
algorithm
based
on
Potential
Fields.
This
code
generates
a
random
map
with
a
given
number
of
obstacles,
and
requests
the
user
to
set
the
robots
start
and
goal
positions
by
clicking
with
the
mouse
on
that
map.
Then
you
just
have
to
enjoy
watching
how
the
robot
moves.
1.
Implementation.
1.1
Implement
the
computation
of
the
Repulsive
Force
FRep,
which
is
the
sum
of
the
repulsive
forces
yielded
by
each
obstacle
close
to
the
object.
El
cdigo
resultante:
DEPARTAMENTO DE INGENIERA
DE SISTEMAS Y AUTOMTICA
DpInfluencial = Dp(:, iInfluencial);
DistanceInfluencial = Distance(iInfluencial);
%
% Compute repulsive (obstacles) potential field
%
fi = zeros(size(DpInfluencial));
if(~isempty(iInfluencial))
for j=1: length(iInfluencial)
fi(:,j) = ((1/DistanceInfluencial(j)) (1/RadiusOfInfluence)) * (1/DistanceInfluencial(j)^2) *
(DpInfluencial(:,j)/DistanceInfluencial(j));
end
FRep = KObstacles .* sum(fi,2);
else %nothing close
FRep = 0;
end
Comentario:
Cogemos
los
incrementosi
que
estn
dentro
del
rango
de
observacin,
y
los
guardamos
en
la
variable
DpInfluencial.
Lo
mismo
para
los
ri
en
la
variable
DistanceInfluencial.
Luego
hacemos
una
matriz
de
fi
que
son
los
vectores
que
recoge
el
robot
hasta
los
obstculos,
si
el
conjunto
de
ndices
no
est
vaco,
vamos
iterando
para
cada
ndice
y
aadindolo
a
la
matriz
fi
aplicando
la
frmula
que
nos
proporciona
el
documento.
Finalmente
calculamos
FRep
con
constante
KObstacles
y
la
sumatoria
de
todos
los
elementos
de
fi,
haciendo
la
suma
por
filas.
1.2
Compute
the
Attractive
Force
FAtt.
Normalize
the
resultant
Force
by !"#$ .
El
cdigo
resultante:
%
% Compute attractive (goal) potential field
%
%
FAtt = -KGoal * (xRobot - xGoal);
FAtt = FAtt / sqrt(sum((xRobot - xGoal).^2));
Comentario:
Aplicamos
la
frmula
proporcionada
y
normalizamos
FAtt.
DEPARTAMENTO DE INGENIERA
DE SISTEMAS Y AUTOMTICA
2.
Understanding
whats
going
on.
2.1
Explain
the
meaning
of
each
element
appearing
in
the
plot
during
the
simulation
of
the
Potential
Fields
reactive
navigation.
Los
puntos
azules
son
las
direfentes
poses
del
robot
en
cada
iteracin.
Los
obstaculos
son
los
circulos
rojos
y
en
verde
el
destino
que
queremos
alcanzar.
2.2
Run
the
program
setting
different
start
and
goal
positions.
Now
change
the
values
of
the
goal
and
obstacle
gains
(KGoal and KObstacles).
How
does
this
affect
the
paths
followed
by
the
robot?
Cuando
disminuimos
KObstacles
el
robot
se
acerca
ms
a
los
obstaculos,
tanto
que
llega
hasta
tocarlos.
Es
decir
la
fuerza
repulsive
de
los
obstaculos
al
robot
es
menor.
DEPARTAMENTO DE INGENIERA
DE SISTEMAS Y AUTOMTICA
Cuando
aumentamos
KGoal,
lo
que
el
robot
hace
va
moviendose
en
intervalos
ms
grandes,
es
decir,
da
pasos
ms
grandes.
2.3
Play
with
different
numbers
of
obstacles
and
discuss
the
obtained
results.
Cuando
disminumos
el
nmero
de
obstculos
el
robot
va
casi
recto,
ya
que
no
hay
compos
de
fuerza
que
actuen
en
su
contra.
Por
otro
lado,
cuando
incrementamos
el
nmero
de
obstculos
el
robot
es
incapaz
de
llegar
a
su
destino
ya
que
las
fuerzas
repulsivas
inpiden
que
el
robot
avance.
DEPARTAMENTO DE INGENIERA
DE SISTEMAS Y AUTOMTICA
2.4
Illustrate
a
navigation
where
the
robot
doesnt
reach
the
goal
position
in
the
specified
number
of
steps.
Why
did
that
happen?
Could
the
robot
have
reached
the
goal
with
more
iterations
of
the
algorithm?
Hint:
take
a
look
at
the
FTotal
variable.
El
robot
se
queda
bloqueado
ya
que
todas
las
fuerzas
van
en
su
contra.
Al
tener
muchos
obstculos
el
robot
cree
que
tiene
que
ir
en
direccin
contraria
y
se
queda
parado.