Documentation / v1.0 / Core / Map
From emss Framework - iRobot Create C++ Framework
You are here: Documentation / v1.0 / Core / Map
Contents |
[edit] Map
Files: |
Map/Map.h Licensed under GPLv3
|
Maps hold information about the environment. In the emss framework there exist several types of maps, each serving a different purpose. emss Maps must define the abstract class Map, however they enjoy a significant amount of freedom. The only virtual Map method is paint(view,scale), which is used by the Viewports for displaying the map to the user. In addition, any map must provide a width and a height. If a Map does not know its own dimensions, it can consult the emss Core for the basic world boundaries. A certain set of functionality shared by both the Heat Map and Terrain Map have been combined into the Color Map. Self-explanatory Maps, such as the Grid Map and Object Map, will not be discussed in further details.
As discussed in the introduction of Chapter 0, Maps is an example where the data tier and presentation tier have been merged into a single concept. We chose to do this as the presentation, i.e. the visual image of the Map, is typically identical to the data. Of course, the Map paint(view,scale) method could be refactored to a presentation “wrapper” class in a separate package, however we see no benefit of such a bloated design.
[edit] Heat Map
Files: |
Map/HeatMap.h Licensed under GPLv3
|
A Heat Map is built to visualize the discovered environment of the robot. When the robot moves through its environment, the Movement Tracker is responsible for translating the sensory data into physical movements through space. In turn, the Movement Tracker sends signals to the appropriate Maps, such as the Heat Map, registering various kinds of “heat”. The emss Heat Map support two kinds of heat: Open Area and Collision Area. Open Area is displayed as green, and portrays the robots path through the environment, while Collision Area is displayed as red, and represents any sort of collision or obstacle, forming the environments boundary. The Heat Map can be consulted by different emss components in order to make decisions, such as navigational choices. In addition, other influences, such as a user, can also “color” the Heat Map for diagnostic reasons such as staking out a territory.
// Robot collided at x,y heatMap->registerHeat(ColorMap::CollisionAreaChannel, x, y, heatSpotOpacity, heatSpotSize); Code 4-16: Example for Registering a Collision on the Heat Map // Look ahead if it is good to move using a sweep across a start and end angle... double heat = 0.0; int sweepAngle = 30; double lookAheadRange = 300; // 30cm for(int angle = -sweepAngle/2; angle <= sweepAngle/2; angle++) { Trafo2D checkpoint = core->movementTracker->transformation * Trafo2D::rot(-Rad(angle)) * Trafo2D::trans(0, lookAheadRange); heat += core->heatMap->getChannelValue(HeatMap::CollisionAreaChannel, checkpoint.trans().x(), checkpoint.trans().y()); } if(heat == 0.0) { // Safe to move... }
[edit] Terrain Map
Files: |
Map/TerrainMap.h Licensed under GPLv3
|
Currently, the Terrain Map is only used for displaying the results of the algorithm described in Section 3.7. However, the data structure is now ready to be used by future algorithms. The class provides three main functions: raise(x,y), lower(x,y), and getHeight(). The higher an area of the map is, the brighter white it is colored. The raise(x,y) and lower(x,y) methods are overloaded to allow entire sections of a map to be altered at once.
[edit] Physical Map
Files: |
Map/PhysicalMap.h Licensed under GPLv3
|
The emss Physical map represents the real world environment in its physical state. This Map is currently used for simulation purposes, but in the future can also be used for various Tasks which would like to combine a predefined perception of the environment. The Physical Map offers the method getAreaType(x,y) which returns either Open Area or Collision Area – just like the Heat Map. The Emulated Emss Controller uses this Map to emulate the IR Range Finder during simulations, something which has proven especially useful as the robots environment can now be almost entirely emulated. To define the areas of a physical map, all one has to do is draw a RGBA image, such as a 24-bit PNG, and let the Physical Map load the file. Any area in the image which has the alpha channel not at 255 (full) is regarded as Open Area.