Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 348

Increase the frequency at which images are updated in a subscriber

$
0
0
I am using code which tracks the image of a robot. Specifically, [the rospy-based code I am using is here](https://github.com/BerkeleyAutomation/davinci-skeleton/blob/master/autolab/data_collector.py). Here's the relevant part of the code. """ The DataCollector class polls data from the rostopics periodically. It manages the messages that come from ros. """ class DataCollector: def __init__(self, camera_left_topic="/endoscope/left/", camera_right_topic="/endoscope/right/", camera_info_str='camera_info', camera_im_str='image_rect_color'): self.left_image = None rospy.Subscriber(camera_left_topic + camera_im_str, Image, self.left_image_callback, queue_size=1) This segment defines the DataCollector class and subscribes to a "left image callback method" which continually updates `self.left_image` to be the image as seen by the robot's left camera: def left_image_callback(self, msg): if rospy.is_shutdown(): return self.left_image = self.bridge.imgmsg_to_cv2(msg, "rgb8") I timed how often the `left_image_callback` method is called, and it updates at roughly intervals of 0.5 seconds. In other words, if the robot is moving, the `self.left_image` will only update every 0.5 seconds. My question is simple: how do I increase the rate at which the image gets updated? Ideally I can get this to be 0.2 seconds, if possible. If it matters, I'm using ros indigo, and the robot is Intuitive Surgical da Vinci.

Viewing all articles
Browse latest Browse all 348

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>