Homepage Demos Overview Downloads Tutorials Reference
Credits
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Search

almMain.h

Go to the documentation of this file.
00001 /*
00002  * almMain.h -- defines the main class for interfacing with the AIBO
00003  *   Local Map.
00004  *
00005  * Started 12-12-2002, tss
00006  */
00007 
00008 #ifndef _ALM_MAIN_H_
00009 #define _ALM_MAIN_H_
00010 
00011 #include "almStructures.h"
00012 #include "../WorldModel2.h"
00013 // needed for afsPose structure.
00014 #include "../FastSLAM/afsParticle.h"
00015 
00016 // This class contains method declarations for interfacint with the AIBO
00017 // Local Map. Don't tell anyone that this C++ code is really C in disguise.
00018 // I know it sounds disgusting, but there's really no need for individual
00019 // objects in this code. Besides, we can restrict enumerations and whatnot
00020 // to the class namespace. Oh, leave me alone.
00021 class ALM
00022 {
00023 // WorldModel2 has access to us to gather motion requests
00024 friend class WorldModel2;
00025 
00026 public:
00027   // This method initializes the static tables used to hold the map data.
00028   // Yes, you have to manually run an initializer. I apologize!
00029   static void init(void);
00030 
00031   // This method applies motion to the maps, updating them so that they
00032   // remain egocentric and so that uncertain regions are duly noted.
00033   // The parameters are the same as those applied to the motion commands.
00034   static void move(double dx, double dy, double da, unsigned int time);
00035 
00036   // This method registers a depth measurement in the local maps
00037   static void registerDepth(double depth, double tilt, double pan);
00038   // This method does the same, but it allows the user to specify kludges
00039   // that can give "better" performance in certain limited environments.
00040   // See the WM2Kludge namespace definition in WorldModel2.h for details.
00041   static void registerDepth(double depth, double tilt, double pan,
00042           unsigned int kludges);
00043 
00044   // This method uses the ground plane assumption to fill the local maps
00045   // with information about the location of the ground based on the location
00046   // of the head and the image coming from the camera. Head and image
00047   // information are obtained from WorldState, etc.
00048   static void registerGround();
00049 
00050   // This method copies the information from the HM onto the global map
00051   // (or, more poetically, turns the HM into a rubber stamp).
00052   // You need to furnish it with the current pose information, which you
00053   // get from FastSLAM
00054   static void stampHM(afsPose &pose);
00055 
00056   // Dump depth map data selected by a dmPicker you implement (or just
00057   // instantiate) into the supplied iostream. Uses ASCII .mat file
00058   // "format", seperating row elements with tabs and rows with newlines.
00059   static void dumpDM(dmPicker &p, std::ostream &out);
00060 
00061   // Dump height map data selected by a hmPicker you implement (or just
00062   // instantiate) into the supplied iostream. Uses ASCII .mat file
00063   // "format", seperating row elements with tabs and rows with newlines.
00064   static void dumpHM(hmPicker &p, std::ostream &out);
00065 
00066   // What this thing does with all this information remains to be seen...
00067 
00068 private:
00069 
00070   // This method clears the current map to simulate an empty room: the ground
00071   // will appear in the proper place in the spherical map with the rest empty;
00072   // the height map will be zeroed everywhere. Actually, in addition to other
00073   // administrativa, init just calls this function.
00074   static void nukeAndPaveCurrentMap(void);
00075 
00076 #ifdef UNIT_TEST_ALM_MA
00077 public:
00078 #endif
00079 
00080   // This method generates motion requests for WorldModel2. It's the reason
00081   // WorldModel2 is our friend.
00082   static void genRequests(MRvector &requests);
00083 
00084   // These methods provide direct access to the local map data arrays. You
00085   // should use DM_CELL_COUNT and HM_CELL_COUNT to index these arrays.
00086   // These methods are PRIVATE and are intended only for use by WorldModel2
00087   // objects.
00088   // Whenever you want to access the DM or the HM arrays, you should always
00089   // call these routines before doing your manipulation. This is because 
00090   // double buffering is used here, and you may find yourself pointing at
00091   // an old buffer if you don't update your pointers.
00092   static dm_cell *getDM();
00093   static hm_cell *getHM();
00094 };
00095 
00096 #endif

Tekkotsu v1.4
Generated Sat Jul 19 00:06:29 2003 by Doxygen 1.3.2