{ } Raw JSON

bundles / scipy 1.18.0 / scipy / spatial / transform / _rigid_transform / RigidTransform / from_exp_coords

staticmethod

scipy.spatial.transform._rigid_transform:RigidTransform.from_exp_coords

source: /scipy/spatial/transform/_rigid_transform.py:757

Signature

staticmethoddef from_exp_coords(exp_coords: ArrayLike) → RigidTransform

Summary

Initialize from exponential coordinates of transform.

Extended Summary

This implements the exponential map that converts 6-dimensional real vectors to SE(3).

An exponential coordinate vector consists of 6 elements [rx, ry, rz, vx, vy, vz]. The first 3 encode rotation (and form a rotation vector used in Rotation.from_rotvec) and the last 3 encode translation (and form a translation vector for pure translations). The exponential mapping can be expressed as matrix exponential T = exp(tau), where T is a 4x4 matrix representing a rigid transform and tau is a 4x4 matrix formed from the elements of an exponential coordinate vector

tau = [  0 -rz  ry vx]
      [ rz   0 -rx vy]
      [-ry  rx   0 vz]
      [  0   0   0  1]

Parameters

exp_coords : array_like, shape (..., 6)

Exponential coordinate vectors. Each exp_coords[..., :] represents a 6D exponential coordinate vector with the expected order of components [rx, ry, rz, vx, vy, vz]. The first 3 components encode rotation and the last 3 encode translation.

Returns

transform : `RigidTransform` instance

Rigid transform objects with the same leading dimensions as the input.

Examples

from scipy.spatial.transform import RigidTransform as Tf
import numpy as np
✓
Creating from a single 6d vector of exponential coordinates:
tf = Tf.from_exp_coords([
    -2.01041204, -0.52983629, 0.65773501,
    0.10386614, 0.05855009, 0.54959179])
✓
tf.as_matrix()
✗
array([[ 0.76407,  0.10505, -0.63653, -0.1021 ],
       [ 0.59956, -0.47987,  0.6405 ,  0.40159],
       [-0.23817, -0.87103, -0.42964,  0.19638],
       [ 0.     ,  0.     ,  0.     ,  1.     ]])
tf.single
✓
True
A vector of zeros represents the identity transform:
tf = Tf.from_exp_coords(np.zeros(6))
tf.as_matrix()
✓
array([[1., 0., 0., 0.],
       [0., 1., 0., 0.],
       [0., 0., 1., 0.],
       [0., 0., 0., 1.]])
The last three numbers encode translation. If the first three numbers are zero, the last three components can be interpreted as the translation:
tf_trans = Tf.from_exp_coords([0, 0, 0, 4.3, -2, 3.4])
✓
tf_trans.translation
✗
array([ 4.3, -2. ,  3.4])
The first three numbers encode rotation as a rotation vector:
tf_rot = Tf.from_exp_coords([0.5, 0.3, 0.1, 0, 0, 0])
tf_rot.rotation.as_rotvec()
✓
array([0.5, 0.3, 0.1])
Combining translation and rotation preserves the rotation vector, but changes the last three components as they encode translation and rotation:
(tf_trans * tf_rot).as_exp_coords()
✗
array([ 0.5    ,  0.3    ,  0.1    ,  3.64306, -1.2588 ,  4.46109])

Aliases

  • scipy.spatial.transform.RigidTransform.from_exp_coords