5#include "state_representation/parameters/ParameterInterface.hpp"
6#include "state_representation/geometry/Ellipsoid.hpp"
7#include "state_representation/space/cartesian/CartesianPose.hpp"
8#include "state_representation/space/joint/JointPositions.hpp"
29 explicit Parameter(
const std::string& name,
const T& value);
88 Parameter<T>(parameter.get_name(), static_cast<T>(parameter.get_value())) {}
101 return static_cast<U
>(this->value_);
117 this->value_ = value;
121static std::shared_ptr<Parameter<T>> make_shared_parameter(
const std::string& name,
const T& param_value) {
122 return std::make_shared<Parameter<T>>(name, param_value);
125[[maybe_unused]]
static std::shared_ptr<ParameterInterface> make_shared_parameter_interface(
126 const std::string& name,
const ParameterType& type,
const StateType& parameter_state_type = StateType::NONE
129 case ParameterType::BOOL:
130 return std::make_shared<Parameter<bool>>(name);
131 case ParameterType::BOOL_ARRAY:
132 return std::make_shared<Parameter<std::vector<bool>>>(name);
133 case ParameterType::INT:
134 return std::make_shared<Parameter<int>>(name);
135 case ParameterType::INT_ARRAY:
136 return std::make_shared<Parameter<std::vector<int>>>(name);
137 case ParameterType::DOUBLE:
138 return std::make_shared<Parameter<double>>(name);
139 case ParameterType::DOUBLE_ARRAY:
140 return std::make_shared<Parameter<std::vector<double>>>(name);
141 case ParameterType::STRING:
142 return std::make_shared<Parameter<std::string>>(name);
143 case ParameterType::STRING_ARRAY:
144 return std::make_shared<Parameter<std::vector<std::string>>>(name);
145 case ParameterType::STATE: {
146 switch (parameter_state_type) {
147 case StateType::CARTESIAN_STATE:
148 return std::make_shared<Parameter<CartesianState>>(name);
149 case StateType::CARTESIAN_POSE:
150 return std::make_shared<Parameter<CartesianPose>>(name);
151 case StateType::JOINT_STATE:
152 return std::make_shared<Parameter<JointState>>(name);
153 case StateType::JOINT_POSITIONS:
154 return std::make_shared<Parameter<JointPositions>>(name);
155 case StateType::GEOMETRY_ELLIPSOID:
156 return std::make_shared<Parameter<Ellipsoid>>(name);
157 case StateType::NONE:
158 throw exceptions::InvalidParameterException(
"No StateType provided.");
160 throw exceptions::InvalidParameterException(
"This StateType is not supported for parameters.");
163 case ParameterType::VECTOR:
164 return std::make_shared<Parameter<Eigen::VectorXd>>(name);
165 case ParameterType::MATRIX:
166 return std::make_shared<Parameter<Eigen::MatrixXd>>(name);
168 throw exceptions::InvalidParameterException(
"This StateType is not supported for parameters.");
friend std::ostream & operator<<(std::ostream &os, const Parameter< U > ¶meter)
Overload the ostream operator for printing.
Parameter(const std::string &name, const T &value)
Constructor with a name and a value.
virtual ~Parameter()=default
Default virtual destructor.
U get_value() const
Getter of the value attribute.
const T & get_value() const
Getter of the value attribute.
Parameter(const Parameter< U > ¶meter)
Copy constructor.
Parameter< T > & operator=(const Parameter< U > ¶meter)
Conversion equality.
Parameter(const std::string &name)
Constructor with name of the parameter.
virtual void set_value(const T &value)
Setter of the value attribute.
T & get_value()
Getter of the value attribute.
Core state variables and objects.
ParameterType
The parameter value types.
StateType
The class types inheriting from State.