26 #include <Eigen/Geometry>
30 #include <RobotAPI/interface/units/KinematicUnitInterface.h>
31 #include <RobotAPI/interface/units/KinematicUnitInterfaceStdOverloads.h>
47 const Eigen::Vector3f& field,
56 const Eigen::Vector3f& field,
69 const std::vector<std::string>&
72 static const std::vector<std::string> result{
"x",
"y",
"z"};
76 std::map<std::string, VariantBasePtr>
78 const std::string& name,
80 const std::string& frame,
81 const std::string& agent)
95 #define make_DataFieldsInfo_for_eigen_vector(Type, TypeName, Num) \
96 void DataFieldsInfo<Eigen::Vector##Num##Type, void>::GetDataFieldAs( \
97 std::size_t i, const Eigen::Vector##Num##Type& field, std::string& out) \
99 ARMARX_CHECK_LESS(i, Num); \
100 out = to_string(field(i)); \
102 void DataFieldsInfo<Eigen::Vector##Num##Type, void>::GetDataFieldAs( \
103 std::size_t i, const Eigen::Vector##Num##Type& field, Ice::TypeName& out) \
105 ARMARX_CHECK_LESS(i, Num); \
108 const std::type_info& DataFieldsInfo<Eigen::Vector##Num##Type, void>::GetDataFieldType( \
111 return typeid(Ice::TypeName); \
113 std::map<std::string, VariantBasePtr> \
114 DataFieldsInfo<Eigen::Vector##Num##Type, void>::ToVariants( \
115 const Eigen::Vector##Num##Type& value, \
116 const std::string& name, \
117 const IceUtil::Time& timestamp, \
118 const std::string& frame, \
119 const std::string& agent) \
121 ARMARX_CHECK_EXPRESSION(frame.empty() && agent.empty()) \
122 << "There is no framed version of TimestampVariant"; \
123 std::map<std::string, VariantBasePtr> result; \
124 for (int i = 0; i < Num; ++i) \
126 result.emplace(name + "." + to_string(i), \
127 VariantBasePtr{new TimedVariant(value(i), timestamp)}); \
131 const std::vector<std::string>& \
132 DataFieldsInfo<Eigen::Vector##Num##Type, void>::GetFieldNames() \
134 static const std::vector<std::string> result = [] \
136 std::vector<std::string> r; \
137 for (int i = 0; i < Num; ++i) \
139 r.emplace_back(to_string(i)); \
163 #undef make_DataFieldsInfo_for_eigen_vector
181 out = field(i / 4, i % 4);
193 const std::type_info&
196 return typeid(
float);
199 const std::vector<std::string>&
202 static const std::vector<std::string> result{
"00",
221 std::map<std::string, VariantBasePtr>
223 const std::string& name,
225 const std::string& frame,
226 const std::string& agent)
267 throw std::logic_error{__FILE__
" : " +
to_string(__LINE__) +
268 " : Unreachable code reached"};
292 throw std::logic_error{__FILE__
" : " +
to_string(__LINE__) +
293 " : Unreachable code reached"};
296 const std::type_info&
299 return typeid(
float);
302 const std::vector<std::string>&
305 static const std::vector<std::string> result{
"qw",
"qx",
"qy",
"qz"};
309 std::map<std::string, VariantBasePtr>
311 const std::string& name,
313 const std::string& frame,
314 const std::string& agent)
337 const std::chrono::microseconds& field,
347 const std::chrono::microseconds& field,
354 const std::type_info&
360 std::map<std::string, VariantBasePtr>
362 const std::string& name,
364 const std::string& frame,
365 const std::string& agent)
368 <<
"There is no framed version of TimestampVariant";
389 out = field.toMicroSeconds();
401 const std::type_info&
407 std::map<std::string, VariantBasePtr>
409 const std::string& name,
411 const std::string& frame,
412 const std::string& agent)
415 <<
"There is no framed version of TimestampVariant";
431 const JointStatus& field,
450 throw std::logic_error{__FILE__
" : " +
to_string(__LINE__) +
451 " : Unreachable code reached"};
456 const JointStatus& field,
466 out = field.emergencyStop;
469 throw std::logic_error{__FILE__
" : " +
to_string(__LINE__) +
470 " : Unreachable code reached"};
475 const JointStatus& field,
482 out =
static_cast<Ice::Int>(field.error);
485 out =
static_cast<Ice::Int>(field.operation);
488 throw std::logic_error{__FILE__
" : " +
to_string(__LINE__) +
489 " : Unreachable code reached"};
492 const std::type_info&
507 throw std::logic_error{__FILE__
" : " +
to_string(__LINE__) +
508 " : Unreachable code reached"};
511 const std::vector<std::string>&
514 static const std::vector<std::string> result{
515 "error",
"operation",
"enabled",
"emergencyStop"};
519 std::map<std::string, VariantBasePtr>
521 const std::string& name,
523 const std::string& frame,
524 const std::string& agent)
527 <<
"There is no framed version for JointStatus";
528 static const auto fnames = GetFieldNames();