TrajectoryControllerFactory.cpp
Go to the documentation of this file.
1
#include "
TrajectoryControllerFactory.h
"
2
3
#include <
ArmarXCore/core/exceptions/local/ExpressionException.h
>
4
5
#include <
RobotAPI/libraries/aron/core/data/variant/primitive/String.h
>
6
7
#include <
armarx/navigation/core/constants.h
>
8
#include <
armarx/navigation/trajectory_control/local/TrajectoryController.h
>
9
#include <
armarx/navigation/trajectory_control/local/TrajectoryFollowingController.h
>
10
11
namespace
armarx::navigation::fac
12
{
13
traj_ctrl::local::TrajectoryControllerPtr
14
TrajectoryControllerFactory::create
(
const
aron::data::DictPtr
& params)
15
{
16
namespace
layer = traj_ctrl::local;
17
18
if
(not params)
19
{
20
return
nullptr
;
21
}
22
23
// algo name
24
const
auto
algoName =
aron::data::String::DynamicCast
(params->getElement(
core::NAME_KEY
));
25
ARMARX_CHECK_NOT_NULL
(algoName);
26
const
layer::Algorithms
algo =
layer::AlgorithmNames
.from_name(algoName->getValue());
27
28
// algo params
29
const
auto
algoParams =
aron::data::Dict::DynamicCast
(params->getElement(
core::PARAMS_KEY
));
30
ARMARX_CHECK_NOT_NULL
(algoParams);
31
32
traj_ctrl::local::TrajectoryControllerPtr
controller
;
33
switch
(algo)
34
{
35
case
traj_ctrl::local::Algorithms::TrajectoryFollowingController
:
36
controller
= std::make_shared<traj_ctrl::local::TrajectoryFollowingController>(
37
traj_ctrl::local::TrajectoryFollowingControllerParams::FromAron
(algoParams));
38
break
;
39
}
40
41
return
controller
;
42
}
43
}
// namespace armarx::navigation::fac
armarx::navigation::core::NAME_KEY
const std::string NAME_KEY
Definition:
constants.h:30
TrajectoryController.h
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::traj_ctrl::local::TrajectoryFollowingControllerParams::FromAron
static TrajectoryFollowingControllerParams FromAron(const aron::data::DictPtr &dict)
Definition:
TrajectoryFollowingController.cpp:49
constants.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
controller
Definition:
AddOperation.h:39
TrajectoryFollowingController.h
armarx::navigation::fac::TrajectoryControllerFactory::create
static traj_ctrl::local::TrajectoryControllerPtr create(const aron::data::DictPtr ¶ms)
Definition:
TrajectoryControllerFactory.cpp:14
ExpressionException.h
armarx::aron::data::DictPtr
std::shared_ptr< Dict > DictPtr
Definition:
Dict.h:41
armarx::navigation::traj_ctrl::local::TrajectoryControllerPtr
std::shared_ptr< TrajectoryController > TrajectoryControllerPtr
Definition:
TrajectoryController.h:71
armarx::navigation::global_planning::Algorithms
Algorithms
Definition:
core.h:38
TrajectoryControllerFactory.h
armarx::navigation::traj_ctrl::local::Algorithms::TrajectoryFollowingController
@ TrajectoryFollowingController
String.h
armarx
navigation
factories
TrajectoryControllerFactory.cpp
Generated on Sat Oct 12 2024 09:14:15 for armarx_documentation by
1.8.17