Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
parentalLinks.doxy
00001 
00107   for (sensors_ptr_set_t::iterator senIter = sensorsPtrSet.begin(); senIter != sensorsPtrSet.end(); senIter++) { // loop sensors
00108     sensor_ptr_t senPtr = senIter->second;
00109     cout << "exploring sensor: " << senPtr->id() << endl;
00110     senPtr->doSomething();
00111   }
00112   \endcode
00113   
00114   \subsection secUpwards Traversing upwards: links CHILD -> PARENT.
00115     
00116   Traversing upwards is a bit more tricky because \c weak_ptr needs to lock the operation of \c shared_ptr before accessing the object.
00117   We encapsulated the necessary code into a convenient function with the name of the pointer, 
00118   such that the only difference you see is the aparition of a couple of empty brackets. For example:
00119   \code
00120   senPtr->robotPtr()->state.x()
00121   \endcode
00122   is the state of the robot owning a particular sensor, accessed from that sensor.
00123   
00124   \subsection secDownCasting Downcasting to access derived class parameters. Links DERIVED_OBS -> DERIVED_PARENT.
00125   
00126   The observation class needs to access information in Sensor and Landmark that only exist in the derived versions. 
00127   For example, observing an AHP point from a Pin-hole camera requires knowledge about the sensor's intrinsic parameters. 
00128   But these parameters do not exist at the Abstract level.
00129   
00130   We add a couple of pointers to each derived observation class, especially dedicated to each particular parent. 
00131   These pointers are a downcast of the ones at the abstract level.
00132   
00133   The downcast is done at construction time of the object \c ObservationPinHoleAnchoredHomogeneousPoint, with something like this:
00134   \code
00135   // Some type definitions
00136   typedef weak_ptr<SensorPinHole> pinhole_ptr_t;
00137   typedef weak_ptr<LandmarkAnchoredHomogeneousPoint> ahp_ptr_t;
00138   // Members of the derived observation class 
00139   pinhole_ptr_t pinholePtr;
00140   ahp_ptr_t ahpPtr;
00141   // At construction time of the derived observation object 
00142   pinholePtr = dynamic_pointer_cast<SensorPinHole> (sensorPtr);
00143   ahpPtr = dynamic_pointer_cast<LandmarkAnchoredHomogeneousPoint> (landmarkPtr);
00144   \endcode
00145   
00146   With this downcast, we can now access the parameters of the sensor. For example, this ficticious function:
00147   \code
00148   vec3 p = ahpPtr->convertToEuclidean();
00149   vec2 u = ObsAHP.project(pinholePtr->intrinsic, p);
00150   \endcode
00151   converts the AHP into an Euclidean point, and projects it into the pin-hole sensor. 
00152   
00153   
00154   
00155   */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:26 for Jafar by doxygen 1.7.6.1
LAAS-CNRS