API Documentation

This is the detailed documentation of all public classes and functions. You can also search for specific modules, classes, or functions in the Index.

pytransform3d.rotations

Rotations in three dimensions - SO(3).

See SO(3): 3D Rotations for more information.

Input Validation Functions

check_matrix(R[, tolerance, strict_check])

Input validation of a rotation matrix.

check_skew_symmetric_matrix(V[, tolerance, ...])

Input validation of a skew-symmetric matrix.

check_axis_angle(a)

Input validation of axis-angle representation.

check_compact_axis_angle(a)

Input validation of compact axis-angle representation.

check_quaternion(q[, unit])

Input validation of quaternion representation.

check_quaternions(Q[, unit])

Input validation of quaternion representation.

check_rotor(rotor)

Input validation of rotor.

check_mrp(mrp)

Input validation of modified Rodrigues parameters.

Conversions

Conversions to Rotation Matrix

See also Euler Angles for conversions from and to Euler angles that have been omitted here for the sake of brevity.

passive_matrix_from_angle(basis, angle)

Compute passive rotation matrix from rotation about basis vector.

active_matrix_from_angle(basis, angle)

Compute active rotation matrix from rotation about basis vector.

matrix_from_euler(e, i, j, k, extrinsic)

General method to compute active rotation matrix from any Euler angles.

matrix_from_two_vectors(a, b)

Compute rotation matrix from two vectors.

matrix_from_axis_angle(a)

Compute rotation matrix from axis-angle.

matrix_from_compact_axis_angle(a)

Compute rotation matrix from compact axis-angle.

matrix_from_quaternion(q)

Compute rotation matrix from quaternion.

matrix_from_rotor(rotor)

Compute rotation matrix from rotor.

Conversions to Axis-Angle

axis_angle_from_matrix(R[, strict_check, check])

Compute axis-angle from rotation matrix.

axis_angle_from_quaternion(q)

Compute axis-angle from quaternion.

axis_angle_from_compact_axis_angle(a)

Compute axis-angle from compact axis-angle representation.

compact_axis_angle(a)

Compute 3-dimensional axis-angle from a 4-dimensional one.

compact_axis_angle_from_matrix(R[, check])

Compute compact axis-angle from rotation matrix.

compact_axis_angle_from_quaternion(q)

Compute compact axis-angle from quaternion (logarithmic map).

Conversions to Quaternion

quaternion_from_angle(basis, angle)

Compute quaternion from rotation about basis vector.

quaternion_from_matrix(R[, strict_check])

Compute quaternion from rotation matrix.

quaternion_from_axis_angle(a)

Compute quaternion from axis-angle.

quaternion_from_compact_axis_angle(a)

Compute quaternion from compact axis-angle (exponential map).

quaternion_from_euler(e, i, j, k, extrinsic)

General conversion to quaternion from any Euler angles.

quaternion_from_mrp(mrp)

Compute quaternion from modified Rodrigues parameters.

quaternion_xyzw_from_wxyz(q_wxyz)

Converts from w, x, y, z to x, y, z, w convention.

quaternion_wxyz_from_xyzw(q_xyzw)

Converts from x, y, z, w to w, x, y, z convention.

Conversions to Rotor

rotor_from_two_directions(v_from, v_to)

Construct the rotor that rotates one vector to another.

rotor_from_plane_angle(B, angle)

Compute rotor from plane bivector and angle.

Conversions to Modified Rodrigues Parameters

mrp_from_quaternion(q)

Compute modified Rodrigues parameters from quaternion.

Quaternion and Axis-Angle Operations

axis_angle_from_two_directions(a, b)

Compute axis-angle representation from two direction vectors.

axis_angle_slerp(start, end, t)

Spherical linear interpolation.

concatenate_quaternions(q1, q2)

Concatenate two quaternions.

q_prod_vector(q, v)

Apply rotation represented by a quaternion to a vector.

q_conj(q)

Conjugate of quaternion.

