Main Page
Namespaces
Classes
Files
File List
File Members
libmvsim
include
mvsim
WorldElements
OccupancyGridMap.h
Go to the documentation of this file.
1
/*+-------------------------------------------------------------------------+
2
| MultiVehicle simulator (libmvsim) |
3
| |
4
| Copyright (C) 2014 Jose Luis Blanco Claraco (University of Almeria) |
5
| Copyright (C) 2017 Borys Tymchenko (Odessa Polytechnic University) |
6
| Distributed under GNU General Public License version 3 |
7
| See <http://www.gnu.org/licenses/> |
8
+-------------------------------------------------------------------------+ */
9
10
#pragma once
11
12
#include <mutex>
13
#include <
mvsim/WorldElements/WorldElementBase.h
>
14
#include <mrpt/opengl/CSetOfObjects.h>
15
#include <mrpt/opengl/CPointCloud.h>
16
#include <mrpt/poses/CPose2D.h>
17
18
#include <mrpt/version.h>
19
#if MRPT_VERSION >= 0x130
20
#include <mrpt/maps/COccupancyGridMap2D.h>
21
#include <mrpt/obs/CSinCosLookUpTableFor2DScans.h>
22
#include <mrpt/obs/CObservation2DRangeScan.h>
23
using namespace
mrpt::obs;
24
using namespace
mrpt::maps;
25
#else
26
#include <mrpt/slam/COccupancyGridMap2D.h>
27
#include <mrpt/slam/CSinCosLookUpTableFor2DScans.h>
28
#include <mrpt/slam/CObservation2DRangeScan.h>
29
using namespace
mrpt::slam
;
30
#endif
31
32
namespace
mvsim
33
{
34
class
OccupancyGridMap
:
public
WorldElementBase
35
{
36
DECLARES_REGISTER_WORLD_ELEMENT
(
OccupancyGridMap
)
37
public
:
38
OccupancyGridMap
(
World
* parent,
const
rapidxml::xml_node<char>
* root);
39
virtual
~
OccupancyGridMap
();
40
41
virtual
void
loadConfigFrom(
42
const
rapidxml::xml_node<char>
* root);
43
virtual
void
gui_update(
44
mrpt::opengl::COpenGLScene& scene);
45
46
virtual
void
simul_pre_timestep(
47
const
TSimulContext
& context);
48
49
const
COccupancyGridMap2D&
getOccGrid
()
const
{
return
m_grid; }
50
COccupancyGridMap2D&
getOccGrid
() {
return
m_grid; }
51
protected
:
52
COccupancyGridMap2D
m_grid
;
53
54
bool
m_gui_uptodate
;
55
mrpt::opengl::CSetOfObjects::Ptr m_gl_grid;
57
58
struct
TFixturePtr
59
{
60
b2Fixture
*
fixture
;
61
TFixturePtr
() : fixture(NULL) {}
62
};
63
64
struct
TInfoPerCollidableobj
65
{
66
float
max_obstacles_ranges
;
67
mrpt::poses::CPose2D
pose
;
68
CObservation2DRangeScan::Ptr
scan
;
69
b2Body
*
collide_body
;
70
std::vector<TFixturePtr>
collide_fixtures
;
71
72
TInfoPerCollidableobj
() : max_obstacles_ranges(0), collide_body(NULL) {}
73
};
74
75
std::vector<TInfoPerCollidableobj>
m_obstacles_for_each_obj
;
76
std::vector<mrpt::opengl::CSetOfObjects::Ptr>
m_gl_obs_clouds
;
77
78
std::mutex
m_gl_obs_clouds_buffer_cs
;
79
std::vector<mrpt::opengl::CPointCloud::Ptr>
m_gl_obs_clouds_buffer
;
80
81
CSinCosLookUpTableFor2DScans
m_sincos_lut
;
82
83
bool
m_show_grid_collision_points
;
84
double
m_restitution
;
85
double
m_lateral_friction
;
86
};
87
}
mvsim::OccupancyGridMap::m_gl_obs_clouds
std::vector< mrpt::opengl::CSetOfObjects::Ptr > m_gl_obs_clouds
Definition:
OccupancyGridMap.h:76
mvsim
Definition:
basic_types.h:47
mvsim::OccupancyGridMap::TInfoPerCollidableobj::max_obstacles_ranges
float max_obstacles_ranges
Definition:
OccupancyGridMap.h:66
mvsim::OccupancyGridMap::m_show_grid_collision_points
bool m_show_grid_collision_points
Definition:
OccupancyGridMap.h:83
mvsim::World
Definition:
World.h:67
mvsim::TSimulContext
Definition:
basic_types.h:53
mrpt::slam
Definition:
basic_types.h:41
mvsim::OccupancyGridMap::TInfoPerCollidableobj::collide_fixtures
std::vector< TFixturePtr > collide_fixtures
Definition:
OccupancyGridMap.h:70
b2Fixture
Definition:
b2Fixture.h:107
mvsim::OccupancyGridMap::TFixturePtr::fixture
b2Fixture * fixture
Definition:
OccupancyGridMap.h:60
b2Body
A rigid body. These are created via b2World::CreateBody.
Definition:
b2Body.h:126
mvsim::OccupancyGridMap::m_sincos_lut
CSinCosLookUpTableFor2DScans m_sincos_lut
Definition:
OccupancyGridMap.h:81
mvsim::OccupancyGridMap::m_restitution
double m_restitution
Elastic restitution coef (default: 0.01)
Definition:
OccupancyGridMap.h:84
mvsim::OccupancyGridMap::m_gui_uptodate
bool m_gui_uptodate
Definition:
OccupancyGridMap.h:54
mvsim::OccupancyGridMap::TInfoPerCollidableobj::collide_body
b2Body * collide_body
Definition:
OccupancyGridMap.h:69
DECLARES_REGISTER_WORLD_ELEMENT
#define DECLARES_REGISTER_WORLD_ELEMENT(CLASS_NAME)
Definition:
WorldElementBase.h:42
mvsim::OccupancyGridMap::m_grid
COccupancyGridMap2D m_grid
Definition:
OccupancyGridMap.h:52
mvsim::WorldElementBase
Definition:
WorldElementBase.h:18
WorldElementBase.h
mvsim::OccupancyGridMap::TInfoPerCollidableobj::TInfoPerCollidableobj
TInfoPerCollidableobj()
Definition:
OccupancyGridMap.h:72
mvsim::OccupancyGridMap::getOccGrid
const COccupancyGridMap2D & getOccGrid() const
Definition:
OccupancyGridMap.h:49
mvsim::OccupancyGridMap::TInfoPerCollidableobj
Definition:
OccupancyGridMap.h:64
mvsim::OccupancyGridMap::getOccGrid
COccupancyGridMap2D & getOccGrid()
Definition:
OccupancyGridMap.h:50
mvsim::OccupancyGridMap::m_gl_obs_clouds_buffer
std::vector< mrpt::opengl::CPointCloud::Ptr > m_gl_obs_clouds_buffer
Definition:
OccupancyGridMap.h:79
mvsim::OccupancyGridMap::TFixturePtr::TFixturePtr
TFixturePtr()
Definition:
OccupancyGridMap.h:61
mvsim::OccupancyGridMap
Definition:
OccupancyGridMap.h:34
mvsim::OccupancyGridMap::m_lateral_friction
double m_lateral_friction
(Default: 0.5)
Definition:
OccupancyGridMap.h:85
mvsim::OccupancyGridMap::m_obstacles_for_each_obj
std::vector< TInfoPerCollidableobj > m_obstacles_for_each_obj
Definition:
OccupancyGridMap.h:75
rapidxml::xml_node
Definition:
rapidxml.hpp:137
mvsim::OccupancyGridMap::TInfoPerCollidableobj::pose
mrpt::poses::CPose2D pose
Definition:
OccupancyGridMap.h:67
mvsim::OccupancyGridMap::TFixturePtr
Definition:
OccupancyGridMap.h:58
mvsim::OccupancyGridMap::m_gl_obs_clouds_buffer_cs
std::mutex m_gl_obs_clouds_buffer_cs
Definition:
OccupancyGridMap.h:78
mvsim::OccupancyGridMap::TInfoPerCollidableobj::scan
CObservation2DRangeScan::Ptr scan
Definition:
OccupancyGridMap.h:68
mvsim
Author(s):
autogenerated on Thu Jun 6 2019 19:36:40