1 | initial version |

There are a million ways to do this and none of them are really right or wrong. But personally, I like to use numpy (actually the tf.transformations library which is a nice wrapper for numpy) for everything inside my code.

I only use the transform messages to receive and send transforms to other processes. So as soon as any of my software takes in a transform, pose, point, or whatever, and I know I need to manipulate it, the first thing I do is convert it to a numpy type. I think always working with the same types and library makes things cleaner and easier in the long run.

So if you're grabbing a transform and want to invert it, that would look like this:

```
from tf import transformations as t
(trans, rot) = transformer.lookupTransform(frame1, frame2, rospy.Time(0))
transform = t.concatenate_matrices(t.translation_matrix(trans), t.quaternion_matrix(rot))
inversed_transform = t.inverse_matrix(transform)
```

Is that what you're looking for?

2 | No.2 Revision |

There are a million ways to do this and none of them are really right or wrong. But personally, I like to use numpy (actually the tf.transformations library which is a nice wrapper for numpy) for everything inside my code.

I only use the transform messages to receive and send transforms to other processes. So as soon as any of my software takes in a transform, pose, point, or whatever, and I know I need to manipulate it, the first thing I do is convert it to a numpy type. I think always working with the same types and library makes things cleaner and easier in the long run.

So if you're grabbing a transform and want to invert it, that would look like this:

```
from tf import transformations as t
(trans, rot) = transformer.lookupTransform(frame1, frame2, rospy.Time(0))
transform = t.concatenate_matrices(t.translation_matrix(trans), t.quaternion_matrix(rot))
inversed_transform = t.inverse_matrix(transform)
```

Is that what you're looking for?

ROS Answers is licensed under Creative Commons Attribution 3.0 Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.