Main Page
Namespaces
Classes
Files
File List
File Members
src
plugin_aggregators
world_model.cpp
Go to the documentation of this file.
1
#include <
vigir_footstep_planning_plugins/plugin_aggregators/world_model.h
>
2
3
namespace
vigir_footstep_planning
4
{
5
WorldModel::WorldModel
()
6
:
ExtendedPluginAggregator
<
WorldModel
,
CollisionCheckPlugin
>(
"WorldModel"
)
7
{
8
}
9
10
void
WorldModel::loadPlugins
()
11
{
12
ExtendedPluginAggregator<WorldModel, CollisionCheckPlugin>::loadPlugins
();
13
14
// get terrain model
15
vigir_pluginlib::PluginManager::getPlugin(
terrain_model_
);
16
if
(
terrain_model_
)
17
{
18
ROS_INFO
(
"[WorldModel] Found terrain model:"
);
19
ROS_INFO
(
" %s (%s)"
,
terrain_model_
->getName().c_str(),
terrain_model_
->getTypeClass().c_str());
20
}
21
}
22
23
bool
WorldModel::loadParams
(
const
vigir_generic_params::ParameterSet& params)
24
{
25
bool
result =
ExtendedPluginAggregator<WorldModel, CollisionCheckPlugin>::loadParams
(params);
26
27
if
(
terrain_model_
)
28
result &=
terrain_model_
->loadParams(params);
29
30
return
result;
31
}
32
33
void
WorldModel::resetPlugins
()
34
{
35
ExtendedPluginAggregator<WorldModel, CollisionCheckPlugin>::resetPlugins
();
36
37
if
(
terrain_model_
)
38
terrain_model_
->reset();
39
}
40
41
bool
WorldModel::isAccessible
(
const
State
& s)
const
42
{
43
for
(
CollisionCheckPlugin::Ptr
plugin :
getPlugins
())
44
{
45
if
(plugin && plugin->isCollisionCheckAvailable() && !plugin->isAccessible(s))
46
return
false
;
47
}
48
return
true
;
49
}
50
51
bool
WorldModel::isAccessible
(
const
State
& next,
const
State
& current)
const
52
{
53
for
(
CollisionCheckPlugin::Ptr
plugin :
getPlugins
())
54
{
55
if
(plugin && plugin->isCollisionCheckAvailable() && !plugin->isAccessible(next, current))
56
return
false
;
57
}
58
return
true
;
59
}
60
61
void
WorldModel::useTerrainModel
(
bool
enabled)
62
{
63
use_terrain_model_
= enabled;
64
}
65
66
bool
WorldModel::isTerrainModelAvailable
()
const
67
{
68
return
terrain_model_
&&
terrain_model_
->isTerrainModelAvailable();
69
}
70
71
TerrainModelPlugin::ConstPtr
WorldModel::getTerrainModel
()
const
72
{
73
return
terrain_model_
;
74
}
75
76
bool
WorldModel::getHeight
(
double
x,
double
y,
double
& height)
const
77
{
78
if
(!
use_terrain_model_
|| !
isTerrainModelAvailable
())
79
return
true
;
80
81
return
terrain_model_
->getHeight(x, y, height);
82
}
83
84
bool
WorldModel::update3DData
(
State
& s)
const
85
{
86
if
(!
use_terrain_model_
|| !
isTerrainModelAvailable
())
87
return
true
;
88
89
return
terrain_model_
->update3DData(s);
90
}
91
}
vigir_footstep_planning::WorldModel::useTerrainModel
void useTerrainModel(bool enabled)
Definition:
world_model.cpp:61
vigir_footstep_planning::WorldModel::getTerrainModel
TerrainModelPlugin::ConstPtr getTerrainModel() const
Definition:
world_model.cpp:71
vigir_footstep_planning::WorldModel::getHeight
bool getHeight(double x, double y, double &height) const
update z, roll and pitch of state based on terrain model
Definition:
world_model.cpp:76
vigir_footstep_planning::WorldModel::loadParams
bool loadParams(const vigir_generic_params::ParameterSet ¶ms) override
Definition:
world_model.cpp:23
vigir_footstep_planning::WorldModel::use_terrain_model_
bool use_terrain_model_
Definition:
world_model.h:70
vigir_footstep_planning::WorldModel::terrain_model_
TerrainModelPlugin::Ptr terrain_model_
Definition:
world_model.h:71
boost::shared_ptr
vigir_footstep_planning::State
vigir_footstep_planning::ExtendedPluginAggregator::resetPlugins
virtual void resetPlugins()
Definition:
extended_plugin_aggregator.h:55
ROS_INFO
#define ROS_INFO(...)
vigir_footstep_planning
vigir_footstep_planning::WorldModel::isTerrainModelAvailable
bool isTerrainModelAvailable() const
Definition:
world_model.cpp:66
vigir_footstep_planning::CollisionCheckPlugin
Definition:
collision_check_plugin.h:44
getPlugins
ROSLIB_DECL void getPlugins(const std::string &package, const std::string &attribute, V_string &plugins, bool force_recrawl=false)
vigir_footstep_planning::WorldModel::WorldModel
WorldModel()
Definition:
world_model.cpp:5
vigir_footstep_planning::WorldModel::resetPlugins
void resetPlugins() override
Definition:
world_model.cpp:33
vigir_footstep_planning::WorldModel::update3DData
bool update3DData(State &s) const
Definition:
world_model.cpp:84
vigir_footstep_planning::WorldModel::loadPlugins
void loadPlugins() override
Definition:
world_model.cpp:10
vigir_footstep_planning::WorldModel::isAccessible
bool isAccessible(const State &s) const
Definition:
world_model.cpp:41
world_model.h
vigir_footstep_planning::ExtendedPluginAggregator
Definition:
extended_plugin_aggregator.h:43
vigir_footstep_planning::WorldModel
Definition:
world_model.h:42
vigir_footstep_planning_plugins
Author(s): Alexander Stumpf
autogenerated on Mon Jun 10 2019 15:47:39