Control Libraries 7.4.0
Loading...
Searching...
No Matches
DynamicalSystemFactory.cpp
1#include "dynamical_systems/DynamicalSystemFactory.hpp"
2
3#include "dynamical_systems/Circular.hpp"
4#include "dynamical_systems/DefaultDynamicalSystem.hpp"
5#include "dynamical_systems/PointAttractor.hpp"
6#include "dynamical_systems/Ring.hpp"
7#include "dynamical_systems/exceptions/InvalidDynamicalSystemException.hpp"
8#include "state_representation/space/joint/JointState.hpp"
9
10using namespace state_representation;
11
12namespace dynamical_systems {
13
14template<>
15std::shared_ptr<IDynamicalSystem<CartesianState>> DynamicalSystemFactory<CartesianState>::create_dynamical_system(
16 DYNAMICAL_SYSTEM_TYPE type, const std::list<std::shared_ptr<state_representation::ParameterInterface>>& parameters
17) {
18 switch (type) {
19 case DYNAMICAL_SYSTEM_TYPE::POINT_ATTRACTOR:
20 return std::make_shared<PointAttractor<CartesianState>>(parameters);
21 case DYNAMICAL_SYSTEM_TYPE::CIRCULAR:
22 return std::make_shared<Circular>(parameters);
23 case DYNAMICAL_SYSTEM_TYPE::RING:
24 return std::make_shared<Ring>(parameters);
25 default:
26 case DYNAMICAL_SYSTEM_TYPE::NONE:
27 return std::make_shared<DefaultDynamicalSystem<CartesianState>>();
28 }
29}
30
31template<>
32std::shared_ptr<IDynamicalSystem<JointState>> DynamicalSystemFactory<JointState>::create_dynamical_system(
33 DYNAMICAL_SYSTEM_TYPE type, const std::list<std::shared_ptr<state_representation::ParameterInterface>>& parameters
34) {
35 switch (type) {
36 case DYNAMICAL_SYSTEM_TYPE::POINT_ATTRACTOR:
37 return std::make_shared<PointAttractor<JointState>>(parameters);
38 case DYNAMICAL_SYSTEM_TYPE::CIRCULAR:
39 case DYNAMICAL_SYSTEM_TYPE::RING:
40 throw exceptions::InvalidDynamicalSystemException("This JointState DS is not valid");
41 default:
42 case DYNAMICAL_SYSTEM_TYPE::NONE:
43 return std::make_shared<DefaultDynamicalSystem<JointState>>();
44 }
45}
46}// namespace dynamical_systems
static std::shared_ptr< IDynamicalSystem< S > > create_dynamical_system(DYNAMICAL_SYSTEM_TYPE type)
Create a dynamical system of the desired type.
Systems of equations relating state variables to their derivatives.
Definition Circular.hpp:7
DYNAMICAL_SYSTEM_TYPE
Enumeration of the implemented dynamical systems.
Core state variables and objects.