GlobalPlannerFactory.cpp
Go to the documentation of this file.
1 #include "GlobalPlannerFactory.h"
2 
4 
7 
13 
15 {
18  {
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 
37  switch (algo)
38  {
40  globalPlanner = std::make_shared<global_planning::AStar>(
42  break;
44  globalPlanner = std::make_shared<global_planning::SPFA>(
45  global_planning::SPFAParams::FromAron(algoParams), ctx);
46  break;
48  globalPlanner = std::make_shared<global_planning::Point2Point>(
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 &params, 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