Page 290 - Introduction to Autonomous Mobile Robots
P. 290
275
Planning and Navigation
In the ideal case, when encountering an obstacle one would choose between left wall fol-
lowing and right wall following depending on which direction is more promising. In this
simple example we have only right wall following, a simplification for didactic purposes
that ought not find its way into a real mobile robot program.
Now we consider specifying each remaining function in detail. Consider for our pur-
poses a robot with a ring of sonars placed radially around the robot. This imagined robot
will be differential-drive, so that the sonar ring has a clear “front” (aligned with the forward
direction of the robot). Furthermore, the robot accepts motion commands of the form
shown above, with a rotational velocity parameter and a translational velocity parameter.
Mapping these two parameters to individual wheel speeds for each of the two differential
drive chassis’ drive wheels is a simple matter.
There is one condition we must define in terms of the robot’s sonar readings, Obsta-
clesInWay(). We define this function to be true whenever any sonar range reading in
the direction of the goal (within 45 degrees of the goal direction) is short:
private boolean ObstaclesInWay(angle goalAngle, sensorvals sonars) {
int minSonarValue;
minSonarValue=MinRange(sonars, goalAngle
-(pi/4),goalAngle+(pi/4));
return (minSonarValue < 200);
} // end ObstaclesInWay() //
Note that the function ComputeTranslation() computes translational speed
whether the robot is wall-following or heading toward the goal. In this simplified example,
we define translation speed as being proportional to the largest range readings in the robot’s
approximate forward direction:
private int ComputeTranslation(sensorvals sonars) {
int minSonarFront;
minSonarFront = MinRange(sonars, -pi/4.0, pi/4.0);
if (minSonarFront < 200) return 0;
else return (Math.min(500, minSonarFront - 200));
} // end ComputeTranslation() //
There is a marked similarity between this approach and the potential field approach
described in section 6.2.1.3. Indeed, some mobile robots implement obstacle avoidance by
treating the current range readings of the robot as force vectors, simply carrying out vector
addition to determine the direction of travel and speed. Alternatively, many will consider
short-range readings to be repulsive forces, again engaging in vector addition to determine
an overall motion command for the robot.