Skip to content

Commit 2b9ebaa

Browse files
NoelieRamuzatnim65s
authored andcommitted
[operator] Add operator PoseQuaternionToHomogeneousMatrix
1 parent 64aea37 commit 2b9ebaa

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/dynamic_graph/sot/core/math_small_entities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Compose_R_and_T, ConvolutionTemporal, HomoToMatrix, HomoToRotation,
1111
HomoToTwist, Inverse_of_matrix, Inverse_of_matrixHomo,
1212
Inverse_of_matrixrotation, Inverse_of_matrixtwist, Inverse_of_unitquat,
13-
MatrixDiagonal, MatrixHomoToPose, MatrixHomoToPoseQuaternion,
13+
MatrixDiagonal, MatrixHomoToPose, MatrixHomoToPoseQuaternion, PoseQuatToMatrixHomo,
1414
MatrixHomoToPoseRollPitchYaw, MatrixHomoToPoseUTheta, MatrixToHomo,
1515
MatrixToQuaternion, MatrixToRPY, MatrixToUTheta, MatrixTranspose,
1616
Multiply_double_vector, Multiply_matrix_vector,

src/matrix/operator.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,15 @@ struct MatrixHomoToPoseQuaternion
356356
};
357357
REGISTER_UNARY_OP(MatrixHomoToPoseQuaternion, MatrixHomoToPoseQuaternion);
358358

359+
struct PoseQuaternionToMatrixHomo
360+
: public UnaryOpHeader<Vector, MatrixHomogeneous> {
361+
void operator()(const dg::Vector &vect, MatrixHomogeneous &Mres) {
362+
Mres.translation() = vect.head<3>();
363+
Mres.linear() = VectorQuaternion(vect.tail<4>()).toRotationMatrix();
364+
}
365+
};
366+
REGISTER_UNARY_OP(PoseQuaternionToMatrixHomo, PoseQuatToMatrixHomo);
367+
359368
struct MatrixHomoToPoseRollPitchYaw
360369
: public UnaryOpHeader<MatrixHomogeneous, Vector> {
361370
void operator()(const MatrixHomogeneous &M, dg::Vector &res) {

0 commit comments

Comments
 (0)