timor.utilities.spatial
Attributes
Functions
|
Inverse to rot_mat2axis_angle. |
|
Rotates a 3x1 vector by a given axis-angle representation. |
|
Takes a (3,) array in cartesian coordinates [x, y, z] and returns the according cylindrical coordinates [r, phi, z]. |
|
Takes a (3,) array in cartesian coordinates [x, y, z] and returns the according spherical coordinates. |
Deep copy of a hppfcl collision object |
|
Inverse to cartesian2cylindrical |
|
|
Transform extended dh parameters into a homogeneous transformation matrix |
|
Wrapper for the scipy euler method |
|
Returns all geometry objects where porent frame is frame_id |
|
Returns a transformation matrix for translation, then rotation |
Efficiently inverses a homogeneous transformation |
|
|
Inverse to euler2mat |
|
Returns a random 3x3 rotation matrix. |
|
Returns the 2D rotation matrix for an angle in radian. |
|
Returns a transformation rotation matrix for a rotation of a vector around the x-axis |
|
Returns a transformation rotation matrix for a rotation of a vector around the y-axis |
|
Returns a transformation rotation matrix for a rotation of a vector around the z-axis |
|
Takes a rotation matrix and returns the corresponding axis-angle representation |
|
Maps angles to an interval 2pi-agnostically. |
|
Returns the skew symmetric matrix of a 3D vector |
|
Inverse to cartesian2spherical |
Module Contents
- timor.utilities.spatial.NO_ROTATION
- timor.utilities.spatial.NO_TRANSLATION
- timor.utilities.spatial.axis_angle2rot_mat(axis_angle)
Inverse to rot_mat2axis_angle.
- Parameters:
axis_angle (numpy.ndarray)
- Return type:
- timor.utilities.spatial.axis_angle_rotation(vec, axis_angle)
Rotates a 3x1 vector by a given axis-angle representation.
Equivalent to spatial.axis_angle2rot_mat(axis_angle) @ vec, but computationally more efficient. :param vec: The vector to be rotated :param axis_angle: The axis-angle representation of the rotation, either 4x1 or 3x1 array :source: https://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation
- Parameters:
vec (numpy.ndarray)
axis_angle (numpy.ndarray)
- Return type:
- timor.utilities.spatial.cartesian2cylindrical(cart)
Takes a (3,) array in cartesian coordinates [x, y, z] and returns the according cylindrical coordinates [r, phi, z].
- Source:
- Parameters:
cart (numpy.ndarray)
- Return type:
- timor.utilities.spatial.cartesian2spherical(cart)
Takes a (3,) array in cartesian coordinates [x, y, z] and returns the according spherical coordinates.
Convention: [r, theta, phi]; r, theta, phi ~ radial, azimuthal, polar. :source: https://en.wikipedia.org/wiki/Spherical_coordinate_system
- Parameters:
cart (numpy.ndarray)
- Return type:
- timor.utilities.spatial.clone_collision_object(co)
Deep copy of a hppfcl collision object
- Parameters:
co (hppfcl.CollisionObject)
- Return type:
hppfcl.CollisionObject
- timor.utilities.spatial.cylindrical2cartesian(cyl)
Inverse to cartesian2cylindrical
- Parameters:
cyl (numpy.ndarray)
- Return type:
- timor.utilities.spatial.dh_extended_to_homogeneous(a=0, alpha=0, n=0, p=0, delta=0)
Transform extended dh parameters into a homogeneous transformation matrix
Describes a transformation similar to dh parameters (from Althoff et al., Sci. Robotics, 2019, Fig. 2) More precisely the transformation from a module input frame to the joint
- timor.utilities.spatial.euler2mat(rotation, seq)
Wrapper for the scipy euler method
- timor.utilities.spatial.frame2geom(frame_id, geom_model)
Returns all geometry objects where porent frame is frame_id
- Parameters:
frame_id (int)
geom_model (pinocchio.GeometryModel)
- timor.utilities.spatial.homogeneous(translation=NO_TRANSLATION, rotation=NO_ROTATION)
Returns a transformation matrix for translation, then rotation
- Parameters:
- Returns:
- Return type:
- timor.utilities.spatial.inv_homogeneous(T)
Efficiently inverses a homogeneous transformation
- Parameters:
T (numpy.ndarray)
- Return type:
- timor.utilities.spatial.mat2euler(R, seq='xyz')
Inverse to euler2mat
- Parameters:
R (numpy.ndarray) – A 3x3 rotation matrix
seq (str) – Any ordering of {xyz}[intrinsic] or {XYZ}[extrinsic] axes. Defaults to roll-pitch-yaw
- Returns:
The rotations around the axes specified in seq that lead to R
- Return type:
- timor.utilities.spatial.random_rotation(rng=None)
Returns a random 3x3 rotation matrix.
- Parameters:
rng (Optional[numpy.random.Generator])
- Return type:
- timor.utilities.spatial.rot2D(angle)
Returns the 2D rotation matrix for an angle in radian.
- Parameters:
angle (float) – Angel in radian
- Returns:
2D rotation
- Return type:
- timor.utilities.spatial.rotX(alpha)
Returns a transformation rotation matrix for a rotation of a vector around the x-axis
- Parameters:
alpha (float)
- Return type:
- timor.utilities.spatial.rotY(beta)
Returns a transformation rotation matrix for a rotation of a vector around the y-axis
- Parameters:
beta (float)
- Return type:
- timor.utilities.spatial.rotZ(gamma)
Returns a transformation rotation matrix for a rotation of a vector around the z-axis
- Parameters:
gamma (float)
- Return type:
- timor.utilities.spatial.rot_mat2axis_angle(rot_mat)
Takes a rotation matrix and returns the corresponding axis-angle representation
- Parameters:
rot_mat (numpy.ndarray) – 3x3 rotation matrix
- Returns:
4x1 array of axis-angle representation (n_x, n_y, n_z, theta_R), where n_x, n_y, n_z ~ unit vector and \(\theta_R\) ~ rotation angle \(\in [0, \pi]\)
- Return type:
- timor.utilities.spatial.rotation_in_bounds(rot, bounds)
Maps angles to an interval 2pi-agnostically.
Takes an array of rotations in radian and maps them to bounds aka limits if possible by adding/subtracting multiples of 2 pi. If not possible, will return the original input.
- Parameters:
rot (numpy.ndarray) – A 1xn array of rotations, given in radian.
bounds (numpy.ndarray) – A 2xn array of limits, lower limits in first, upper limits in second row of the array. Every column in bounds corresponds to a column in rot.
- Returns:
A variant of rot, offset by multiples of 2pi to fit within bounds. If that is not possible, returns rot.
- Return type:
- timor.utilities.spatial.skew(vec3)
Returns the skew symmetric matrix of a 3D vector
- Parameters:
vec3 (numpy.ndarray)
- Return type:
- timor.utilities.spatial.spherical2cartesian(spher)
Inverse to cartesian2spherical
- Parameters:
spher (numpy.ndarray)
- Return type: