7.8.1. image_fetcher.SynchronizedImageFetcher

class image_fetcher.SynchronizedImageFetcher

Bases: object

This class provides a service that fetches synchronized RGB and Depth images from the robot. Instead of subscribing to the RGB and Depth topics directly, it uses ApproximateTimeSynchronizer to ensure that the images are captured at the same time. Additionally, it unregisters the subscribers after the images are captured to save bandwidth.

service

This service. Fetches synchronized images when called

Type:

rospy.Service

rgb_image

RGB image captured by the robot

Type:

sensor_msgs.msg.Image

depth_image

Depth image captured by the robot

Type:

sensor_msgs.msg.Image

Parameters:
  • rgb_topic (str) – Name of the RGB image topic. Loaded from the ‘rgb_topic’ parameter

  • depth_topic (str) – Name of the Depth image topic. Loaded from the ‘depth_topic’ parameter

Returns:

  • rgb (sensor_msgs.msg.Image) – RGB image captured by the robot

  • depth (sensor_msgs.msg.Image) – Depth image captured by the robot

__init__()

Methods

__init__()

callback(rgb_msg, depth_msg)

Callback function for ApproximateTimeSynchronizer.

fetch(req)

Fetches synchronized RGB and Depth images from the robot.

callback(rgb_msg, depth_msg)

Callback function for ApproximateTimeSynchronizer. Stores the synchronized RGB and Depth images.

fetch(req)

Fetches synchronized RGB and Depth images from the robot.

After the images are captured, the service unregisters the subscribers to save bandwidth.

Returns:

Response containing the synchronized RGB and Depth images

Return type:

FetchImagesResponse