GlobalPlannerFactory.cpp
Go to the documentation of this file.
2
3#include <memory>
4
9
12
22
24{
27 const aron::data::DictPtr& params,
28 const core::Scene& ctx)
29 {
31 namespace layer = global_planning;
32
33 if (not params)
34 {
35 return nullptr;
36 }
37
38 // algo name
39 const auto algoName = aron::data::String::DynamicCast(params->getElement(core::NAME_KEY));
40 ARMARX_CHECK_NOT_NULL(algoName);
41 const layer::Algorithms algo = layer::AlgorithmNames.from_name(algoName->getValue());
42
43 // algo params
44 const auto algoParams = aron::data::Dict::DynamicCast(params->getElement(core::PARAMS_KEY));
45 ARMARX_CHECK_NOT_NULL(algoParams);
46
48 switch (algo)
49 {
51 ARMARX_INFO << "Using " << VAROUT("AStar") << " global planning strategy.";
52 globalPlanner = std::make_shared<global_planning::AStar>(
54 generalConfig,
55 ctx);
56 break;
58 ARMARX_INFO << "Using " << VAROUT("SPFA") << " global planning strategy.";
59 globalPlanner = std::make_shared<global_planning::SPFA>(
61 generalConfig,
62 ctx);
63 break;
65 ARMARX_INFO << "Using " << VAROUT("Point2Point") << " global planning strategy.";
66 globalPlanner = std::make_shared<global_planning::Point2Point>(
68 generalConfig,
69 ctx);
70 break;
72 ARMARX_INFO << "Using " << VAROUT("AStarWithOrientation")
73 << " global planning strategy.";
74 globalPlanner = std::make_shared<global_planning::AStarWithOrientation>(
76 generalConfig,
77 ctx);
78 }
79
80 return globalPlanner;
81 }
82
83} // namespace armarx::navigation::fac
#define VAROUT(x)
static global_planning::GlobalPlannerPtr create(const core::GeneralConfig &generalConfig, const aron::data::DictPtr &params, const core::Scene &ctx)
#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...
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
std::shared_ptr< Dict > DictPtr
Definition Dict.h:42
const std::string PARAMS_KEY
Definition constants.h:34
const std::string NAME_KEY
Definition constants.h:33
This file is part of ArmarX.
This file is part of ArmarX.
Definition fwd.h:30
std::shared_ptr< GlobalPlanner > GlobalPlannerPtr
Definition fwd.h:32
static AStarParams FromAron(const aron::data::DictPtr &dict)
Definition AStar.cpp:55
static AStarWithOrientationParams FromAron(const aron::data::DictPtr &dict)
static Point2PointParams FromAron(const aron::data::DictPtr &dict)
static SPFAParams FromAron(const aron::data::DictPtr &dict)
Definition SPFA.cpp:66
#define ARMARX_TRACE
Definition trace.h:77