Skip to content

Software

tf_transformations

From github.com/DLu/tf_transformations (opens in a new tab)

  • Middleware
  • Library
  • BSD-3-Clause

A ROS 2 Python library that provides the rotation and quaternion conversion functions of ROS 1's tf transformations module, so existing code can be ported with a small import change.

Facts

GitHub stars
58read on 29 Nov 2026
Last update
26 Oct 2026Newest commit on main
Maintenance
Activea commit in the last 90 days
Difficulty
Beginner

Checked on GitHub on 29 Nov 2026.

Licenses

Code
BSD-3-Clause (opens in a new tab)

Read by Robotheca from LICENSE (opens in a new tab) (BSD-3-Clause) at commit ef0374d (opens in a new tab), on 1 Nov 2026.

Commercial use
Yes

At a glance

What it is
  • Offers the functions of the ROS 1 tf.transformations module under the tf_transformations name for ROS 2.
  • Ports ROS 1 code by changing the import from tf.transformations to tf_transformations.
  • Uses the transforms3d library for the math wherever it is available.
  • Keeps the original implementations for functions not yet migrated to transforms3d.
  • Quaternions are returned in x, y, z, w order, unlike transforms3d which uses w, x, y, z.
  • Can be installed as a ROS binary package with apt on ROS 2 distributions.

Robotheca's summary of the project's documents, not the creator's words.

Robots on Robotheca
Used by Arduinobot and Bumperbot.
Licence
BSD-3-Clause. Commercial use: Yes. Where it was read
Install
In the creator's words: The project's README (opens in a new tab)
Maintenance
Active, last commit on 26 Oct 2026.

Works with

2 robots on Robotheca

The robots on Robotheca that use it or can run it, each with how the link was found.

Use it

How to install it, in the creator's words: The project's README (opens in a new tab)

Robotheca doesn't review code. Read it before running it.

Files and versions

Facts read at commit ef0374d

Robotheca read the repository at two versions: the summary at 457aa9b and the facts and the README at ef0374d (read on 29 Nov 2026).

Robotheca never hosts the code: each link goes to the creator's own page.

The README

The creator's own README, copied as written: README.md by @DLu, at commit ef0374d, under BSD-3-Clause (opens in a new tab). The original on GitHub (opens in a new tab).

Read the README here

tf_transformations

Context

In ROS 1, the TF library provided the helpful transformations.py (opens in a new tab) module for doing various rotation-based conversions.

Quoting from the ROS wiki page (opens in a new tab)

The tf package also includes the popular transformations.py module. TransformerROS uses transformations.py to perform conversions between quaternions and matrices. transformations.py does has[sic] useful conversion on numpy matrices; it can convert between transformations as Euler angles, quaternions, and matrices.

Since TF was supported in all distros of ROS 1, the library was widely used for all sorts of angular conversions in rospy code.

However, ROS 2 only supports TF2 (opens in a new tab) (not to be confused with TF2 (opens in a new tab)) and TF2 does not have an equivalent library.

Quoting from TF (Tully Foote) himself on ROS Answers (opens in a new tab),

tf.transformations is a fork of https://github.com/cgohlke/transformations/ (opens in a new tab). This package has been deprecated "Transformations.py is no longer actively developed and has a few known issues and numerical instabilities."

The recommended alternative is a package called transforms3d (opens in a new tab). This was originally only available via pip (in ROS 2 Galactic and older) but is now available via apt and other package managers in the rosdistro (opens in a new tab).

However, using that library has a few obstacles that make porting ROS 1 code to ROS 2 difficult.

  1. The API is different. The new API has more consistent naming, but even then, it is not a one-to-one translation. for example, tf.transformations.quaternion_from_euler could be replaced with transforms3d.euler.euler2quat, but tf returns the quaternion with the ordering x, y, z, w and transforms3d returns w, x, y, z.
  2. Not all of the functions have been migrated. As noted in the transforms3d Refactoring Plan (opens in a new tab), some of the functions are still in the "to integrate" pile.
Migration

If you're here, its likely because you want to migrate some code easily. You have two options:

  1. Use transforms3d by adding a dependency on python3-transforms3d in your package.xml and noting differences in API discussed above.
  2. Use this library tf_transformations.

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

Note that ROS 1 uses tf DOT transformations and ROS 2 uses tf UNDERSCORE transformations.

You also need to add a dependency on the tf_transformations in your package.xml

Installation

This package is available in full as a ROS binary, which you can install via

sudo apt install ros-$ROSDISTRO-tf-transformations
Implementation

Wherever possible, this library uses transforms3d to do the math for each of the functions. For functions that are still on the Refactoring Plan, the original implementation is left in place. It is not ideal to have to maintain the math for those functions, given the complexity of the geometry at hand, and in the future, effort should be made to fix the problems upstream and replace the implementations in this package with the upstream versions.

However, the original transformations.py library was remarkably stable. There have only been two commits (opens in a new tab) in its entire Git history (the initial commit and porting to Python3, which was a one line cosmetic change). Therefore, the hope is that this package will not need too much maintenance to correct problems.

Special Thanks

This package rests on the shoulders of giants, namely the OG author Christoph Gohlke (opens in a new tab) [github] (opens in a new tab) and Matthew Brett (opens in a new tab).

Robotheca lists software as a reference: nothing is hosted or run here, and every fact links to where it was read.