x, y, t
Figure 10.10 The class diagram that depicts the relationships between the components of the
How do we record the position of the robot and its components in the
We introduce class Position that encapsulates the Cartesian coordinates
( x and y ) of the origin of a reference frame and the direction (
) of this
reference frame with regard to a global reference frame. Class Position offers
the rototrans() method that implements the mathematical relations to rotate
and translate the reference frame. Both the robot and its components
encapsulate an instance of this class.
How do we implement the robot - environment interaction?
Class Environment is designed as a collection of Obstacle objects and has a
reference to an instance of class Robot . When the environment description
is loaded from the XML file, class Environment passes to the Robot object a
reference to the obstacles list. Similarly, the robot passes this reference to its