Record3D + URDF Helpers

Extra utilities. Used for example scripts.

class viser.extras.Record3dFrame[source]

A single frame from a Record3D capture.

K: ndarray[tuple[int, ...], dtype[float32]]
rgb: ndarray[tuple[int, ...], dtype[uint8]]
depth: ndarray[tuple[int, ...], dtype[float32]]
mask: ndarray[tuple[int, ...], dtype[bool]]
T_world_camera: ndarray[tuple[int, ...], dtype[float32]]
get_point_cloud(downsample_factor: int = 1) Tuple[ndarray[tuple[int, ...], dtype[float32]], ndarray[tuple[int, ...], dtype[uint8]]][source]
Parameters:

downsample_factor (int)

Return type:

Tuple[ndarray[tuple[int, …], dtype[float32]], ndarray[tuple[int, …], dtype[uint8]]]

class viser.extras.Record3dLoader[source]

Helper for loading frames for Record3D captures.

num_frames() int[source]
Return type:

int

get_frame(index: int) Record3dFrame[source]
Parameters:

index (int)

Return type:

Record3dFrame

class viser.extras.ViserUrdf[source]

Helper for rendering URDFs in Viser. This is a self-contained example that uses only basic Viser features. It can be copied and modified if you need more fine-grained control.

To move or control visibility of the entire robot, you can create a parent frame that the URDF will be attached to. This is because ViserUrdf creates the robot’s geometry as children of the specified root_node_name, but doesn’t create the root node itself.

import time
import numpy as np
import viser
from viser.extras import ViserUrdf
from robot_descriptions.loaders.yourdfpy import load_robot_description

server = viser.ViserServer()

# Create a parent frame for the robot.
# ViserUrdf will attach the robot's geometry as children of this frame.
robot_base = server.scene.add_frame("/robot", show_axes=False)

# Load a URDF from robot_descriptions package.
urdf = ViserUrdf(
    server,
    load_robot_description("panda_description"),
    root_node_name="/robot"
)

# Move the entire robot by updating the base frame.
robot_base.position = (1.0, 0.0, 0.5)  # Move to (x=1, y=0, z=0.5).

# Update joint configuration.
urdf.update_cfg(np.array([0.0, 0.5, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0]))

# Make the robot blink.
while True:
    robot_base.visible = False
    time.sleep(0.2)
    robot_base.visible = True
    time.sleep(3.0)
Parameters:
  • target – ViserServer or ClientHandle object to add URDF to.

  • urdf_or_path – Either a path to a URDF file or a yourdfpy URDF object.

  • scale – Scale factor to apply to resize the URDF.

  • root_node_name – Viser scene tree name for the root of the URDF geometry.

  • mesh_color_override – Optional color to override the URDF’s visual mesh colors. RGB or RGBA tuple.

  • collision_mesh_color_override – Optional color to override the URDF’s collision mesh colors. RGB or RGBA tuple.

  • load_meshes – If true, shows the URDF’s visual meshes. If a yourdfpy URDF object is used as input, this expects the URDF to have a visual scene graph configured.

  • load_collision_meshes – If true, shows the URDF’s collision meshes. If a yourdfpy URDF object is used as input, this expects the URDF to have a collision scene graph configured.

property show_visual: bool

Returns whether the visual meshes are currently visible.

property show_collision: bool

Returns whether the collision meshes are currently visible.

remove() None[source]

Remove URDF from scene.

Return type:

None

update_cfg(configuration: ndarray) None[source]

Update the joint angles of the visualized URDF.

Parameters:

configuration (ndarray)

Return type:

None

get_actuated_joint_limits() dict[str, tuple[float | None, float | None]][source]

Returns an ordered mapping from actuated joint names to position limits.

Return type:

dict[str, tuple[float | None, float | None]]

get_actuated_joint_names() Tuple[str, ...][source]

Returns a tuple of actuated joint names, in order.

Return type:

Tuple[str, …]