Skip to content

Commit

Permalink
Moved visualization functionality inside of required data condition
Browse files Browse the repository at this point in the history
  • Loading branch information
dinodeep committed Nov 30, 2023
1 parent afe7c21 commit 4b29158
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions driverless_ws/src/perceptions/perceptions/ros/utils/DataNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,9 @@ class DataNode(Node):
def __init__(self, required_data=list(DataType), name="data_node", visualize=False):
super().__init__(name)

self.visualize = visualize
if self.visualize:
# setup point cloud visualization window
self.window = vis.init_visualizer_window()
self.xyz_image_window = vis.init_visualizer_window()

# subscribe to each piece of data that we want to collect on
self.required_data = required_data
self.visualize = visualize

if DataType.ZED_LEFT_COLOR in self.required_data:
self.left_color_subscriber = self.create_subscription(Image, LEFT_IMAGE_TOPIC, self.left_color_callback, qos_profile=BEST_EFFORT_QOS_PROFILE)
Expand All @@ -46,12 +41,16 @@ def __init__(self, required_data=list(DataType), name="data_node", visualize=Fal

if DataType.ZED_XYZ_IMG in self.required_data:
self.xyz_image_subscriber = self.create_subscription(Image, XYZ_IMAGE_TOPIC, self.xyz_image_callback, qos_profile=BEST_EFFORT_QOS_PROFILE)
if self.visualize:
self.xyz_image_window = vis.init_visualizer_window()

if DataType.ZED_DEPTH_IMG in self.required_data:
self.depth_subscriber = self.create_subscription(Image, DEPTH_IMAGE_TOPIC, self.depth_image_callback, qos_profile=BEST_EFFORT_QOS_PROFILE)

if DataType.HESAI_POINTCLOUD in self.required_data:
self.point_subscriber = self.create_subscription(PointCloud2, POINT_TOPIC, self.points_callback, qos_profile=BEST_EFFORT_QOS_PROFILE)
if self.visualize:
self.window = vis.init_visualizer_window()

# define dictionary to store the data
# TODO: convert data representation to DataInstance type
Expand Down

0 comments on commit 4b29158

Please sign in to comment.