OccupancyGridMap.h
Go to the documentation of this file.
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 <mutex>
00013 #include <mvsim/WorldElements/WorldElementBase.h>
00014 #include <mrpt/opengl/CSetOfObjects.h>
00015 #include <mrpt/opengl/CPointCloud.h>
00016 #include <mrpt/poses/CPose2D.h>
00017 
00018 #include <mrpt/version.h>
00019 #if MRPT_VERSION >= 0x130
00020 #include <mrpt/maps/COccupancyGridMap2D.h>
00021 #include <mrpt/obs/CSinCosLookUpTableFor2DScans.h>
00022 #include <mrpt/obs/CObservation2DRangeScan.h>
00023 using namespace mrpt::obs;
00024 using namespace mrpt::maps;
00025 #else
00026 #include <mrpt/slam/COccupancyGridMap2D.h>
00027 #include <mrpt/slam/CSinCosLookUpTableFor2DScans.h>
00028 #include <mrpt/slam/CObservation2DRangeScan.h>
00029 using namespace mrpt::slam;
00030 #endif
00031 
00032 namespace mvsim
00033 {
00034 class OccupancyGridMap : public WorldElementBase
00035 {
00036         DECLARES_REGISTER_WORLD_ELEMENT(OccupancyGridMap)
00037    public:
00038         OccupancyGridMap(World* parent, const rapidxml::xml_node<char>* root);
00039         virtual ~OccupancyGridMap();
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 
00049         const COccupancyGridMap2D& getOccGrid() const { return m_grid; }
00050         COccupancyGridMap2D& getOccGrid() { return m_grid; }
00051    protected:
00052         COccupancyGridMap2D m_grid;
00053 
00054         bool m_gui_uptodate;  
00055 
00056         mrpt::opengl::CSetOfObjects::Ptr m_gl_grid;
00057 
00058         struct TFixturePtr
00059         {
00060                 b2Fixture* fixture;
00061                 TFixturePtr() : fixture(NULL) {}
00062         };
00063 
00064         struct TInfoPerCollidableobj
00065         {
00066                 float max_obstacles_ranges;
00067                 mrpt::poses::CPose2D pose;
00068                 CObservation2DRangeScan::Ptr scan;
00069                 b2Body* collide_body;
00070                 std::vector<TFixturePtr> collide_fixtures;
00071 
00072                 TInfoPerCollidableobj() : max_obstacles_ranges(0), collide_body(NULL) {}
00073         };
00074 
00075         std::vector<TInfoPerCollidableobj> m_obstacles_for_each_obj;
00076         std::vector<mrpt::opengl::CSetOfObjects::Ptr> m_gl_obs_clouds;
00077 
00078         std::mutex m_gl_obs_clouds_buffer_cs;
00079         std::vector<mrpt::opengl::CPointCloud::Ptr> m_gl_obs_clouds_buffer;
00080 
00081         CSinCosLookUpTableFor2DScans m_sincos_lut;
00082 
00083         bool m_show_grid_collision_points;
00084         double m_restitution;  
00085         double m_lateral_friction;  
00086 };
00087 }


mvsim
Author(s):
autogenerated on Thu Jun 6 2019 22:08:35