pick_closest_quaternion(quaternion, ...)

Resolve quaternion ambiguity and pick the closest one to the target.

quaternion_slerp(start, end, t[, shortest_path])

Spherical linear interpolation.

quaternion_dist(q1, q2)

Compute distance between two quaternions.

quaternion_diff(q1, q2)

Compute the rotation in angle-axis format that rotates q2 into q1.

quaternion_gradient(Q[, dt])

Time-derivatives of a sequence of quaternions.

quaternion_integrate(Qd[, q0, dt])

Integrate angular velocities to quaternions.

Rotors

wedge(a, b)

Outer product of two vectors (also exterior or wedge product).

plane_normal_from_bivector(B)

Convert bivector to normal vector of a plane.

geometric_product(a, b)

Geometric product of two vectors.

concatenate_rotors(rotor1, rotor2)

Concatenate rotors.

rotor_reverse(rotor)

Invert rotor.

rotor_apply(rotor, v)

Apply rotor to vector.

rotor_slerp(start, end, t[, shortest_path])

Spherical linear interpolation.

Plotting

plot_basis([ax, R, p, s, ax_s, strict_check])

Plot basis of a rotation matrix.

plot_axis_angle([ax, a, p, s, ax_s])

Plot rotation axis and angle.

plot_bivector([ax, a, b, ax_s])

Plot bivector from wedge product of two vectors a and b.

Testing

assert_axis_angle_equal(a1, a2, *args, **kwargs)

Raise an assertion if two axis-angle are not approximately equal.

assert_compact_axis_angle_equal(a1, a2, ...)

Raise an assertion if two axis-angle are not approximately equal.

assert_quaternion_equal(q1, q2, *args, **kwargs)

Raise an assertion if two quaternions are not approximately equal.

assert_rotation_matrix(R, *args, **kwargs)

Raise an assertion if a matrix is not a rotation matrix.

Normalization

norm_vector(v)

Normalize vector.

norm_matrix(R)

Orthonormalize rotation matrix.

norm_angle(a)

Normalize angle to (-pi, pi].

norm_axis_angle(a)

Normalize axis-angle representation.

norm_compact_axis_angle(a)

Normalize compact axis-angle representation.

Random Sampling

random_vector([rng, n])

Generate an nd vector with normally distributed components.

random_axis_angle([rng])

Generate random axis-angle.

random_compact_axis_angle([rng])

Generate random compact axis-angle.

random_quaternion([rng])

Generate random quaternion.

Jacobians

left_jacobian_SO3(omega)

Left Jacobian of SO(3) at theta (angle of rotation).

left_jacobian_SO3_series(omega, n_terms)

Left Jacobian of SO(3) at theta from Taylor series.

left_jacobian_SO3_inv(omega)

Inverse left Jacobian of SO(3) at theta (angle of rotation).

left_jacobian_SO3_inv_series(omega, n_terms)

Inverse left Jacobian of SO(3) at theta from Taylor series.

Utility Functions

perpendicular_to_vectors(a, b)

Compute perpendicular vector to two other vectors.

angle_between_vectors(a, b[, fast])

Compute angle between two vectors.

vector_projection(a, b)

Orthogonal projection of vector a on vector b.

plane_basis_from_normal(plane_normal)

Compute two basis vectors of a plane from the plane's normal vector.

cross_product_matrix(v)

Generate the cross-product matrix of a vector.

Deprecated Functions

quaternion_from_extrinsic_euler_xyz(e)

Compute quaternion from extrinsic xyz Euler angles.

pytransform3d.transformations

Transformations in three dimensions - SE(3).

See SE(3): 3D Transformations for more information.

Input Validation Functions

check_transform(A2B[, strict_check])

Input validation of transform.

check_pq(pq)

Input validation for position and orientation quaternion.

check_screw_parameters(q, s_axis, h)

Input validation of screw parameters.

check_screw_axis(screw_axis)

Input validation of screw axis.

