@@ -122,7 +122,7 @@ def main(args=None):
122122 # parameter.
123123 custom_camera_qos_profile .history = args .history_policy
124124
125- print ("Publishing data on topic '%s'" % (args .topic ))
125+ node . get_logger (). info ("Publishing data on topic '%s'" % (args .topic ))
126126
127127 # Create the image publisher with our custom QoS profile.
128128 pub = node .create_publisher (
@@ -141,7 +141,7 @@ def flip_image_cb(msg):
141141
142142 output = 'on' if is_flipped else 'off'
143143
144- print ('Set flip mode to: ' + output )
144+ node . get_logger (). info ('Set flip mode to: ' + output )
145145
146146 custom_flip_qos_profile = qos_profile_sensor_data
147147 custom_flip_qos_profile .depth = 10
@@ -158,7 +158,7 @@ def flip_image_cb(msg):
158158 cam_cap .set (cv2 .CAP_PROP_FRAME_WIDTH , args .width )
159159 cam_cap .set (cv2 .CAP_PROP_FRAME_HEIGHT , args .height )
160160 if not cam_cap .isOpened ():
161- print ('Could not open video stream' )
161+ node . get_logger (). fatal ('Could not open video stream' )
162162 sys .exit (1 )
163163
164164 # Our main event loop will spin until the user presses CTRL-C to exit.
@@ -188,7 +188,7 @@ def flip_image_cb(msg):
188188 cv2 .waitKey (1 )
189189
190190 # Publish the image message and increment the frame_id.
191- print ('Publishing image #%d' % (frame_number ))
191+ node . get_logger (). info ('Publishing image #%d' % (frame_number ))
192192 pub .publish (msg )
193193 frame_number += 1
194194
0 commit comments