SafetyControllerFactory.cpp
Go to the documentation of this file.
1
#include "
SafetyControllerFactory.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/safety_control/LaserBasedProximity.h
>
10
#include <
armarx/navigation/safety_control/SafetyController.h
>
11
#include <
armarx/navigation/safety_control/core.h
>
12
13
namespace
armarx::navigation::fac
14
{
15
safe_ctrl::SafetyControllerPtr
16
SafetyControllerFactory::create
(
const
aron::data::DictPtr
& params,
const
core::Scene
& ctx)
17
{
18
namespace
layer = safe_ctrl;
19
20
if
(not params)
21
{
22
return
nullptr
;
23
}
24
25
// algo name
26
const
auto
algoName =
aron::data::String::DynamicCast
(params->getElement(
core::NAME_KEY
));
27
ARMARX_CHECK_NOT_NULL
(algoName);
28
const
layer::Algorithms
algo =
layer::AlgorithmNames
.from_name(algoName->getValue());
29
30
// algo params
31
const
auto
algoParams =
aron::data::Dict::DynamicCast
(params->getElement(
core::PARAMS_KEY
));
32
ARMARX_CHECK_NOT_NULL
(algoParams);
33
34
safe_ctrl::SafetyControllerPtr
controller
;
35
switch
(algo)
36
{
37
case
safe_ctrl::Algorithms::LaserBasedProximity
:
38
controller
= std::make_shared<safe_ctrl::LaserBasedProximity>(
39
safe_ctrl::LaserBasedProximityParams::FromAron
(algoParams), ctx);
40
break
;
41
}
42
43
return
controller
;
44
}
45
}
// namespace armarx::navigation::fac
armarx::navigation::core::NAME_KEY
const std::string NAME_KEY
Definition:
constants.h:30
armarx::navigation::core::PARAMS_KEY
const std::string PARAMS_KEY
Definition:
constants.h:31
SafetyControllerFactory.h
armarx::navigation::fac::SafetyControllerFactory::create
static safe_ctrl::SafetyControllerPtr create(const aron::data::DictPtr ¶ms, const core::Scene &ctx)
Definition:
SafetyControllerFactory.cpp:16
core.h
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
LaserBasedProximity.h
constants.h
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
armarx::navigation::safe_ctrl::SafetyControllerPtr
std::shared_ptr< SafetyController > SafetyControllerPtr
Definition:
fwd.h:50
controller
Definition:
AddOperation.h:39
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::safe_ctrl::LaserBasedProximityParams::FromAron
static LaserBasedProximityParams FromAron(const aron::data::DictPtr &dict)
Definition:
LaserBasedProximity.cpp:21
armarx::navigation::safe_ctrl::Algorithms::LaserBasedProximity
@ LaserBasedProximity
armarx::navigation::global_planning::Algorithms
Algorithms
Definition:
core.h:38
String.h
SafetyController.h
armarx
navigation
factories
SafetyControllerFactory.cpp
Generated on Sat Oct 12 2024 09:14:15 for armarx_documentation by
1.8.17