00001 00064 #ifndef __GEOMETRY_MAP_H__ 00065 #define __GEOMETRY_MAP_H__ 00066 00067 // external includes 00068 00069 #include <Eigen/Core> 00070 #include <boost/shared_ptr.hpp> 00071 #include <boost/make_shared.hpp> 00072 #include <Eigen/Eigenvalues> 00073 #include <Eigen/Geometry> 00074 00075 //cob includes 00076 //#include "cob_3d_mapping_geometry_map/vis/geometry_map_visualisation.h" 00077 #include "cob_3d_mapping_common/polygon.h" 00078 #include "cob_3d_mapping_common/cylinder.h" 00079 00085 class GeometryMap 00086 { 00087 public: 00091 typedef std::vector<cob_3d_mapping::Polygon::Ptr>::iterator polygon_iterator; 00092 00096 typedef std::vector<cob_3d_mapping::Polygon::Ptr>::iterator cylinder_iterator; 00097 00101 GeometryMap () : 00102 new_id_ (0), frame_counter_ (0), file_path_ ("./"), save_to_file_ (false), cos_angle_ (0.97), d_ (0.01), last_tf_err_ ( 00103 Eigen::Affine3f::Identity ()) 00104 { 00105 } 00106 00110 ~GeometryMap () 00111 { 00112 } 00113 00122 void 00123 addMapEntry (cob_3d_mapping::Polygon::Ptr& p_ptr); 00124 00132 void 00133 addMapEntry (cob_3d_mapping::Cylinder::Ptr& c_ptr); 00134 00142 //void addMapEntry(cob_3d_mapping::ShapeCluster::Ptr& sc_ptr); 00152 //bool 00153 //computeTfError(const std::vector<cob_3d_mapping::Polygon::Ptr>& list_polygon, const Eigen::Affine3f& tf_old, Eigen::Affine3f& adjust_tf); 00154 00158 inline void 00159 incrFrame () 00160 { 00161 ++frame_counter_; 00162 } 00163 ; 00164 00171 void 00172 cleanUp (); 00173 00179 void 00180 saveMapEntry (std::string path, int ctr, cob_3d_mapping::Polygon& p); 00181 00187 void 00188 saveMap (std::string path); 00189 00193 void 00194 clearMap (); 00195 00199 float 00200 rounding (float x); 00201 00205 void 00206 colorizeMap (); 00207 00212 inline std::vector<cob_3d_mapping::Polygon::Ptr>* 00213 getMapPolygon () 00214 { 00215 return &(map_polygon_); 00216 } 00217 00222 inline std::vector<cob_3d_mapping::Polygon::Ptr>* 00223 getMapCylinder () 00224 { 00225 return &(map_cylinder_); 00226 } 00227 00232 //inline std::vector<cob_3d_mapping::ShapeCluster::Ptr>* getMap_shape_cluster() { return &(map_shape_cluster_); } 00233 00238 void 00239 setFilePath (std::string file_path) 00240 { 00241 file_path_ = file_path; 00242 } 00243 00248 void 00249 setSaveToFile (bool save_to_file) 00250 { 00251 save_to_file_ = save_to_file; 00252 } 00253 00259 void 00260 setMergeThresholds (double cos_angle, double d) 00261 { 00262 cos_angle_ = cos_angle; 00263 d_ = d; 00264 } 00265 00270 inline const Eigen::Affine3f& 00271 getLastError () 00272 { 00273 return last_tf_err_; 00274 } 00275 00276 protected: 00277 std::vector<cob_3d_mapping::Polygon::Ptr> map_polygon_; 00278 std::vector<cob_3d_mapping::Polygon::Ptr> map_cylinder_; 00279 //std::vector<cob_3d_mapping::ShapeCluster::Ptr> map_shape_cluster_; /**< Array containing all shape clusters. */ 00280 unsigned int new_id_; 00281 //int counter_output; 00282 int frame_counter_; 00283 std::string file_path_; 00284 bool save_to_file_; 00285 double cos_angle_; 00286 double d_; 00287 Eigen::Affine3f last_tf_err_; 00288 }; 00289 00290 #endif //__GEOMETRY_MAP_H__