Previous Page TOC Index Next Page

BeeSoft User's Guide and Reference

3.3 BeeSoft In Action - A Simple Robot Scenario

Let’s say you have a cylindrical, mobile robot with a ring of sonar sensors around its perimeter, a collection of infrared sensors, and a number of tactile sensors that detect when anything bumps against the robot — in short, a B14 or a B21. Each sonar sensor can emit an ultrasonic wave, or ping. When a sonar detects a ping bouncing off an object in its environment, it tells the robot the distance, in millimeters, between the axis of the robot and the object .The infrared sensors and tactile sensors return similar information, based on their special perceptual characteristics and abilities.

In the following sections, you’ll explore a simple robot demonstration program called wander that lets your robot wander merrily around while avoiding running into obstacles within an 180-degree arc ahead of itself. A function within wander examines the current situation at any given instant, determining if anything is in the way, and modifying speed and bearing accordingly.

But to actively avoid obstacles within a particular distance, calling this function just once is clearly insufficient. New obstacles may come into range at any time. You might call the function periodically, to continuously scan the environment and take evasive action as appropriate. Or, you might decide to call the function only when the robot has received new readings from its sonar, infrared or tactile sensors. To implement either scheduling scenario, use the BeeSoft Scheduler.

With the help of the BeeSoft Scheduler, you can define a set of instructions to various components of the robot, and specify under what conditions each is to be invoked — on a schedule based on the elapsed time between invocations; upon a triggering event, such as a sonar reading; or on a simple timer. The BeeSoft Scheduler takes care of invoking the function at the specified times. The Scheduler won’t stop invoking the function, on schedule, until either a module explicitly asks the Scheduler to stop invoking the function, or when you interrupt the program, at which time each module may choose to call a cleanup function.

So far, so good — but you can imagine many, many such tasks that must all be invoked repeatedly. With the BeeSoft Scheduler directing traffic, though, your program can manage multiple asynchronous tasks invoked by multiple scheduler modules.

Previous Page Page Top TOC Index Next Page