17 #include <geometry_msgs/Point.h>
18 #include <geometry_msgs/Point32.h>
19 #include <geometry_msgs/Pose.h>
20 #include <geometry_msgs/Quaternion.h>
21 #include <geometry_msgs/Transform.h>
22 #include <geometry_msgs/Vector3.h>
26 #define DEFINE_CONVERTING_GET_PARAM_ROS_VECTOR3(resultType, scalarType, defaultUnit) \
27 DEFINE_CONVERTING_GET_PARAM(resultType, std::vector<scalarType>, defaultUnit, [](const ::std::vector<scalarType>& v){ \
29 throw ::std::runtime_error( \
30 ::cras::format("Cannot load %s parameter from an array of length %lu", #resultType, v.size())); \
31 resultType m; m.x = v[0]; m.y = v[1]; m.z = v[2]; \
40 if (v.size() != 3 && v.size() != 4)
41 throw ::std::runtime_error(::
cras::format(
"Cannot load %s parameter from an array of length %lu",
42 "geometry_msgs::Quaternion", v.size()));
43 ::geometry_msgs::Quaternion m;
46 m.x = v[0]; m.y = v[1]; m.z = v[2]; m.w = v[3];
51 m.x = q.getX(); m.y = q.getY(); m.z = q.getZ(); m.w = q.
getW();
57 if (v.size() != 6 && v.size() != 7 && v.size() != 16)
58 throw ::std::runtime_error(::
cras::format(
"Cannot load %s parameter from an array of length %lu",
59 "geometry_msgs::Transform", v.size()));
60 ::geometry_msgs::Transform m;
61 if (v.size() == 6 || v.size() == 7)
63 m.translation.x = v[0]; m.translation.y = v[1]; m.translation.z = v[2];
67 m.rotation.x = q.getX(); m.rotation.y = q.getY(); m.rotation.z = q.getZ(); m.rotation.w = q.
getW();
71 m.rotation.x = v[3]; m.rotation.y = v[4]; m.rotation.z = v[5]; m.rotation.w = v[6];
76 m.translation.x = v[3]; m.translation.y = v[7]; m.translation.z = v[11];
80 m.rotation.x = q.getX(); m.rotation.y = q.getY(); m.rotation.z = q.getZ(); m.rotation.w = q.
getW();
86 if (v.size() != 6 && v.size() != 7 && v.size() != 16)
87 throw ::std::runtime_error(::
cras::format(
"Cannot load %s parameter from an array of length %lu",
88 "geometry_msgs::Pose", v.size()));
89 ::geometry_msgs::Pose m;
90 if (v.size() == 6 || v.size() == 7)
92 m.position.x = v[0]; m.position.y = v[1]; m.position.z = v[2];
96 m.orientation.x = q.getX(); m.orientation.y = q.getY(); m.orientation.z = q.getZ(); m.orientation.w = q.
getW();
100 m.orientation.x = v[3]; m.orientation.y = v[4]; m.orientation.z = v[5]; m.orientation.w = v[6];
105 m.position.x = v[3]; m.position.y = v[7]; m.position.z = v[11];
109 m.orientation.x = q.getX(); m.orientation.y = q.getY(); m.orientation.z = q.getZ(); m.orientation.w = q.
getW();