@@ -44,6 +44,8 @@ def __init__(self, camera_info_topic, mask_topic=None, description_param=None, d
4444 else :
4545 print ('URDF model file "%s" does not exist.' % (description_file ,), file = sys .stderr )
4646
47+ self ._static_mask_file = None
48+
4749 self ._config = RobotModelRendererConfig ()
4850 # Default config for this plugin
4951 self ._config .renderingMode = RenderingMode .MASK
@@ -89,6 +91,7 @@ def __init__(self, camera_info_topic, mask_topic=None, description_param=None, d
8991 package_path = rospack .get_path (matches [1 ])
9092 image_file = image_file .replace ('$(find %s)' % (matches [1 ],), package_path )
9193 self ._config .staticMaskImage = cv2 .imread (image_file , cv2 .IMREAD_UNCHANGED )
94+ self ._static_mask_file = image_file
9295 except Exception as e :
9396 print ("Error reading static mask image %s: %s" % (kwargs [k ], str (e )), file = sys .stderr )
9497 else :
@@ -161,8 +164,10 @@ def reset(self):
161164 def _str_params (self ):
162165 parts = [
163166 'camera_info_topic=' + self .camera_info_topic ,
164- 'mask_topic=' + self .mask_topic
167+ 'mask_topic=' + self .mask_topic ,
165168 ]
169+ if self ._static_mask_file is not None :
170+ parts .append ('staticMaskImage=' + self ._static_mask_file )
166171 if self .description_param != "robot_description" :
167172 parts .append ('description_param=' + self .description_param )
168173 parent_params = super (RenderCameraMask , self )._str_params ()
0 commit comments