00001
00002
00003 #ifndef _LIST_MAPS_POSE_MANAGER_HPP_
00004 #define _LIST_MAPS_POSE_MANAGER_HPP_
00005
00006 #include "slammm/MapsPoseManager.hpp"
00007
00008 namespace jafar {
00009 namespace slammm {
00013 class ListMapsPoseManager : public MapsPoseManager {
00014 public:
00015 ListMapsPoseManager( std::size_t maxStateSize );
00016 virtual ~ListMapsPoseManager();
00017 virtual void addFirstMapPose(unsigned int _mapId, unsigned int _robotId, const jblas::vec& _robotState, const jblas::mat& _robotStateCov );
00018 virtual void addMapPose(unsigned int _mapId, unsigned int _robotId, unsigned int _previousMapId, const jblas::vec& _robotState, const jblas::mat& _robotStateCov );
00019 virtual jafar::geom::T3DEuler getWorldToMapTransformation( unsigned int _mapId ) const;
00020 virtual jafar::geom::T3DEuler getMapToMapTransformation( unsigned int _firstMapId, unsigned int _secondMapId ) const;
00021 virtual void enforceLoopConstraint( unsigned int _firstMapId, unsigned int _secondMapId, const jblas::vec& _transformation, const jblas::sym_mat& _transformationCov );
00022 virtual bool canEnforceLoopConstraint( unsigned int _firstMapId, unsigned int _secondMapId ) const;
00023 virtual void writeLogHeader(kernel::DataLogger& log) const;
00024 virtual void writeLogData(kernel::DataLogger& log) const;
00025 void displayConnections() const;
00029 void exportToDot(char* _filename);
00030 private:
00036 void getToMapTransformation( jafar::geom::T3DEuler& transfo, unsigned int _mapId, unsigned int _secondMapId ) const;
00037 private:
00038 struct SCBInfo;
00039 struct ELCInfo;
00040 struct MapPoseInfo;
00041 struct MapPoseInfoEdge {
00042 MapPoseInfoEdge( const ublas::range& _range, jblas::vec& _state, jblas::sym_mat& _cov) : range(_range), state(_state, _range), cov(_cov, _range, _range) {}
00043 ~MapPoseInfoEdge() {
00044 }
00045 MapPoseInfo* previousMap;
00046 MapPoseInfo* nextMap;
00047 ublas::range range;
00048 jblas::vec_range state;
00049 jblas::sym_mat_range cov;
00050 void getTransfo( geom::T3DEuler& transfo, MapPoseInfo* info1, MapPoseInfo* info2);
00051 MapPoseInfo* theOtherOne( MapPoseInfo* );
00052 bool connectWith( MapPoseInfo* _map1, MapPoseInfo* _map2 );
00053 bool isCertainelyNull() const;
00054 };
00055 struct MapPoseInfo {
00056 unsigned int mapId;
00057 unsigned int robotId;
00058 std::list< MapPoseInfoEdge* > edges;
00059 };
00060 typedef std::list< std::pair<MapPoseInfo*, MapPoseInfoEdge*> > CycleType;
00061 MapPoseInfoEdge* createEdge(int robotStateSize);
00065 CycleType smallestCycleBetween( MapPoseInfo* _firstMap, MapPoseInfo* _secondMap ) const;
00069 bool mapAreConnected( MapPoseInfo* _map1, MapPoseInfo* _map2 ) const;
00070 std::list<MapPoseInfoEdge*> m_mapPoseEdgeInfos;
00071 std::map<unsigned int, MapPoseInfo* > m_mapPoseInfos;
00072 jblas::vec m_state;
00073 jblas::sym_mat m_cov;
00074 int m_nextFreeState;
00075 MapPoseInfo* globalFrameInfo;
00076 };
00077 }
00078 }
00079
00080 #endif