Skip to content

Commit

Permalink
Changed sensor data publishers to publish with best effor reliability
Browse files Browse the repository at this point in the history
  • Loading branch information
smtobin committed Apr 2, 2023
1 parent 3821990 commit 784c641
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions workspace/launch/image_roi_publisher_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def generate_launch_description():
emulate_tty=True,
parameters=[
{"package_path": "/home/ros_sandbox/ros_sandbox/workspace/src/image_roi_publisher",
"image_path": "data/traffic_signs/traffic_sign_array.jpg",
"roi_path": "data/traffic_signs/traffic_sign_array.txt"}
"image_path": "data/lane_lines/mcity.jpg",
"roi_path": "data/lane_lines/mcity.txt"}
],
# remappings=[
# ("~/output/image")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class ImageLidarROIPublisher(Node):

def __init__(self):
super().__init__('image_lidar_roi_publisher')
self.image_publisher = self.create_publisher(sensor_msgs.msg.Image, "~/output/image", 1)
self.image_publisher = self.create_publisher(sensor_msgs.msg.Image, "~/output/image", 2)
self.roi_publisher = self.create_publisher(RoiArray, "~/output/rois", 1)
self.pc_publisher = self.create_publisher(sensor_msgs.msg.PointCloud2, "~/output/pts", 1)
self.pc_publisher = self.create_publisher(sensor_msgs.msg.PointCloud2, "~/output/pts", 2)
self.bridge = CvBridge()

timer_period = 0.5 # seconds
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ class ImageROIPublisher(Node):

def __init__(self):
super().__init__('image_roi_publisher')
self.image_publisher = self.create_publisher(Image, "~/output/image", 1)
# IMPORTANT: the "2" means that we use "best effort" reliability, which matches sensor data in the real stack
# the "1" means that we use "reliable" reliability, which matches ROI messages in the real stack
self.image_publisher = self.create_publisher(Image, "~/output/image", 2)
self.roi_publisher = self.create_publisher(RoiArray, "~/output/rois", 1)
self.bridge = CvBridge()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self):
self.image_publishers = []
self.images = []
for i in range(len(self.image_paths)):
self.image_publishers.append(self.create_publisher(Image, self.image_topics[i], 1))
self.image_publishers.append(self.create_publisher(Image, self.image_topics[i], 2))

img_path = os.path.join(self.package_path, self.image_paths[i])
print(img_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class VideoPublisher(Node):

def __init__(self):
super().__init__('video_publisher')
self.image_publisher = self.create_publisher(Image, "~/output/image", 1)
self.image_publisher = self.create_publisher(Image, "~/output/image", 2)
self.bridge = CvBridge()

self.declare_parameter('fps', 10)
Expand Down

0 comments on commit 784c641

Please sign in to comment.