Skip to content

Conversation

kingjin94
Copy link

@kingjin94 kingjin94 commented Jul 3, 2023

Add sprite drawing as a way to add billboards (2D text annotations that always face the camera). Allows to write text unto the scene.

The underlying changes to meshcat are proposed in this PR: meshcat-dev/meshcat#145

An example:

Screenshot from 2023-07-03 14-26-30

Code to recreate the screenshot:

import meshcat
import numpy as np
t = meshcat.geometry.BillboardObject("test444", 75, 16, 0.01)

# !pip install timor-python
from timor.utilities import prebuilt_robots  
r = prebuilt_robots.get_six_axis_assembly()
viz = r.robot.visualize()

viz.viewer["test"].set_object(t)
viz.viewer["test"].set_transform(np.asarray(((1, 0., 0., 1.), (0, 1, 0, 1),(0, 0, 1, 0),(0, 0, 0, 1.))))

# Alternative w/out robot
viz = meshcat.Visualizer()
viz.initViewer()
viz["test"].set_object(t)
viz["test"].set_transform(np.asarray(((1, 0., 0., 1.), (0, 1, 0, 1),(0, 0, 1, 0),(0, 0, 0, 1.))))

@kingjin94 kingjin94 mentioned this pull request Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant