MCPcopy Create free account
hub / github.com/Improbable-AI/VisionProTeleop / run

Method run

utils/viser_tracking_visualizer.py:887–965  ·  view source on GitHub ↗

Start the visualizer server.

(self)

Source from the content-addressed store, hash-verified

885 last_slider_update = next_frame
886
887 def run(self):
888 """Start the visualizer server."""
889 self.server = viser.ViserServer(port=self.port)
890
891 # Set up GUI
892 self._setup_gui()
893
894 # Add checkerboard ground plane with alternating colored patches
895 cell_size = 2.5 # 2.5m cells (10x larger)
896 grid_extent = 15.0 # +/- 15m (10x larger)
897 color1 = (140, 140, 140) # Gray
898 color2 = (180, 180, 180) # Light gray
899
900 # Create each cell as a separate mesh (allows different colors)
901 cell_idx = 0
902 for i, x in enumerate(np.arange(-grid_extent, grid_extent, cell_size)):
903 for j, y in enumerate(np.arange(-grid_extent, grid_extent, cell_size)):
904 # Four corners of this cell
905 vertices = np.array([
906 [x, y, -0.001],
907 [x + cell_size, y, -0.001],
908 [x + cell_size, y + cell_size, -0.001],
909 [x, y + cell_size, -0.001],
910 ], dtype=np.float32)
911 faces = np.array([[0, 1, 2], [0, 2, 3]], dtype=np.uint32)
912
913 # Checkerboard pattern
914 color = color1 if (i + j) % 2 == 0 else color2
915
916 self.server.scene.add_mesh_simple(
917 f"/ground/cell_{cell_idx}",
918 vertices=vertices,
919 faces=faces,
920 color=color,
921 )
922 cell_idx += 1
923
924 # Add grid lines on top for reference
925 self.server.scene.add_grid(
926 "/grid",
927 width=30.0,
928 height=30.0,
929 plane="xy",
930 position=(0, 0, 0),
931 cell_color=(120, 120, 120), # Gray grid lines
932 section_color=(100, 100, 100), # Darker section lines
933 cell_size=2.5, # Match cell size
934 section_size=5.0, # 5m sections
935 )
936
937 # Set up direction (Z-up for visualization, we convert from Y-up ARKit)
938 self.server.scene.set_up_direction("+z")
939
940 # Initial scene
941 self._update_scene()
942
943 # Start playback thread
944 playback_thread = threading.Thread(target=self._playback_loop, daemon=True)

Callers 11

mainFunction · 0.95
mainFunction · 0.80
run_commandMethod · 0.80
setup_bridge_macosMethod · 0.80
setup_bridge_linuxMethod · 0.80
start_streamingMethod · 0.80
client.pyFile · 0.80
server.pyFile · 0.80

Calls 4

_setup_guiMethod · 0.95
_update_sceneMethod · 0.95
printFunction · 0.50
startMethod · 0.45

Tested by

no test coverage detected