Skip to content

Transforms

Methods for logging transforms on entity paths.

Learn more about transforms in the manual


def rerun.log_rigid3(entity_path, *, parent_from_child=None, child_from_parent=None, xyz='', timeless=False, recording=None)

Log a proper rigid 3D transform between this entity and the parent.

Set either parent_from_child or child_from_parent to a tuple of (translation_xyz, quat_xyzw).

Parent-from-child

Also known as pose (e.g. camera extrinsics).

The translation is the position of the entity in the parent space. The resulting transform from child to parent corresponds to taking a point in the child space, rotating it by the given rotations, and then translating it by the given translation:

point_parent = translation + quat * point_child * quat*

Example
t = 0.0
translation = [math.sin(t), math.cos(t), 0.0] # circle around origin
rotation = [0.5, 0.0, 0.0, np.sin(np.pi/3)] # 60 degrees around x-axis
rerun.log_rigid3("sun/planet", parent_from_child=(translation, rotation))

Parameters:

Name Type Description Default
entity_path str

Path of the child space in the space hierarchy.

required
parent_from_child Optional[Tuple[npt.ArrayLike, npt.ArrayLike]]

A tuple of (translation_xyz, quat_xyzw) mapping points in the child space to the parent space.

None
child_from_parent Optional[Tuple[npt.ArrayLike, npt.ArrayLike]]

the inverse of parent_from_child

None
xyz str

Optionally set the view coordinates of this entity, e.g. to RDF for X=Right, Y=Down, Z=Forward. This is a convenience for also calling log_view_coordinates.

''
timeless bool

If true, the transform will be timeless (default: False).

False
recording Optional[RecordingStream]

Specifies the rerun.RecordingStream to use. If left unspecified, defaults to the current active data recording, if there is one. See also: rerun.init, rerun.set_global_data_recording.

None

def rerun.log_pinhole(entity_path, *, child_from_parent, width, height, timeless=False, recording=None)

Log a perspective camera model.

This logs the pinhole model that projects points from the parent (camera) space to this space (image) such that:

point_image_hom = child_from_parent * point_cam
point_image = point_image_hom[:,1] / point_image_hom[2]

Where point_image_hom is the projected point in the image space expressed in homogeneous coordinates.

Example
width = 640
height = 480
u_cen = width / 2
v_cen = height / 2
f_len = (height * width) ** 0.5

rerun.log_pinhole("world/camera/image",
                  child_from_parent = [[f_len, 0,     u_cen],
                                       [0,     f_len, v_cen],
                                       [0,     0,     1  ]],
                  width = width,
                  height = height)

Parameters:

Name Type Description Default
entity_path str

Path to the child (image) space in the space hierarchy.

required
child_from_parent npt.ArrayLike

Row-major intrinsics matrix for projecting from camera space to image space.

required
width int

Width of the image in pixels.

required
height int

Height of the image in pixels.

required
timeless bool

If true, the camera will be timeless (default: False).

False
recording Optional[RecordingStream]

Specifies the rerun.RecordingStream to use. If left unspecified, defaults to the current active data recording, if there is one. See also: rerun.init, rerun.set_global_data_recording.

None

def rerun.log_unknown_transform(entity_path, timeless=False, recording=None)

Log that this entity is NOT in the same space as the parent, but you do not (yet) know how they relate.

Parameters:

Name Type Description Default
entity_path str

The path of the affected entity.

required

timeless: Log the data as timeless.

recording: Specifies the rerun.RecordingStream to use. If left unspecified, defaults to the current active data recording, if there is one. See also: rerun.init, rerun.set_global_data_recording.

def rerun.log_view_coordinates(entity_path, *, xyz='', up='', right_handed=None, timeless=False, recording=None)

Log the view coordinates for an entity.

Each entity defines its own coordinate system, called a space. By logging view coordinates you can give semantic meaning to the XYZ axes of the space. This is for example useful for camera entities ("what axis is forward?").

For full control, set the xyz parameter to a three-letter acronym (xyz="RDF"). Each letter represents:

  • R: Right
  • L: Left
  • U: Up
  • D: Down
  • F: Forward
  • B: Back

Some of the most common are:

  • "RDF": X=Right Y=Down Z=Forward (right-handed)
  • "RUB" X=Right Y=Up Z=Back (right-handed)
  • "RDB": X=Right Y=Down Z=Back (left-handed)
  • "RUF": X=Right Y=Up Z=Forward (left-handed)
Example
rerun.log_view_coordinates("world/camera", xyz="RUB")

For world-coordinates it's often convenient to just specify an up-axis. You can do so by using the up-parameter (where up is one of "+X", "-X", "+Y", "-Y", "+Z", "-Z"):

rerun.log_view_coordinates("world", up="+Z", right_handed=True, timeless=True)
rerun.log_view_coordinates("world", up="-Y", right_handed=False, timeless=True)

Parameters:

Name Type Description Default
entity_path str

Path in the space hierarchy where the view coordinate will be set.

required
xyz str

Three-letter acronym for the view coordinate axes.

''
up str

Which axis is up? One of "+X", "-X", "+Y", "-Y", "+Z", "-Z".

''
right_handed Optional[bool]

If True, the coordinate system is right-handed. If False, it is left-handed.

None
timeless bool

If true, the view coordinates will be timeless (default: False).

False
recording Optional[RecordingStream]

Specifies the rerun.RecordingStream to use. If left unspecified, defaults to the current active data recording, if there is one. See also: rerun.init, rerun.set_global_data_recording.

None