28 const std::string& child,
38 translation{inTX, inTY, inTZ},
39 rotation(inRX, inRY, inRZ, inRW)
47 translation.set(X, Y, Z);
52 double rot[3] = { R, P, Y };
59 rotation.fromRotationMatrix(rotM);
66 rotM = rotation.toRotationMatrix4x4();
75 t_mat = rotation.toRotationMatrix4x4();
76 t_mat[0][3] = translation.tX;
77 t_mat[1][3] = translation.tY;
78 t_mat[2][3] = translation.tZ;
84 if (mat.
cols() != 4 || mat.
rows() != 4)
86 yCError(FRAMETRANSFORM,
"FrameTransform::fromMatrix() failed, matrix should be = 4x4");
93 translation.tX = mat[0][3];
94 translation.tY = mat[1][3];
95 translation.tZ = mat[2][3];
96 rotation.fromRotationMatrix(mat);
106 if (format == rotation_as_quaternion)
108 sprintf(buff,
"%s -> %s \n tran: %f %f %f \n rot quaternion: %f %f %f %f\n\n",
109 src_frame_id.c_str(),
110 dst_frame_id.c_str(),
133 else if (format == rotation_as_matrix)
136 rotM = rotation.toRotationMatrix4x4();
137 rotM[0][3] = translation.tX;
138 rotM[1][3] = translation.tY;
139 rotM[2][3] = translation.tZ;
140 std::string s_rotm =rotM.
toString();
141 sprintf(buff,
"%s -> %s \n transformation matrix:\n %s \n\n",
142 src_frame_id.c_str(),
143 dst_frame_id.c_str(),
146 else if (format == rotation_as_rpy)
150 rotM = rotation.toRotationMatrix3x3();
154 std::string s_rotmr = rotVrad.
toString();
155 std::string s_rotmd = rotVdeg.
toString();
156 sprintf(buff,
"%s -> %s \n tran: %f %f %f \n rotation rpy: %s (deg %s)\n\n",
157 src_frame_id.c_str(),
158 dst_frame_id.c_str(),
165 return std::string(buff);