check_exponential_coordinates(Stheta)

Input validation for exponential coordinates of transformation.

check_screw_matrix(screw_matrix[, ...])

Input validation for screw matrix.

check_transform_log(transform_log[, ...])

Input validation for logarithm of transformation.

check_dual_quaternion(dq[, unit])

Input validation of dual quaternion representation.

Conversions

Conversions to Transformation Matrix

transform_from(R, p[, strict_check])

Make transformation from rotation matrix and translation.

translate_transform(A2B, p[, strict_check, ...])

Sets the translation of a transform.

rotate_transform(A2B, R[, strict_check, check])

Sets the rotation of a transform.

transform_from_pq(pq)

Compute transformation matrix from position and quaternion.

transform_from_exponential_coordinates(Stheta)

Compute transformation matrix from exponential coordinates.

transform_from_transform_log(transform_log)

Compute transformation from matrix logarithm of transformation.

transform_from_dual_quaternion(dq)

Compute transformation matrix from dual quaternion.

Conversions to Position and Quaternion

pq_from_transform(A2B[, strict_check])

Compute position and quaternion from transformation matrix.

pq_from_dual_quaternion(dq)

Compute position and quaternion from dual quaternion.

Conversions to Screw Parameters

screw_parameters_from_screw_axis(screw_axis)

Compute screw parameters from screw axis.

screw_parameters_from_dual_quaternion(dq)

Compute screw parameters from dual quaternion.

Conversions to Screw Axis

screw_axis_from_screw_parameters(q, s_axis, h)

Compute screw axis representation from screw parameters.

screw_axis_from_exponential_coordinates(Stheta)

Compute screw axis and theta from exponential coordinates.

screw_axis_from_screw_matrix(screw_matrix)

Compute screw axis from screw matrix.

Conversions to Exponential Coordinates

exponential_coordinates_from_transform(A2B)

Compute exponential coordinates from transformation matrix.

exponential_coordinates_from_screw_axis(...)

Compute exponential coordinates from screw axis and theta.

exponential_coordinates_from_transform_log(...)

Compute exponential coordinates from logarithm of transformation.

Conversions to Screw Matrix

screw_matrix_from_screw_axis(screw_axis)

Compute screw matrix from screw axis.

screw_matrix_from_transform_log(transform_log)

Compute screw matrix from logarithm of transformation.

Conversions to Matrix Logarithm

transform_log_from_exponential_coordinates(Stheta)

Compute matrix logarithm of transformation from exponential coordinates.

transform_log_from_screw_matrix(...)

Compute matrix logarithm of transformation from screw matrix and theta.

transform_log_from_transform(A2B[, strict_check])

Compute matrix logarithm of transformation from transformation.

Conversions to Dual Quaternions

dual_quaternion_from_transform(A2B)

Compute dual quaternion from transformation matrix.

dual_quaternion_from_pq(pq)

Compute dual quaternion from position and quaternion.

dual_quaternion_from_screw_parameters(q, ...)

Compute dual quaternion from screw parameters.

Apply Transformations

concat(A2B, B2C[, strict_check, check])

Concatenate transformations.

invert_transform(A2B[, strict_check, check])

Invert transform.

transform(A2B, PA[, strict_check])

Transform point or list of points or directions.

vector_to_point(v)

Convert 3D vector to position.

vectors_to_points(V)

Convert 3D vectors to positions.

vector_to_direction(v)

Convert 3D vector to direction.

vectors_to_directions(V)

Convert 3D vectors to directions.

scale_transform(A2B[, s_xr, s_yr, s_zr, ...])

Scale a transform from A to reference frame B.

adjoint_from_transform(A2B[, strict_check, ...])

Compute adjoint representation of a transformation matrix.

Position+Quaternion Operations

pq_slerp(start, end, t)

Spherical linear interpolation of position and quaternion.

Dual Quaternion Operations

dq_conj(dq)

Conjugate of dual quaternion.

