GlobalPlannerFactory.cpp
Go to the documentation of this file.
1
#include "
GlobalPlannerFactory.h
"
2
3
#include <memory>
4
5
#include <
ArmarXCore/core/exceptions/local/ExpressionException.h
>
6
#include <
ArmarXCore/util/CPPUtility/trace.h
>
7
8
#include <
RobotAPI/libraries/aron/core/data/variant/container/Dict.h
>
9
#include <
RobotAPI/libraries/aron/core/data/variant/primitive/String.h
>
10
11
#include <
armarx/navigation/core/constants.h
>
12
#include <
armarx/navigation/core/types.h
>
13
#include <
armarx/navigation/factories/fwd.h
>
14
#include <
armarx/navigation/global_planning/AStar.h
>
15
#include <
armarx/navigation/global_planning/Point2Point.h
>
16
#include <
armarx/navigation/global_planning/SPFA.h
>
17
#include <
armarx/navigation/global_planning/core.h
>
18
19
namespace
armarx::navigation::fac
20
{
21
global_planning::GlobalPlannerPtr
22
GlobalPlannerFactory::create
(
const
aron::data::DictPtr
& params,
const
core::Scene
& ctx)
23
{
24
ARMARX_TRACE
;
25
namespace
layer = global_planning;
26
27
if
(not params)
28
{
29
return
nullptr
;
30
}
31
32
// algo name
33
const
auto
algoName =
aron::data::String::DynamicCast
(params->getElement(
core::NAME_KEY
));
34
ARMARX_CHECK_NOT_NULL
(algoName);
35
const
layer::Algorithms
algo =
layer::AlgorithmNames
.from_name(algoName->getValue());
36
37
// algo params
38
const
auto
algoParams =
aron::data::Dict::DynamicCast
(params->getElement(
core::PARAMS_KEY
));
39
ARMARX_CHECK_NOT_NULL
(algoParams);
40
41
global_planning::GlobalPlannerPtr
globalPlanner;
42
switch
(algo)
43
{
44
case
global_planning::Algorithms::AStar
:
45
globalPlanner = std::make_shared<global_planning::AStar>(
46
global_planning::AStarParams::FromAron
(algoParams), ctx);
47
break
;
48
case
global_planning::Algorithms::SPFA
:
49
globalPlanner = std::make_shared<global_planning::SPFA>(
50
global_planning::SPFAParams::FromAron
(algoParams), ctx);
51
break
;
52
case
global_planning::Algorithms::Point2Point
:
53
globalPlanner = std::make_shared<global_planning::Point2Point>(
54
global_planning::Point2PointParams::FromAron
(algoParams), ctx);
55
break
;
56
}
57
58
return
globalPlanner;
59
}
60
61
}
// namespace armarx::navigation::fac
fwd.h
SPFA.h
armarx::navigation::core::NAME_KEY
const std::string NAME_KEY
Definition:
constants.h:33
armarx::navigation::fac::GlobalPlannerFactory::create
static global_planning::GlobalPlannerPtr create(const aron::data::DictPtr ¶ms, const core::Scene &ctx)
Definition:
GlobalPlannerFactory.cpp:22
armarx::navigation::global_planning::Algorithms::Point2Point
@ Point2Point
see Point2Point
armarx::navigation::core::PARAMS_KEY
const std::string PARAMS_KEY
Definition:
constants.h:34
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:19
trace.h
armarx::navigation::global_planning::Point2PointParams::FromAron
static Point2PointParams FromAron(const aron::data::DictPtr &dict)
Definition:
Point2Point.cpp:44
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:116
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:77
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:60
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
types.h
armarx::navigation::global_planning::Algorithms::AStar
@ AStar
see AStar
AStar.h
armarx
navigation
factories
GlobalPlannerFactory.cpp
Generated on Sat Mar 29 2025 09:17:35 for armarx_documentation by
1.8.17