robot_msgs

Transform

T_parent_child: maps points expressed in the child frame into the parent frame.

Import
from robot_msgs.geometry import Transform
ROS 2geometry_msgs/msg/Transform

Preview

The figure robot_msgs.viz.plot(example) draws for the example below.

Plot of an example Transform

Fields

NameTypeDefault
translationVector3Vector3()
rotationQuaternionQuaternion()

Example

One instance from the package's own test catalog; the output is its real repr().

Transform(translation=Vector3(x=0.4, y=-0.1, z=0.25), rotation=Quaternion(x=-0.10566871683993562, y=0.6991667342497077, z=0.10566871683993563, w=0.6991667342497078))
to_dict() as JSON
{
  "_type": "geometry/Transform",
  "translation": {
    "_type": "geometry/Vector3",
    "x": 0.4,
    "y": -0.1,
    "z": 0.25
  },
  "rotation": {
    "_type": "geometry/Quaternion",
    "x": -0.10566871683993562,
    "y": 0.6991667342497077,
    "z": 0.10566871683993563,
    "w": 0.6991667342497078
  }
}

Long arrays are cut after 16 values and say so with “…”.

Functions

Constructors

Classmethods and staticmethods: ways to build one.

from_array(array: Any) -> Transform

No docstring.

from_matrix(matrix: Any) -> Transform

From a (4, 4) homogeneous matrix whose last row is [0, 0, 0, 1].

from_xyz_rpy(
    x: float,
    y: float,
    z: float,
    roll: float,
    pitch: float,
    yaw: float,
) -> Transform

No docstring.

identity() -> Transform

No docstring.

from_dict

from Msg
from_dict(data: Mapping[str, Any]) -> M

No docstring.

Methods

Return new values; messages are never mutated.

as_array() -> np.ndarray

(7,) = x y z qx qy qz qw.

as_pose() -> Pose

No docstring.

compose(other: Transform) -> Transform

T_world_tool = T_world_base.compose(T_base_tool): apply other in our frame.

interpolate(other: Transform, alpha: float) -> Transform

Lerp the translation, slerp the rotation; 0 gives self, 1 gives other.

inverse() -> Transform

No docstring.

rotated(
    roll: float = 0.0,
    pitch: float = 0.0,
    yaw: float = 0.0,
    local: bool = False,
) -> Transform

Turned in place (the origin stays put) by ROS RPY about the parent frame's axes, or

shifted(
    dx: float = 0.0,
    dy: float = 0.0,
    dz: float = 0.0,
    local: bool = False,
) -> Transform

Moved by (dx, dy, dz) along the parent frame's axes, or along its own with

to_matrix() -> np.ndarray

No docstring.

transform_point(point: V) -> V

Child-frame Point, Vector3 or (..., 3) array to the parent frame (same kind).

replace

from Msg
replace(**changes: Any) -> M

A copy with some fields changed. Validation runs again.

to_dict

from Msg
to_dict() -> dict[str, Any]

JSON-safe dict with a "_type" key; arrays keep their dtype and shape.

Operators

Python operators and protocols the type supports.

__matmul__(other: object) -> Transform

No docstring.

Uses

Types its fields refer to.

Quaternion Vector3

Used by

Types whose fields refer to it.

TransformStamped

robot_msgs 0.1.0 @ 2dc6666GitHub · MIT license · generated from the package, not written per type