29 #include <SimoxUtility/meta/eigen/is_eigen_array.h>
30 #include <SimoxUtility/meta/eigen/is_eigen_matrix.h>
31 #include <SimoxUtility/json.h>
41 std::enable_if_t <simox::meta::is_eigen_array_v<T>>
54 std::enable_if_t <simox::meta::is_eigen_matrix_v<T>>
59 using traits = simox::meta::is_eigen_matrix<T>;
60 using eigen_t =
typename traits::eigen_t;
61 using scalar_t =
typename traits::scalar_t;
65 if constexpr(traits::cols == 1 or traits::rows == 1)
68 std::vector<scalar_t> coefs;
69 for (
unsigned int r = 0; r < traits::rows; ++r)
71 for (
unsigned int c = 0;
c < traits::cols; ++
c)
73 coefs.push_back(m(r,
c));
93 std::enable_if_t <simox::meta::is_eigen_array_v<T>>
98 using traits = simox::meta::is_eigen_array<T>;
99 using eigen_t =
typename traits::eigen_t;
101 const static auto parser = [&](
const std::string &
input) -> eigen_t
103 return nlohmann::json::parse(
input);
113 std::enable_if_t <simox::meta::is_eigen_matrix_v<T>>
118 using traits = simox::meta::is_eigen_matrix<T>;
119 using eigen_t =
typename traits::eigen_t;
120 using scalar_t =
typename traits::scalar_t;
122 const static auto parser = [&](
const std::string &
input) -> eigen_t
125 if constexpr(!(traits::cols == 1 or traits::rows == 1))
127 return nlohmann::json::parse(
input);
131 eigen_t m = eigen_t::Zero();
132 const std::vector<scalar_t> coefs = nlohmann::json::parse(
input);
134 if (
static_cast<long int>(coefs.size()) != m.size())
138 <<
"Property must be a vector with " << m.size() <<
" elements.";
143 for (
unsigned int i = 0; i < coefs.size(); ++i)
145 m(r,
c) = coefs.at(i);
147 if constexpr(traits::cols == 1)