|
Homework
#4 A* and 3D Configuration Space Part I: Star Algorithm to build 3D
Configuration Space I have implemented again the Star Algorithm
to compute the 3-dimensional configuration space Q starting from the workspace
W and
the robot shape R. Since the robot can now
translate and rotate, the Q space is
where
the configuration If
we assume that the robot and the obstacles in the workspace are convex
polygons, the Star Algorithm computes the obstacles in the configuration space using the
normal vectors of each side of the polygons for each possible robot’s rotation angle The
algorithm sorts the sides of the robot and of one obstacle by increasing the angles
of normal vectors. Thereafter it builds the new convex polygon adding all the
sides of the robot and of the obstacle in the calculated sequence. In order to
define the position of the new obstacle in the configuration space for each
robot’s rotation angle To define the obstacle reference
point, I search for the obstacle vertex that the robot’s reference point can
touch for a given rotation angle ·
if the
two positions corresponding to the reference point of the old obstacle are the
same, the new reference point is this position; ·
elseif the
two positions corresponding to the reference point of the robot are the same,
the new reference point is this position; · elseif the two positions
corresponding to the reference point of the old obstacle are different, but one
of these is the same of one of the two positions corresponding to the reference
point of the robot, the new reference point is this position; I repeat the whole procedure for each
possible robot’s rotation angle
When
the program starts, push the button “Draw Obstacle” to draw an obstacle
and set with the left mouse button the vertices of the obstacles within the
white area (robot workspace W). To end the process,
click with the right mouse button somewhere. To draw the robot, push the
button “Draw Robot” and set with the left mouse button the vertices of the robot
within the white area. To end the process, click somewhere with the right mouse
button. A black point will be placed on the reference vertex of the robot. To set
the end configuration, push the button “End Configuration”, and set with the
left mouse button the point. Than insert the value of the final rotation alpha
in the text box “Angle”. To calculate the 3D-configuration space and the path, push
the button “Calculate Path”.
Part II: A* Algorithm In order to compute the path within the
configuration space, I have implemented the A* algorithm. The problem by a 3-D
grid search is the huge computational cost. In fact at each step we have 26
neighbors to take into account. Therefore I have based my implementation on a multiscale
pyramid of bitmap arrays. We define the following functions: ·
star(n):
represents the set of node which are adjacent to n; I have implemented a Matlab function star_x =
expand(x, i_max, j_max, k_m) that takes into account that the third
coordinate is defined over ·
c(n1,n2):
represents the length of the edge connecting n1 and n2;
I have implemented a Matlab function c = eval_c(x1, x2)
that takes into account that the third coordinate is defined over ·
g(n):
represents the total length of back pointer from n to qstart; ·
h(n):
represents the heuristic cost function which returns the estimated cost of
shortest path from n to qgoal; I have implemented two
Matlab functions. The first H = init_dist(q_goal, H_in, i_max, j_max,
k_max)
computates a wave front expantion of qgoal.
using the classic non-Euclidean distance of A*. However, since the
computational cost of the previous method is huge, I have used the Euclidean
distance d_euc(X, Y, k_max). Both functions take into
account that the third coordinate is defined over · f(n)=g(n)+h(n): is
the estimated cost of shortest path from qstart
to qgoal via n. The Algorithm is the follow: repeat Pop nbest
from O such f(nbest) ≤ f(n),
If nbest = qgoal EXIT Expand
nbest. For all x if x add x to O else if g(nbest) + c(nbest,x) < g(x) then update
x’s backpointer to point to nbest end if until O is empty The common sampling factor used for the coordinate and the angle is 10. I have also calculated the path in higher resolution levels, but the computation time was up to an hour. Therefore in the movies the path is not a smooth curve. However, it is easy to smooth the calculated path in a post processing operation. In order to register a movie of the path planning, there is a check box “Movie” that has to be checked before pushing the button “Calculate Path”. Finally, in order to get a 3D graph of the first configuration space obstacle, use the check box “3D Graph” I have implemented this algorithm because I'm
really interested on working with a three dimensional configuration space.
I think that this is closer to the real task of path planning. Homework files:
Here are to download all MATLAB files:
Astar.zip. Run with Matlab the file GUI.m.
|