Manage n-dimensional coordinate transformations via directed graphs.

skbot.transform allows you to change the representation of a vector from one coordinate system to another, i.e., it transforms the basis of the vector. Contrary to similar libraries, this is not limited to 3D or affine transformations, but can transform in N dimensions and between different dimensions, too. Additionally, you can create chains - more precisely directed graphs - of transformations between different frames, which allows you to express quite complicated transformations.

If you come from a robotics background, this module is analogous to ROS tf2, but works in (and between) n-dimensions. This means it naturally includes projections, e.g. world space to pixel space, and it allows you to use more esoteric transformations like spherical coordinates, too.


>>> import skbot.transform as tf
>>> import numpy as np

Forward kinematics on a 1 DoF robot arm in 2D

>>> # setup of the arm
>>> link = tf.Translation((1, 0))
>>> joint = tf.Rotation((1, 0), (0, 1))
>>> tool_frame = tf.Frame(2)
>>> joint_frame = link(tool_frame)
>>> world = joint(joint_frame)
>>> joint.angle = 0
>>> # FK of initial position
>>> tool_pos = tool_frame.transform((0, 0), to_frame=world)
>>> assert np.allclose(tool_pos, (1, 0))
>>> # Set new joint angle and compute new FK
>>> joint.angle = np.pi / 2
>>> tool_pos = tool_frame.transform((0, 0), to_frame=world)
>>> assert np.allclose(tool_pos, (0, 1))

Base Elements

Frame(ndim, *[, name])

Representation of a coordinate system.

Link(parent_dim, child_dim)

A directional relationship between two Frames

Available Transformations

nD Links

AffineSpace(ndim, *[, axis])

Transform to affine space

Translation(direction, *[, amount, axis])

Translation in N-D.

Rotation(u, v, *[, axis])

Planar rotation in N-D.

PerspectiveProjection(directions, amounts, *)

Perspective projection in N-D.

3D Links

EulerRotation(sequence, angles, *[, ...])

Rotation based on Euler angles in 3D.

QuaternionRotation(quaternion, *[, ...])

Rotation based on Quaternions in 3D.

RotvecRotation(rotvec, *[, angle, degrees, axis])

Rotation based on rotation vector in 3D.

FrustumProjection(hfov, image_shape)

Frustum based intrinsic camera transformation.

RotationalJoint(rotvec, *[, angle, degrees, ...])

Rotation with constraints in 3D.

PrismaticJoint(direction, *[, upper_limit, ...])

Translation with constraints in 3D.

Other Links

CustomLink(parent_dim, child_dim, transformation)

A link representing a custom transformation.


A link representing a sequence of other links


Inverse of an existing Link.