dq_q_conj(dq)

Quaternion conjugate of dual quaternion.

concatenate_dual_quaternions(dq1, dq2)

Concatenate dual quaternions.

dq_prod_vector(dq, v)

Apply transform represented by a dual quaternion to a vector.

dual_quaternion_power(dq, t)

Compute power of unit dual quaternion with respect to scalar.

dual_quaternion_sclerp(start, end, t)

Screw linear interpolation (ScLERP) for dual quaternions.

Plotting

plot_transform([ax, A2B, s, ax_s, name, ...])

Plot transform.

plot_screw([ax, q, s_axis, h, theta, A2B, ...])

Plot transformation about and along screw axis.

Testing

assert_transform(A2B, *args, **kwargs)

Raise an assertion if the transform is not a homogeneous matrix.

assert_unit_dual_quaternion(dq, *args, **kwargs)

Raise an assertion if the dual quaternion does not have unit norm.

assert_unit_dual_quaternion_equal(dq1, dq2, ...)

Raise an assertion if unit dual quaternions are not approximately equal.

assert_screw_parameters_equal(q1, s_axis1, ...)

Raise an assertion if two sets of screw parameters are not similar.

Random Sampling

random_transform([rng, mean, cov])

Generate random transform.

random_screw_axis([rng])

Generate random screw axis.

random_exponential_coordinates([rng, cov])

Generate random exponential coordinates.

Normalization

norm_exponential_coordinates(Stheta)

Normalize exponential coordinates of transformation.

Jacobians

left_jacobian_SE3(Stheta)

Left Jacobian of SE(3).

left_jacobian_SE3_series(Stheta, n_terms)

Left Jacobian of SE(3) at theta from Taylor series.

left_jacobian_SE3_inv(Stheta)

Left inverse Jacobian of SE(3).

left_jacobian_SE3_inv_series(Stheta, n_terms)

Left inverse Jacobian of SE(3) at theta from Taylor series.

pytransform3d.batch_rotations

Batch operations on rotations in three dimensions - SO(3).

Conversions from this module operate on batches of orientations or rotations and can be orders of magnitude faster than a loop of individual conversions.

All functions operate on nd arrays, where the last dimension (vectors) or the last two dimensions (matrices) contain individual rotations.

Conversions

active_matrices_from_angles(basis, angles[, out])

Compute active rotation matrices from rotation about basis vectors.

active_matrices_from_intrinsic_euler_angles(...)

Compute active rotation matrices from intrinsic Euler angles.

active_matrices_from_extrinsic_euler_angles(...)

Compute active rotation matrices from extrinsic Euler angles.

matrices_from_compact_axis_angles([A, axes, ...])

Compute rotation matrices from compact axis-angle representations.

axis_angles_from_matrices(Rs[, traces, out])

Compute compact axis-angle representations from rotation matrices.

cross_product_matrices(V)

Generate the cross-product matrices of vectors.

matrices_from_quaternions(Q[, ...])

Compute rotation matrices from quaternions.

quaternions_from_matrices(Rs[, out])

Compute quaternions from rotation matrices.

batch_quaternion_wxyz_from_xyzw(Q_xyzw[, out])

Converts from x, y, z, w to w, x, y, z convention.

batch_quaternion_xyzw_from_wxyz(Q_wxyz[, out])

Converts from w, x, y, z to x, y, z, w convention.

Operations

batch_q_conj(Q)

Conjugate of quaternions.

batch_concatenate_quaternions(Q1, Q2[, out])

Concatenate two batches of quaternions.

quaternion_slerp_batch(start, end, t[, ...])

Spherical linear interpolation for a batch of steps.

smooth_quaternion_trajectory(Q[, ...])

Smooth quaternion trajectory.

Utility Functions

norm_vectors(V[, out])

Normalize vectors.

angles_between_vectors(A, B)

Compute angle between two vectors.

pytransform3d.trajectories

Trajectories in three dimensions - SE(3).

