Coordinate framesΒΆ
In this basic example, we visualize a set of coordinate frames.
Naming for all scene nodes are hierarchical; /tree/branch, for example, is defined relative to /tree.
1import random
2import time
3
4import viser
5
6server = viser.ViserServer()
7
8while True:
9 # Add some coordinate frames to the scene. These will be visualized in the viewer.
10 server.scene.add_frame(
11 "/tree",
12 wxyz=(1.0, 0.0, 0.0, 0.0),
13 position=(random.random() * 2.0, 2.0, 0.2),
14 )
15 server.scene.add_frame(
16 "/tree/branch",
17 wxyz=(1.0, 0.0, 0.0, 0.0),
18 position=(random.random() * 2.0, 2.0, 0.2),
19 )
20 leaf = server.scene.add_frame(
21 "/tree/branch/leaf",
22 wxyz=(1.0, 0.0, 0.0, 0.0),
23 position=(random.random() * 2.0, 2.0, 0.2),
24 )
25 time.sleep(5.0)
26
27 # Remove the leaf node from the scene.
28 leaf.remove()
29 time.sleep(0.5)