• Stars
    star
    534
  • Rank 83,095 (Top 2 %)
  • Language
    Python
  • License
    Other
  • Created over 7 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

3D transformations for Python.

CircleCI codecov Paper DOI Release DOI

pytransform3d

A Python library for transformations in three dimensions.

pytransform3d offers...

  • operations like concatenation and inversion for most common representations of rotation (orientation) and translation (position)
  • conversions between those representations
  • clear documentation of transformation conventions
  • tight coupling with matplotlib to quickly visualize (or animate) transformations
  • the TransformManager which manages complex chains of transformations (with export to graph visualization as PNG, additionally requires pydot)
  • the TransformEditor which allows to modify transformations graphically (additionally requires PyQt4/5)
  • the UrdfTransformManager which is able to load transformations from URDF files (additionally requires lxml)
  • a matplotlib-like interface to Open3D's visualizer to display and animate geometries and transformations (additionally requires Open3D)

pytransform3d is used in various domains, for example:

  • specifying motions of a robot
  • learning robot movements from human demonstration
  • sensor fusion for human pose estimation
  • collision detection for robots

The API documentation can be found here.

Installation

Use pip to install the package from PyPI:

pip install pytransform3d[all]

or conda:

conda install -c conda-forge pytransform3d

Take a look at the installation instructions in the documentation for more details.

Gallery

The following plots and visualizations have been generated with pytransform3d. The code for most examples can be found in the documentation.

Left: Nao robot with URDF from Bullet3. Right: Kuka iiwa. The animation is based on pytransform3d's visualization interface to Open3D.

Visualizations based on Open3D.

Various plots based on Matplotlib.

Transformation editor based on Qt.

Example

This is just one simple example. You can find more examples in the subfolder examples/.

import numpy as np
import matplotlib.pyplot as plt
from pytransform3d import rotations as pr
from pytransform3d import transformations as pt
from pytransform3d.transform_manager import TransformManager


rng = np.random.default_rng(0)

ee2robot = pt.transform_from_pq(
    np.hstack((np.array([0.4, -0.3, 0.5]),
               pr.random_quaternion(rng))))
cam2robot = pt.transform_from_pq(
    np.hstack((np.array([0.0, 0.0, 0.8]), pr.q_id)))
object2cam = pt.transform_from(
    pr.active_matrix_from_intrinsic_euler_xyz(np.array([0.0, 0.0, -0.5])),
    np.array([0.5, 0.1, 0.1]))

tm = TransformManager()
tm.add_transform("end-effector", "robot", ee2robot)
tm.add_transform("camera", "robot", cam2robot)
tm.add_transform("object", "camera", object2cam)

ee2object = tm.get_transform("end-effector", "object")

ax = tm.plot_frames_in("robot", s=0.1)
ax.set_xlim((-0.25, 0.75))
ax.set_ylim((-0.5, 0.5))
ax.set_zlim((0.0, 1.0))
plt.show()

output

Documentation

The API documentation can be found here.

The documentation can be found in the directory doc. To build the documentation, run e.g. (on linux):

cd doc
make html

The HTML documentation is now located at doc/build/html/index.html. You need the following packages to build the documentation:

pip install numpydoc sphinx sphinx-gallery sphinx-bootstrap-theme

Tests

You can use pytest to run the tests of this project in the root directory:

pytest

A coverage report will be located at htmlcov/index.html. Note that you have to install pytest to run the tests and pytest-cov to obtain the code coverage report.

Contributing

If you wish to report bugs, please use the issue tracker at Github. If you would like to contribute to pytransform3d, just open an issue or a pull request. The target branch for pull requests is the develop branch. The development branch will be merged to master for new releases. If you have questions about the software, you should ask them in the discussion section.

The recommended workflow to add a new feature, add documentation, or fix a bug is the following:

  • Push your changes to a branch (e.g. feature/x, doc/y, or fix/z) of your fork of the pytransform3d repository.
  • Open a pull request to the latest development branch. There is usually an open merge request from the latest development branch to the main branch.
  • When the latest development branch is merged to the main branch, a new release will be made.

Note that there is a checklist for new features.

It is forbidden to directly push to the main branch (master). Each new version has its own development branch from which a pull request will be opened to the main branch. Only the maintainer of the software is allowed to merge a development branch to the main branch.

License

The library is distributed under the 3-Clause BSD license.

Citation

If you use pytransform3d for a scientific publication, I would appreciate citation of the following paper:

Fabisch, (2019). pytransform3d: 3D Transformations for Python. Journal of Open Source Software, 4(33), 1159, Paper DOI

Bibtex entry:

@article{Fabisch2019,
  doi = {10.21105/joss.01159},
  url = {https://doi.org/10.21105/joss.01159},
  year = {2019},
  publisher = {The Open Journal},
  volume = {4},
  number = {33},
  pages = {1159},
  author = {Alexander Fabisch},
  title = {pytransform3d: 3D Transformations for Python},
  journal = {Journal of Open Source Software}
}

More Repositories

1

phobos

An add-on for Blender allowing to create URDF, SDF and SMURF robot models in a WYSIWYG environment.
Python
706
star
2

mir_robot

ROS support for the MiR Robots. This is a community project to use the MiR Robots with ROS. It is not affiliated with Mobile Industrial Robots.
Python
173
star
3

movement_primitives

Dynamical movement primitives (DMPs), probabilistic movement primitives (ProMPs), and spatially coupled bimanual DMPs for imitation learning.
Python
117
star
4

hand_embodiment

Embodiment mapping for robotic hands from human hand motions.
Python
27
star
5

slam3d

The SLAM3D library is a standalone framework for multimodal graph based Simultaneous Localization and Mapping.
C++
20
star
6

deformable_gym

A collection of RL gymnasium environments for learning to grasp 3D deformable objects.
Python
20
star
7

NovelWrist

Julia package for the kinematic analysis of the 2SPU+2RSU+1U wrist mechanism.
Julia
6
star
8

robot_remote_control

A library for framework independent remote control of semi-autonomous robots. The library is in active development and might change a lot.
C++
6
star
9

docker_image_development

Scritps and Dockerfiles to support docker-based, 3D accelerated development and release of docker images
Shell
6
star
10

CoBaIR

Python
4
star
11

xtypes

C++
3
star
12

xtypes_generator

C++
3
star
13

slam3d-ros

C++
3
star
14

vMCI_segmentation

Python
2
star
15

bagel_gui

A GUI to view and edit Bagel graphs.
C++
2
star
16

c_bagel

C implementation for the execution of Bagel graphs.
C
2
star
17

bagel_magic

Wizard to manage Bagel models associated with robot modes of MARS simulation.
Python
2
star
18

xdbi

C++
2
star
19

dfki-ric.github.io

List of open source software
HTML
2
star
20

BagelMARS

A MARS plugin that can load Bagel graphs into MARS and provides the graph in- and outputs to DataBroker.
C++
1
star
21

bagel_wiki

This repository includes the documentation for the Bagel packages.
Shell
1
star
22

gh-landing-page-template

Template for paper descriptions
HTML
1
star
23

cpp_bagel_wrapper

C++ library to load and execute Bagel graphs via the c_bagel package
C++
1
star
24

slam3d-orogen

C++
1
star
25

bagel_package_set

Definition of Bagel packages
1
star
26

ugv_nav4d

C++
1
star