# Tf\_transformations - ROS 2 Python package for easy TF math

**URL:** <https://discourse.openrobotics.org/t/tf-transformations-ros-2-python-package-for-easy-tf-math/21077>\
**Category:** ROS General\
**Tags:** ros2\
**Created:** [June 25, 2021, 1:49pm UTC](https://discourse.openrobotics.org/t/tf-transformations-ros-2-python-package-for-easy-tf-math/21077 "2021-06-25T13:49:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DLu](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/dlu/32/19014_2.png) [@DLu](https://discourse.openrobotics.org/u/DLu)\
**Post date:** [June 25, 2021, 1:49pm UTC](https://discourse.openrobotics.org/t/tf-transformations-ros-2-python-package-for-easy-tf-math/21077/1 "2021-06-25T13:49:19Z")

</div>

Piggy-backing on the announcement of [rospy2](http://discourse.ros.org/t/rospy2-a-cringe-worthy-ros1-like-interface-for-ros2/21067/5), I too am trying to make it easier to migrate ROS 1 Python code to ROS 2. In particular, I’ve made the new package [`tf_transformations`](https://github.com/DLu/tf_transformations/) to fill the hole left by the useful ROS 1 library [`transformations.py`](https://github.com/ros/geometry/blob/noetic-devel/tf/src/tf/transformations.py).

In short, if you wrote the following in ROS 1,

```
from tf.transformations import euler_from_quaternion

```

the only change you need to your code in ROS 2 is

```
from tf_transformations import euler_from_quaternion

```

For more information about the rationale behind the library, why it wasn’t already in ROS 2, the installation procedures and more, please see the [project README](https://github.com/DLu/tf_transformations/blob/main/README.md). Note that the library is currently making its way through the buildfarm for foxy, galactic and rolling, so [exciting things are coming soon](https://www.youtube.com/watch?v=8YjFbMbfXaQ).

---

<div class="post-metadata">

**Author:** ![Achllle](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/achllle/32/4397_2.png) [@Achllle](https://discourse.openrobotics.org/u/Achllle)\
**Post date:** [June 25, 2021, 2:29pm UTC](https://discourse.openrobotics.org/t/tf-transformations-ros-2-python-package-for-easy-tf-math/21077/2 "2021-06-25T14:29:54Z")

</div>

A much needed effort, I think a lot of us were doing this manually in various ways.

(Except any conversion **to** Euler angles. IMO we should work as a community to ban them forever or at least spam the user with a warning. 😅 That also reminds me I need to update the [dual quaternions ROS](https://github.com/Achllle/dual_quaternions_ros) package to support ROS2.)
