GlobalPlannerFactory.cpp
Go to the documentation of this file.
1
#include "
GlobalPlannerFactory.h
"
2
3
#include <
ArmarXCore/core/exceptions/local/ExpressionException.h
>
4
5
#include <
RobotAPI/libraries/aron/core/data/variant/container/Dict.h
>
6
#include <
RobotAPI/libraries/aron/core/data/variant/primitive/String.h
>
7
8
#include <
armarx/navigation/core/constants.h
>
9
#include <
armarx/navigation/global_planning/AStar.h
>
10
#include <
armarx/navigation/global_planning/Point2Point.h
>
11
#include <
armarx/navigation/global_planning/SPFA.h
>
12
#include <
armarx/navigation/global_planning/core.h
>
13
14
namespace
armarx::navigation::fac
15
{
16
global_planning::GlobalPlannerPtr
17
GlobalPlannerFactory::create
(
const
aron::data::DictPtr
& params,
const
core::Scene
& ctx)
18
{
19
ARMARX_TRACE
;
20
namespace
layer = global_planning;
21
22
if
(not params)
23
{
24
return
nullptr
;
25
}
26
27
// algo name
28
const
auto
algoName =
aron::data::String::DynamicCast
(params->getElement(
core::NAME_KEY
));
29
ARMARX_CHECK_NOT_NULL
(algoName);
30
const
layer::Algorithms
algo =
layer::AlgorithmNames
.from_name(algoName->getValue());
31
32
// algo params
33
const
auto
algoParams =
aron::data::Dict::DynamicCast
(params->getElement(
core::PARAMS_KEY
));
34
ARMARX_CHECK_NOT_NULL
(algoParams);
35
36
global_planning::GlobalPlannerPtr
globalPlanner;
37
switch
(algo)
38
{
39
case
global_planning::Algorithms::AStar
:
40
globalPlanner = std::make_shared<global_planning::AStar>(
41
global_planning::AStarParams::FromAron
(algoParams), ctx);
42
break
;
43
case
global_planning::Algorithms::SPFA
:
44
globalPlanner = std::make_shared<global_planning::SPFA>(
45
global_planning::SPFAParams::FromAron
(algoParams), ctx);
46
break
;
47
case
global_planning::Algorithms::Point2Point
:
48
globalPlanner = std::make_shared<global_planning::Point2Point>(
49
global_planning::Point2PointParams::FromAron
(algoParams), ctx);
50
break
;
51
}
52
53
return
globalPlanner;
54
}
55
56
}
// namespace armarx::navigation::fac
SPFA.h
armarx::navigation::core::NAME_KEY
const std::string NAME_KEY
Definition:
constants.h:30
armarx::navigation::fac::GlobalPlannerFactory::create
static global_planning::GlobalPlannerPtr create(const aron::data::DictPtr ¶ms, const core::Scene &ctx)
Definition:
GlobalPlannerFactory.cpp:17
armarx::navigation::global_planning::Algorithms::Point2Point
@ Point2Point
see Point2Point
armarx::navigation::core::PARAMS_KEY
const std::string PARAMS_KEY
Definition:
constants.h:31
ARMARX_CHECK_NOT_NULL
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
Definition:
ExpressionException.h:206
armarx::navigation::fac
This file is part of ArmarX.
Definition:
GlobalPlannerFactory.cpp:14
armarx::navigation::global_planning::Point2PointParams::FromAron
static Point2PointParams FromAron(const aron::data::DictPtr &dict)
Definition:
Point2Point.cpp:40
constants.h
armarx::navigation::global_planning::GlobalPlannerPtr
std::shared_ptr< GlobalPlanner > GlobalPlannerPtr
Definition:
fwd.h:32
Dict.h
armarx::aron::data::detail::SpecializedVariantBase< data::dto::AronString, String >::DynamicCast
static PointerType DynamicCast(const VariantPtr &n)
Definition:
SpecializedVariant.h:117
armarx::navigation::global_planning::AlgorithmNames
const simox::meta::EnumNames< Algorithms > AlgorithmNames
Definition:
core.h:45
Point2Point.h
ARMARX_TRACE
#define ARMARX_TRACE
Definition:
trace.h:69
armarx::navigation::global_planning::AStarParams::FromAron
static AStarParams FromAron(const aron::data::DictPtr &dict)
Definition:
AStar.cpp:55
armarx::navigation::core::Scene
Definition:
types.h:71
ExpressionException.h
armarx::aron::data::DictPtr
std::shared_ptr< Dict > DictPtr
Definition:
Dict.h:41
armarx::navigation::global_planning::Algorithms::SPFA
@ SPFA
GlobalPlannerFactory.h
armarx::navigation::global_planning::SPFAParams::FromAron
static SPFAParams FromAron(const aron::data::DictPtr &dict)
Definition:
SPFA.cpp:59
core.h
armarx::navigation::global_planning::Algorithms
Algorithms
Definition:
core.h:38
String.h
armarx::navigation::global_planning::Algorithms::AStar
@ AStar
see AStar
AStar.h
armarx
navigation
factories
GlobalPlannerFactory.cpp
Generated on Sat Oct 12 2024 09:14:15 for armarx_documentation by
1.8.17