Pose#

class mplib.Pose#

Bases: pybind11_object

Pose stored as a unit quaternion and a position vector

This struct is intended to be used only for interfacing with Python. Internally, Pose is converted to and stored as Eigen::Isometry3 which is used by all computations.

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: mplib.pymp.Pose) -> None

Constructs a default Pose with p = (0,0,0) and q = (1,0,0,0)

  1. __init__(self: mplib.pymp.Pose, p: numpy.ndarray[numpy.float64[3, 1]] = array([0., 0., 0.]), q: numpy.ndarray[numpy.float64[4, 1]] = array([1., 0., 0., 0.])) -> None

Constructs a Pose with given position and quaternion

Parameters:
  • p – position, format: (x, y, z)

  • q – quaternion (can be unnormalized), format: (w, x, y, z)

  1. __init__(self: mplib.pymp.Pose, matrix: numpy.ndarray[numpy.float64[4, 4]]) -> None

Constructs a Pose with given transformation matrix (4x4 np.ndarray with np.float64 dtype)

Parameters:

matrix – a 4x4 np.float64 np.ndarray transformation matrix

  1. __init__(self: mplib.pymp.Pose, obj: object) -> None

Constructs a Pose with given Python object that has p and q attributes (e.g., sapien.Pose) or a 4x4 np.ndarray transformation matrix.

Parameters:

obj – a Pose-like object with p and q attributes or a 4x4 np.ndarray transformation matrix

distance(self: mplib.pymp.Pose, other: mplib.pymp.Pose) float#

Computes the distance between two poses by ``norm(p1.p - p2.p) + min(norm(p1.q - p2.q), norm(p1.q + p2.q))`.

The quaternion part has range [0, sqrt(2)].

Parameters:

other – the other pose

Returns:

the distance between the two poses

get_p(self: mplib.pymp.Pose) numpy.ndarray[numpy.float64[3, 1]]#

Gets the position part of the Pose

Returns:

position, format: (x, y, z)

get_q(self: mplib.pymp.Pose) numpy.ndarray[numpy.float64[4, 1]]#

Gets the quaternion part of the Pose

Returns:

quaternion, format: (w, x, y, z)

inv(self: mplib.pymp.Pose) mplib.pymp.Pose#

Get the inserse Pose

Returns:

the inverse Pose

property p#

Position part of the Pose (x, y, z)

property q#

Quaternion part of the Pose (w, x, y, z)

set_p(self: mplib.pymp.Pose, p: numpy.ndarray[numpy.float64[3, 1]]) None#

Sets the position part of the Pose

Parameters:

p – position, format: (x, y, z)

set_q(self: mplib.pymp.Pose, q: numpy.ndarray[numpy.float64[4, 1]]) None#

Sets the quaternion part of the Pose

Parameters:

q – quaternion (can be unnormalized), format: (w, x, y, z)

to_transformation_matrix(
self: mplib.pymp.Pose,
) numpy.ndarray[numpy.float64[4, 4]]#

Constructs a transformation matrix from this Pose

Returns:

a 4x4 transformation matrix