Conversions from this module operate on batches of poses or transformations and can be 400 to 1000 times faster than a loop of individual conversions.

Conversions

transforms_from_pqs(P[, normalize_quaternions])

Get sequence of homogeneous matrices from positions and quaternions.

transforms_from_exponential_coordinates(Sthetas)

Compute transformations from exponential coordinates.

transforms_from_dual_quaternions(dqs)

Get transformations from dual quaternions.

pqs_from_transforms(A2Bs)

Get sequence of positions and quaternions from homogeneous matrices.

pqs_from_dual_quaternions(dqs)

Get positions and quaternions from dual quaternions.

exponential_coordinates_from_transforms(A2Bs)

Compute exponential coordinates from transformations.

dual_quaternions_from_pqs(pqs)

Get dual quaternions from positions and quaternions.

Operations and Utility Functions

invert_transforms(A2Bs)

Invert transforms.

concat_one_to_many(A2B, B2Cs)

Concatenate transformation A2B with multiple transformations B2C.

concat_many_to_one(A2Bs, B2C)

Concatenate multiple transformations A2B with transformation B2C.

batch_dq_conj(dqs)

Conjugate of dual quaternions.

batch_concatenate_dual_quaternions(dqs1, dqs2)

Concatenate dual quaternions.

batch_dq_prod_vector(dqs, V)

Apply transforms represented by a dual quaternions to vectors.

plot_trajectory([ax, P, ...])

Plot pose trajectory.

mirror_screw_axis_direction(Sthetas)

Switch to the other representation of the same transformation.

pytransform3d.uncertainty

Operations related to uncertain transformations.

estimate_gaussian_transform_from_samples(samples)

Estimate Gaussian distribution over transformations from samples.

invert_uncertain_transform(mean, cov)

Invert uncertain transform.

concat_globally_uncertain_transforms(...)

Concatenate two independent globally uncertain transformations.

concat_locally_uncertain_transforms(...)

Concatenate two independent locally uncertain transformations.

pose_fusion(means, covs)

Fuse Gaussian distributions of multiple poses.

to_ellipsoid(mean, cov)

Compute error ellipsoid.

to_projected_ellipsoid(mean, cov[, factor, ...])

Compute projected error ellipsoid.

plot_projected_ellipsoid(ax, mean, cov[, ...])

Plots projected equiprobable ellipsoid in 3D.

pytransform3d.coordinates

Conversions between coordinate systems to represent positions.

cartesian_from_cylindrical(p)

Convert cylindrical coordinates to Cartesian coordinates.

cartesian_from_spherical(p)

Convert spherical coordinates to Cartesian coordinates.

cylindrical_from_cartesian(p)

Convert Cartesian coordinates to cylindrical coordinates.

cylindrical_from_spherical(p)

Convert spherical coordinates to cylindrical coordinates.

spherical_from_cartesian(p)

Convert Cartesian coordinates to spherical coordinates.

spherical_from_cylindrical(p)

Convert cylindrical coordinates to spherical coordinates.

pytransform3d.transform_manager

Manage complex chains of transformations.

See Managing Transformations for more information.

TransformGraphBase([strict_check, check])

Base class for all graphs of rigid transformations.

TransformManager([strict_check, check])

Manage transformations between frames.

TemporalTransformManager([strict_check, check])

Manage time-varying transformations.

TimeVaryingTransform()

Time-varying rigid transformation.

StaticTransform(A2B)

Transformation, which does not change over time.

NumpyTimeseriesTransform(time, pqs)

Transformation sequence, represented in a numpy array.

pytransform3d.editor

Modify transformations visually.

TransformEditor(transform_manager, base_frame)

GUI to edit transformations.

pytransform3d.urdf

Load transformations from URDF files.

See Managing Transformations for more information.

UrdfTransformManager([strict_check, check])

Transformation manager that can load URDF files.

Link()

Link from URDF file.

Joint()

Joint from URDF file.

Geometry(frame, mesh_path, package_dir, color)

Geometrical object.

Box(frame, mesh_path, package_dir, color)

Geometrical object: box.

Sphere(frame, mesh_path, package_dir, color)

Geometrical object: sphere.

Cylinder(frame, mesh_path, package_dir, color)

Geometrical object: cylinder.

Mesh(frame, mesh_path, package_dir, color)

Geometrical object: mesh.

parse_urdf(urdf_xml[, mesh_path, ...])

Parse information from URDF file.

initialize_urdf_transform_manager(tm, ...)

Initializes transform manager from previously parsed URDF data.

pytransform3d.camera

Transformations related to cameras.

See Camera for more information.

make_world_grid([n_lines, ...])

Generate grid in world coordinate frame.

make_world_line(p1, p2, n_points)

Generate line in world coordinate frame.

cam2sensor(P_cam, focal_length[, kappa])

Project points from 3D camera coordinate system to sensor plane.

sensor2img(P_sensor, sensor_size, image_size)

Project points from 2D sensor plane to image coordinate system.

world2image(P_world, cam2world, sensor_size, ...)

Project points from 3D world coordinate system to 2D image.

plot_camera([ax, M, cam2world, ...])

Plot camera in world coordinates.

pytransform3d.plot_utils

Utilities for plotting.

make_3d_axis(ax_s[, pos, unit, n_ticks])

Generate new 3D axis.

remove_frame(ax[, left, bottom, right, top])

Remove axis and scale bbox.

plot_vector([ax, start, direction, s, ...])

Plot Vector.

plot_length_variable([ax, start, end, name, ...])

Plot length with text at its center.

plot_box([ax, size, A2B, ax_s, wireframe, ...])

Plot box.

plot_sphere([ax, radius, p, ax_s, ...])

Plot sphere.

plot_spheres([ax, radius, p, ax_s, ...])

Plot multiple spheres.

plot_cylinder([ax, length, radius, ...])

Plot cylinder.

plot_mesh([ax, filename, A2B, s, ax_s, ...])

Plot mesh.

plot_ellipsoid([ax, radii, A2B, ax_s, ...])

Plot ellipsoid.

plot_capsule([ax, A2B, height, radius, ...])

Plot capsule.

plot_cone([ax, height, radius, A2B, ax_s, ...])

Plot cone.

Arrow3D(xs, ys, zs, *args, **kwargs)

A Matplotlib patch that represents an arrow in 3D.

Frame(A2B[, label, s])

A Matplotlib artist that displays a frame represented by its basis.

LabeledFrame(A2B[, label, s])

Displays a frame represented by its basis with axis labels.

Trajectory(H[, show_direction, n_frames, s])

A Matplotlib artist that displays a trajectory.

pytransform3d.visualizer

Optional 3D renderer based on Open3D’s visualizer.

figure([window_name, width, height, ...])

Create a new figure.

Figure([window_name, width, height, ...])

The top level container for all the plot elements.

Artist()

Abstract base class for objects that can be rendered.

Line3D(P[, c])

A line.

PointCollection3D(P[, s, c])

Collection of points.

Vector3D([start, direction, c])

A vector.

Frame(A2B[, label, s])

Coordinate frame.

Trajectory(H[, n_frames, s, c])

Trajectory of poses.

Sphere([radius, A2B, resolution, c])

Sphere.

Box([size, A2B, c])

Box.

Cylinder([length, radius, A2B, resolution, ...])

Cylinder.

Mesh(filename[, A2B, s, c, convex_hull])

Mesh.

Ellipsoid(radii[, A2B, resolution, c])

Ellipsoid.

Capsule([height, radius, A2B, resolution, c])

Capsule.

Cone([height, radius, A2B, resolution, c])

Cone.

Plane([normal, d, point_in_plane, s, c])

Plane.

Graph(tm, frame[, show_frames, ...])

Graph of connected frames.

Camera(M[, cam2world, ...])

Camera.