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
TFPublisherfor the loaded world and store it in a variable namedtf_publisherConstruct a
VizMarkerPublisherfor the loaded world and store it in a variable namedviz
root = Path(files("semantic_digital_twin")).parent.parent
table_urdf = os.path.join(root, "resources", "urdf", "table.urdf")
world = URDFParser.from_file(table_urdf).parse()
from semantic_digital_twin.adapters.ros.tf_publisher import TFPublisher
from semantic_digital_twin.adapters.ros.visualization.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()
tf_publisher = TFPublisher(_world=world, node=node)
viz = VizMarkerPublisher(_world=world, node=node)