|
Homework
#3 Potential Function Part I: Star Algorithm I have implemented the Star Algorithm to compute
the 2-dimensional configuration space Q starting from the workspace
W and
the robot shape R. The obstacles QOi in the
configuration space are given by the following relationship:
If
we assume that the robot and the obstacles in the workspace are convex
polygons, the Star Algorithm computes the obstacles in the workspace using the
normal vectors of each side of the polygons. I have implemented a Matlab function
norm
= c_norm(tang, dir) that returns the normal vector for each side
of a polygon. If the parameter dir is 1, then the direction of
the normal vector is inside the convex shape (for the robot). If dir is -1,
then the direction of the normal vector is outside (for the obstacles). In
order to understand where is the inside area or the outside area of a convex
polygon is, we just need to build the cross product between two adjacent sides.
If the z-component of the product is positive, the inside direction is the
direction given by the sides rotated by + 90°. If the z-component of the
product is negative, the inside direction is the direction given by the sides
rotated by - 90°. The
algorithm sorts the sides of the robot and of one obstacle by increasing the angle
of the 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, I define
the vertex with the higher x-value as reference point on the robot and the
vertex with the lower x-value as reference point on the obstacle. Since the
robot’s reference point can touch the obstacle reference point by a given
robot’s configuration q, the corresponding vertex
of the obstacle in the configuration space must be at the position q. I
have implemented a Matlab function [X, Y, num] = q_obstacle(robot_X,
robot_Y, robot_num, robot_n, obstacle_X, obstacle_Y, obstacle_num, obstacle_n) that
transforms an obstacle of the workspace in the correspondent obstacle in the
configuration space. The parameter ending with _num is
the number of vertices of the polygon and the parameter ending with _n is
the set of the normal vectors to the polygon sides. If the moving robot and the obstacle in the
workspace are two convex polygons M and P, we
can also say that the corresponding obstacle in the configuration space is
given by the Minkowski difference between the obstacle in the workspace and the
robot:
When
the program starts, you can 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 you can
click with the right mouse button somewhere. To draw the robot you can 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
compute the configuration space with the Star Algorithm you can push now the
button “Compute Q”. The obstacles QOi in
the configuration space are drawn in yellow. To set the end configuration, push the button
“End Configuration”, and set with the left mouse button the point within the remaining
white area (configuration space Q). To calculate the path you
can push the button “Calculate Path”.
Part II: Potential function In order to compute the path within the
configuration space, I have implemented an algorithm based on potential fields.
We define a potential field as the sum of an “attractive” potential
The attractive potential and its gradient are
defined as function of the actual configuration
This
definition is very useful because when the robot is near the goal the velocity
decreases linearly (quadratic potential). However, when it is far from the goal
( The repulsive potential and its gradient are
defined as a function of the distance
An issue of this definition is that if the
distance
Obviously,
infinity does not exist in real computers and therefore I have used a high
number. The name of this parameter is R_inf. The name of the
parameter, which defines the saturation radius is R,
and it corresponds to the parameter When the algorithm is running, the configuration
point on the robot starts moving to the goal configuration
In order to understand whether the algorithm has
arrived to a local minimum we define a numerical threshold
If
the actual configuration I
notice that the definition of the parameter 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
potential function over the whole configuration space Q,
you can use the check box “3D Graph” (this option could require several
minutes).
I have implemented this algorithm because although it has some problems with local minima it seems to be very useful for real purposes. In fact, the particular behavior that controls the velocity of the movement with respect to the distance from the goal might be very useful for a real implementation. Homework files:
Here are to download all MATLAB files:
GUI.fig,
GUI.m,
potential.m,
c_norm.m, and
q_obstacle.m. Also the old files are to download
(at least sensor.m):
tangent.m,
sensor.m,
int_cont.m, and
d_check.m.
|