Two subscriber topics in rclpy.spin() not working properly and losing frames. [closed]
Hi,
I am working with ROS2 - foxy distribution. I have two usb cams, generate frames at 30 fps.
USB cam packages are from this git: https://github.com/ros-drivers/usb_ca... . When i run the publishers, i could see the topic listed as, /usb_cam_0/camera_info , /usb_cam_0/image_raw , /usb_cam_1/camera_info, /usb_cam_1/image_raw .
I want to subscribe a frame from camera 1 and concat it with frame from camera 2 and save in a directory. Then the cycle repeats as long as code runs. I wanted t code in python. For some reason, message filters/time synchronizer library in python was throwing error which i wasn't able to fix. (https://answers.ros.org/question/3843...)
So the approach which I tried:
rclpy.spin() which has below functions:
self.subscription_1 = self.create_subscription(Image, '/usb_cam_0/image_raw', self.camera_0_callback, 1) self.subscription_2 = self.create_subscription(Image, '/usb_cam_1/image_raw', self.camera_1_callback, 1)
camera_0_callback is not getting called always. Almost half of times when the code runs, it skips camera_0_callback. I tried variable delays, increasing queue sizes but it doesn't seem to work.
All the while, ros2 topic list shows the topics; Could it be an issue with camera? Or am i not performing the queue logic incorrectly? Any inputs will be helpful.