Publication
pytransform3d: 3D Transformations for Python
Alexander Fabisch
In: Journal of Open Source Software (JOSS), Journal of Open Source Software, Vol. 4, No. 33, Page 1159, 4(33), 1159, The Open Journal, 1/2019.
Abstract
pytransform3d is a Python library for transformations in three dimensions. Heterogenous
software systems that consist of proprietary and open source software are often combined
when we work with transformations. For example, suppose you want to transfer a trajectory
demonstrated by a human to a robot. The human trajectory could be measured from
an RGB-D camera, fused with inertial measurement units that are attached to the human,
and then translated to joint angles by inverse kinematics. That involves at least three
different software systems that might all use different conventions for transformations.
Sometimes even one software uses more than one convention. The following aspects are
of crucial importance to glue and debug transformations in systems with heterogenous
and often incompatible software:
• Compatibility: Compatibility between heterogenous softwares is a difficult topic. It
might involve, for example, communicating between proprietary and open source
software or different languages.
• Conventions: Lots of different conventions are used for transformations in three
dimensions. These have to be determined or specified.
• Conversions: We need conversions between these conventions to communicate transformations
between different systems.
• Visualization: Finally, transformations should be visually verified and that should
be as easy as possible.
pytransform3d assists in solving these issues. Its documentation clearly states all of the
used conventions, it makes conversions between rotation and transformation conventions
as easy as possible, it is tightly coupled with Matplotlib to quickly visualize (or animate)
transformations and it is written in Python with few dependencies. Python is a
widely adopted language. It is used in many domains and supports a wide spectrum of
communication to other software.
The library focuses on readability and debugging, not on computational efficiency. If you
want to have an efficient implementation of some function from the library you can easily
extract the relevant code and implement it more efficiently in a language of your choice.
The library integrates well with the scientific Python ecosystem (G. Varoquaux, Gouillart,
& Vahtras, 2018) with its core libraries Numpy, Scipy and Matplotlib. We rely on Numpy
(Walt, Colbert, & Varoquaux, 2011) for linear algebra and on Matplotlib (Hunter, 2007)
to offer plotting functionalities. Scipy (Jones, Oliphant, Peterson, & others, 2001–2001--)
is used if you want to automatically compute new transformations from a graph of existing
transformations.
More advanced features of the library are the TransformManager which manages complex
chains of transformations, the TransformEditor which allows to modify transformations graphically (additionally requires PyQt4), and the UrdfTransformManager which is able
to load transformations from the Unified Robot Description Format (URDF) (additionally
requires beautifulsoup4).
One of the strengths of pytransform3d in comparison to most other libraries is its rigorous
approach to testing. Unit tests have 100% branch coverage for code that is not related to
visualization, there is more test code than library code, there are additional examples, and
continuous integration runs with Python 2.7, 3.4, 3.5, and 3.6. The maintainer ensures
that this level of quality will not be sacrificed for new features.
There are several similar software packages. ROS tf2 (Foote, Marder-Eppstein, Meeussen,
& others, 2009–2009--) is probably the most widely used of them. It offers functionality
that is similar to the TransformManager of pytransform3d, but also considers temporal
aspects of transformations. It also provides conversions between various conventions and
visualization can be done with ROS’ rviz package. EnviRe (Carrió et al., 2016) provides
similar functionality. However, both libraries come with a number of dependencies and
require complex build tools. Hence, it is not easy to set them up quickly in a new
environment with minimum impact to the system, while pytransform3d is a lightweight
library that only requires the basic scientific Python software stack that runs on any
machine that supports CPython. There are other lightweight Python libraries that offer
transformations and conversions between conventions, for example, transforms3d (Brett
& Gohlke, 2009–2009--) and rowan (Ramasubramani & Glotzer, 2018), but these do not
directly support visualization.
Projects
- BesMan - BesMan - Behaviours for Mobile Manipulation
- COROMA - Cognitively enhanced robot for flexible manufacturing of metal and composite parts
- InFUSE - Common Data Fusion Framework for Space Robotics