00001 /*+-------------------------------------------------------------------------+ 00002 | MultiVehicle simulator (libmvsim) | 00003 | | 00004 | Copyright (C) 2014 Jose Luis Blanco Claraco (University of Almeria) | 00005 | Copyright (C) 2017 Borys Tymchenko (Odessa Polytechnic University) | 00006 | Distributed under GNU General Public License version 3 | 00007 | See <http://www.gnu.org/licenses/> | 00008 +-------------------------------------------------------------------------+ */ 00009 00010 #pragma once 00011 00012 #include <mvsim/WorldElements/WorldElementBase.h> 00013 #include <mrpt/opengl/CMesh.h> 00014 #include <mrpt/poses/CPose3D.h> 00015 00016 #include <mrpt/version.h> 00017 #if MRPT_VERSION>=0x199 00018 #include <mrpt/tfest/TMatchingPair.h> 00019 #include <mrpt/img/CImage.h> 00020 using mrpt::tfest::TMatchingPairList; 00021 using mrpt::tfest::TMatchingPair; 00022 using mrpt::img::CImage; 00023 #else 00024 #include <mrpt/utils/CImage.h> 00025 #include <mrpt/utils/TMatchingPair.h> 00026 using mrpt::utils::TMatchingPairList; 00027 using mrpt::utils::TMatchingPair; 00028 using mrpt::utils::CImage; 00029 #endif 00030 00031 00032 namespace mvsim 00033 { 00034 class ElevationMap : public WorldElementBase 00035 { 00036 DECLARES_REGISTER_WORLD_ELEMENT(ElevationMap) 00037 public: 00038 ElevationMap(World* parent, const rapidxml::xml_node<char>* root); 00039 virtual ~ElevationMap(); 00040 00041 virtual void loadConfigFrom( 00042 const rapidxml::xml_node<char>* root); 00043 virtual void gui_update( 00044 mrpt::opengl::COpenGLScene& scene); 00045 00046 virtual void simul_pre_timestep( 00047 const TSimulContext& context); 00048 virtual void simul_post_timestep( 00049 const TSimulContext& context); 00050 00051 bool getElevationAt( 00052 double x, double y, float& z) const; 00053 00054 protected: 00057 mrpt::opengl::CMesh::Ptr m_gl_mesh; 00058 bool m_first_scene_rendering; 00059 double m_resolution; 00060 mrpt::math::CMatrixFloat m_mesh_z_cache; 00061 00062 00063 00064 private: 00065 // temp vars (declared here to avoid reallocs): 00066 TMatchingPairList corrs; 00067 mrpt::poses::CPose3D m_optimal_transf; 00068 }; 00069 }