Visualizing Worlds

Visualizing Worlds#

This exercise demonstrates a lightweight way to visualize a world inside a notebook using the RayTracer.

You will:

  • Load a simple world from URDF

  • Create a VizMarkerPublisher and render the scene

0. Setup#

1. Visualize#

Your goal:

  • Construct a VizMarkerPublisher for the loaded world and store it in a variable named viz

root = get_semantic_digital_twin_directory_root(os.getcwd())
table_urdf = os.path.join(root, "resources", "urdf", "table.urdf")
world = URDFParser.from_file(table_urdf).parse()

from semantic_digital_twin.adapters.viz_marker import VizMarkerPublisher
import threading
import rclpy
rclpy.init()

node = rclpy.create_node("semantic_digital_twin")
thread = threading.Thread(target=rclpy.spin, args=(node,), daemon=True)
thread.start()

viz = VizMarkerPublisher(world=world, node=node)