0
$\begingroup$

Rosanswers logo

Hello,

In Ros1 you could use functions from these imports:

from tf_matrix_ops import tf_to_matrix, matrix_to_tf 
from tf.transformations import decompose_matrix

where you could transform tf to matrix then multiply them, take the inverse or extract informations from them.

I have a code sample that do the following and I would like to know if it is possible to do the same with ros2 and tf 2:

 m1 = tf_to_matrix(tf1)  
 m2 = tf_to_matrix(tf2)
 delta = np.matmul(m1, np.linalg.inv(m2)) 
 scale, shear, angles, t, perspective = decompose_matrix(delta)

I think the tf_matrix_ops and tf.transformations are not available in ros2 (or at least i did not find them) so maybe there is a new way to do this kind of thing ?


Originally posted by Alrevan on ROS Answers with karma: 126 on 2020-11-19

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

An update on this question:

I realised that "tf_matrix_ops is actually" a homemade package I wrote some time ago... For the case of "transformations.py" it is reallsy starightforward to convert it to ROS 2 as it is bascically a mathematic operation package.

After this one can easily write "tf_to_matrix" and "matrix_to_tf" helper functions using euler_from_quaternion, quaternion_from_euler, compose_matrix and decompose_matrix from transformations.py.


Originally posted by Alrevan with karma: 126 on 2020-12-01

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.