Java Reference
In-Depth Information
Environment
Robot
loadMap()
paintComponent()
start()
paint()
Device
Position
Obstacle
x, y, t
addPoint()
paint()
rototrans()
parseXML()
parseAttribute()
Platform
Laser
Figure 10.10 The class diagram that depicts the relationships between the components of the
architecture
Decision point
How do we record the position of the robot and its components in the
environment?
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.
θ
Decision point
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
Search WWH ::




Custom Search