Java Reference
In-Depth Information
Class Controller represents the remote controller that interacts with the
robot system (see Figure 10.15). It implements the run() method of the
Runnable interface according to the Move 2 Sense 2 Update 2 Plan explor-
ation cycle. After each robot movement, the controller requests the laser to
acquire new distance measures, updates the internal representation of the
environment and plans the next move.
The controller communicates with the robot using the pipe mechanisms of
the Java language (see Sidebar 10.2). It supports asynchronous direct and
symmetric communication between two independent threads. Accordingly,
the implementation of method writeOut() of class Device needs to be modified.
We introduce class OccupancyMap to manage the internal representation
of the robot's environment. The controller requests the robot to scan the
environment and updates the map with the laser measurements. This class
can be easily extended to elaborate sensor measurements acquired from
sonar devices or other sensors and to support the exploration strategies of
the controller, giving indications about the unexplored areas.
Class OccupancyMap records the matrix of cells that correspond to square
areas of the environment. The width and height of each area are equal to 10
package moro;
import java.awt.*;
import javax.swing.*;
public class OccupancyMap extends JPanel {
int cellDim # 10; // the cell dimension in centimetre
int width # 510; // the map width (number of cells)
int height # 460; // the map height (number of cells)
Figure 10.15 The class diagram representing the interaction between the controller and the robot
Search WWH ::

Custom Search