2424from launch_ros .actions import ComposableNodeContainer , Node
2525from launch_ros .descriptions import ComposableNode
2626
27+ # All pipeline-internal and output topics are prefixed to avoid collisions
28+ # when running alongside other camera pipelines.
29+ CAM_PREFIX = '/down_cam'
30+
2731# Segmentation pipeline internal topics
28- SEG_CONVERTED_IMAGE_TOPIC = ' /yolo_seg/internal/converted_image'
29- SEG_TENSOR_OUTPUT_TOPIC = ' /yolo_seg/tensor_pub'
30- SEG_TENSOR_INPUT_TOPIC = ' /yolo_seg/tensor_sub'
31- SEG_ENCODER_NAMESPACE = 'yolo_seg_encoder/internal'
32+ SEG_CONVERTED_IMAGE_TOPIC = f' { CAM_PREFIX } /yolo_seg/internal/converted_image'
33+ SEG_TENSOR_OUTPUT_TOPIC = f' { CAM_PREFIX } /yolo_seg/tensor_pub'
34+ SEG_TENSOR_INPUT_TOPIC = f' { CAM_PREFIX } /yolo_seg/tensor_sub'
35+ SEG_ENCODER_NAMESPACE = 'down_cam/ yolo_seg_encoder/internal'
3236
3337# Classification pipeline internal topics
34- CLS_CONVERTED_IMAGE_TOPIC = ' /yolo_cls/internal/converted_image'
35- CLS_TENSOR_OUTPUT_TOPIC = ' /yolo_cls/tensor_pub'
36- CLS_TENSOR_INPUT_TOPIC = ' /yolo_cls/tensor_sub'
37- CLS_ENCODER_NAMESPACE = 'yolo_cls_encoder/internal'
38+ CLS_CONVERTED_IMAGE_TOPIC = f' { CAM_PREFIX } /yolo_cls/internal/converted_image'
39+ CLS_TENSOR_OUTPUT_TOPIC = f' { CAM_PREFIX } /yolo_cls/tensor_pub'
40+ CLS_TENSOR_INPUT_TOPIC = f' { CAM_PREFIX } /yolo_cls/tensor_sub'
41+ CLS_ENCODER_NAMESPACE = 'down_cam/ yolo_cls_encoder/internal'
3842
3943
4044def _launch_setup (context , * args , ** kwargs ):
@@ -56,6 +60,14 @@ def _launch_setup(context, *args, **kwargs):
5660
5761 encoder_dir = get_package_share_directory ('isaac_ros_dnn_image_encoder' )
5862
63+ # Prefix yaml-sourced topics
64+ seg_detection_topic = f'{ CAM_PREFIX } { seg_cfg ["detection_topic" ]} '
65+ seg_mask_topic = f'{ CAM_PREFIX } { seg_cfg ["mask_topic" ]} '
66+ seg_visualized_topic = f'{ CAM_PREFIX } { seg_cfg ["visualized_image_topic" ]} '
67+ cls_image_input_topic = f'{ CAM_PREFIX } { cls_cfg ["image_input_topic" ]} '
68+ cls_class_topic = f'{ CAM_PREFIX } { cls_cfg ["class_topic" ]} '
69+ cls_visualized_topic = f'{ CAM_PREFIX } { cls_cfg ["visualized_image_topic" ]} '
70+
5971 # -------------------------------------------------------------------------
6072 # Camera
6173 # -------------------------------------------------------------------------
@@ -66,7 +78,7 @@ def _launch_setup(context, *args, **kwargs):
6678 calib_path = os .path .join (pkg_dir , 'config' , 'cameras' , 'blackfly_s_calib.yaml' )
6779
6880 camera_container = ComposableNodeContainer (
69- name = 'pipeline_camera_container ' ,
81+ name = 'down_cam_camera_container ' ,
7082 namespace = '' ,
7183 package = 'rclcpp_components' ,
7284 executable = 'component_container_mt' ,
@@ -81,6 +93,7 @@ def _launch_setup(context, *args, **kwargs):
8193 'parameter_file' : spinnaker_map ,
8294 'serial_number' : '23494258' ,
8395 'camerainfo_url' : f'file://{ calib_path } ' ,
96+ 'reliable_qos' : True ,
8497 },
8598 ],
8699 remappings = [('~/control' , '/exposure_control/control' )],
@@ -94,7 +107,6 @@ def _launch_setup(context, *args, **kwargs):
94107
95108 # -------------------------------------------------------------------------
96109 # YOLO Segmentation
97- # Reads /blackfly_s/image_raw, outputs /yolo_seg_mask + /yolo_seg_processed_image
98110 # -------------------------------------------------------------------------
99111 seg_image_format_converter = ComposableNode (
100112 package = 'isaac_ros_image_proc' ,
@@ -155,14 +167,14 @@ def _launch_setup(context, *args, **kwargs):
155167 'network_image_height' : int (seg_cfg ['network_image_height' ]),
156168 'output_mask_width' : int (seg_cfg ['output_mask_width' ]),
157169 'output_mask_height' : int (seg_cfg ['output_mask_height' ]),
158- 'detections_topic' : seg_cfg [ 'detection_topic' ] ,
159- 'mask_topic' : seg_cfg [ 'mask_topic' ] ,
170+ 'detections_topic' : seg_detection_topic ,
171+ 'mask_topic' : seg_mask_topic ,
160172 }
161173 ],
162174 )
163175
164176 seg_container = ComposableNodeContainer (
165- name = 'seg_tensor_rt_container ' ,
177+ name = 'down_cam_seg_container ' ,
166178 namespace = '' ,
167179 package = 'rclcpp_components' ,
168180 executable = 'component_container_mt' ,
@@ -187,7 +199,7 @@ def _launch_setup(context, *args, **kwargs):
187199 'image_mean' : str (seg_cfg ['image_mean' ]),
188200 'image_stddev' : str (seg_cfg ['image_stddev' ]),
189201 'attach_to_shared_component_container' : 'True' ,
190- 'component_container_name' : 'seg_tensor_rt_container ' ,
202+ 'component_container_name' : 'down_cam_seg_container ' ,
191203 'dnn_image_encoder_namespace' : SEG_ENCODER_NAMESPACE ,
192204 'image_input_topic' : SEG_CONVERTED_IMAGE_TOPIC ,
193205 'camera_info_input_topic' : cam ['camera_info_topic' ],
@@ -202,10 +214,10 @@ def _launch_setup(context, *args, **kwargs):
202214 name = 'seg_visualizer' ,
203215 parameters = [
204216 {
205- 'detections_topic' : seg_cfg [ 'detection_topic' ] ,
217+ 'detections_topic' : seg_detection_topic ,
206218 'image_topic' : f'/{ SEG_ENCODER_NAMESPACE } /resize/image' ,
207- 'mask_topic' : seg_cfg [ 'mask_topic' ] ,
208- 'output_image_topic' : seg_cfg [ 'visualized_image_topic' ] ,
219+ 'mask_topic' : seg_mask_topic ,
220+ 'output_image_topic' : seg_visualized_topic ,
209221 'class_names_yaml' : str (seg_cfg ['class_names' ]),
210222 }
211223 ],
@@ -216,7 +228,6 @@ def _launch_setup(context, *args, **kwargs):
216228
217229 # -------------------------------------------------------------------------
218230 # YOLO Classification
219- # Reads /yolo_seg_mask (mask_topic from seg), outputs /classification_output
220231 # -------------------------------------------------------------------------
221232 cls_image_format_converter = ComposableNode (
222233 package = 'isaac_ros_image_proc' ,
@@ -231,7 +242,7 @@ def _launch_setup(context, *args, **kwargs):
231242 }
232243 ],
233244 remappings = [
234- ('image_raw' , cls_cfg [ 'image_input_topic' ] ),
245+ ('image_raw' , cls_image_input_topic ),
235246 ('image' , CLS_CONVERTED_IMAGE_TOPIC ),
236247 ],
237248 )
@@ -270,13 +281,13 @@ def _launch_setup(context, *args, **kwargs):
270281 'tensor_input_topic' : CLS_TENSOR_INPUT_TOPIC ,
271282 'confidence_threshold' : float (cls_cfg ['confidence_threshold' ]),
272283 'num_classes' : int (cls_cfg ['num_classes' ]),
273- 'class_topic' : cls_cfg [ 'class_topic' ] ,
284+ 'class_topic' : cls_class_topic ,
274285 }
275286 ],
276287 )
277288
278289 cls_container = ComposableNodeContainer (
279- name = 'cls_tensor_rt_container ' ,
290+ name = 'down_cam_cls_container ' ,
280291 namespace = '' ,
281292 package = 'rclcpp_components' ,
282293 executable = 'component_container_mt' ,
@@ -301,7 +312,7 @@ def _launch_setup(context, *args, **kwargs):
301312 'image_mean' : str (cls_cfg ['image_mean' ]),
302313 'image_stddev' : str (cls_cfg ['image_stddev' ]),
303314 'attach_to_shared_component_container' : 'True' ,
304- 'component_container_name' : 'cls_tensor_rt_container ' ,
315+ 'component_container_name' : 'down_cam_cls_container ' ,
305316 'dnn_image_encoder_namespace' : CLS_ENCODER_NAMESPACE ,
306317 'image_input_topic' : CLS_CONVERTED_IMAGE_TOPIC ,
307318 'camera_info_input_topic' : cls_cfg ['camera_info_input_topic' ],
@@ -316,9 +327,9 @@ def _launch_setup(context, *args, **kwargs):
316327 name = 'cls_visualizer' ,
317328 parameters = [
318329 {
319- 'class_topic' : cls_cfg [ 'class_topic' ] ,
330+ 'class_topic' : cls_class_topic ,
320331 'image_topic' : f'/{ CLS_ENCODER_NAMESPACE } /resize/image' ,
321- 'output_image_topic' : cls_cfg [ 'visualized_image_topic' ] ,
332+ 'output_image_topic' : cls_visualized_topic ,
322333 'class_names_yaml' : str (cls_cfg ['class_names' ]),
323334 }
324335 ],
@@ -328,7 +339,7 @@ def _launch_setup(context, *args, **kwargs):
328339 )
329340
330341 # -------------------------------------------------------------------------
331- # GStreamer — streams the segmentation visualization (rgb8 )
342+ # GStreamer — streams the segmentation visualization (bgr8 )
332343 # -------------------------------------------------------------------------
333344 image_to_gstreamer_node = Node (
334345 package = 'image_to_gstreamer' ,
@@ -337,8 +348,8 @@ def _launch_setup(context, *args, **kwargs):
337348 additional_env = {'EGL_PLATFORM' : 'surfaceless' },
338349 parameters = [
339350 {
340- 'input_topic' : seg_cfg [ 'visualized_image_topic' ] ,
341- 'host' : '10.0.0.169 ' ,
351+ 'input_topic' : seg_visualized_topic ,
352+ 'host' : '10.0.0.68 ' ,
342353 'port' : 5001 ,
343354 'bitrate' : 500000 ,
344355 'framerate' : 15 ,
@@ -347,7 +358,7 @@ def _launch_setup(context, *args, **kwargs):
347358 'control_rate' : 1 ,
348359 'pt' : 96 ,
349360 'config_interval' : 1 ,
350- 'format' : 'RGB ' ,
361+ 'format' : 'BGR ' ,
351362 }
352363 ],
353364 output = 'screen' ,
0 commit comments