So, what is it about?
This applet runs a probalistic motion planner which caracteristics
are the following:
- the robot is a circular robot moving in
a 2-D rectangle (the soccer field) which is here 600x400. Thus we just
consider the translation of the robot as degree of freedom. It moves at
a constant speed (which is now set at 40 pixels a second). The only physical
constraint which applies to the robot is that its CENTER cannot go off
the limits of the field. You can set the radius of the robot, and its start
and goal positions.
- the obstacles are moving circular obstacles.
You can set their radius, their initial position, and their horizontal
and vertical speeds. They are not physically contrained to stay in the
field (ie: they do not bounce on the walls, they just leave the field when
they reach their outer limits).
How does the motion planner works?
We first decompose the field in rectangular cells (here typically, the
cells are 40x40) and expand from the start node. Then the algorithm works
as follows:
- pick, in the list of non-empty cells (of which
we keep track), a random cell (so at the beginning, there is only one non-empty
cell: the start cell!)
- pick, in this cell, a random node (at the beginning,
we pick the start node)
- expand from this node, ie: choose a random cell
among the nine cells which surround the choosen node's cell (actually 8
cells plus this latter one), choose a random location in this cell, check
whether there is a free path between these two nodes, if yes, check whether
there is a direct path to the goal. And iterate for a certain number of
nodes. Once you have expanded from this "initial" choosen node, you choose
another random cell and restart the process of expansion.
The algorithm stops when it finds a path from a node to the goal or
when it fails.
The parameters for the expansion are:
- the number of nodes you recreate from one node (I
use 5 of them): so, when you expand from a choosen node, you recreate 5
nodes which can be reached from this "parent" node. So, if you recreate
a node whcih cannot be reached from the "parent" node, you just discard
it and ramdomly choose another node around.
- the maximum number of nodes a cell can contain
(here set to 150), which limits the concentration of the nodes in one area.
So, when a cell is full, we just discard it.
When does it fail?
We keep track of the number of consecutive failures and when this number
reaches a certain limit, we consider the planner has failed. A failure
is when the planner cannot find a path between a node and its parent (see
above the expansion process..). So, the planner fails when it cannot find
a location to put a node, which corresponds to a stuck robot (actually,
the planner can fail even if there is a path!).
How does the collision detection work?
This is where time and geometry take part. So, let's say we have a parent
node (which can be the start node) and a child node (which can also be
the goal node). We have their positions and the speed of the robot. So,
we know thw distance between the 2 nodes, and we can discretize the path
(which is a straight line in 2D!). Then, at each discretized point on the
path, we check there is no collision between the robot and any movable
obstacles which is pretty straightforward since we can easily update all
the positions (the relationship between time and distance is easy here
since the speed is a constant on a straight line!!!).
Here it is, I think I said pretty much everything that was needed. If
you need anymore comment or clarification, you can contact me at the following
address: jroux@cs.stanford.edu