From 0bfb696c1b1863f9f9ead460b81d6f2d40cb8658 Mon Sep 17 00:00:00 2001 From: 0nhc Date: Sun, 13 Oct 2024 00:24:20 -0500 Subject: [PATCH] successfully published segmentation image --- scripts/bt_sim_node.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/bt_sim_node.py b/scripts/bt_sim_node.py index ee5a06c..a8742c9 100755 --- a/scripts/bt_sim_node.py +++ b/scripts/bt_sim_node.py @@ -325,6 +325,8 @@ class CameraPlugin(Plugin): self.depth_pub = rospy.Publisher(topic, Image, queue_size=10) topic = self.name + "/color/image_rect_raw" self.rgb_pub = rospy.Publisher(topic, Image, queue_size=10) + topic = self.name + "/segmentation/image_rect_raw" + self.seg_pub = rospy.Publisher(topic, Image, queue_size=10) def update(self): stamp = rospy.Time.now() @@ -334,7 +336,7 @@ class CameraPlugin(Plugin): msg.header.stamp = stamp self.info_pub.publish(msg) - color, depth, mask = self.camera.get_image() + color, depth, seg = self.camera.get_image() if self.cam_noise: depth = apply_noise(depth) @@ -343,10 +345,14 @@ class CameraPlugin(Plugin): msg.header.stamp = stamp self.depth_pub.publish(msg) - msg = self.cv_bridge.cv2_to_imgmsg((color).astype(np.uint8), encoding='rgb8') + msg = self.cv_bridge.cv2_to_imgmsg(color.astype(np.uint8), encoding='rgb8') msg.header.stamp = stamp self.rgb_pub.publish(msg) + msg = self.cv_bridge.cv2_to_imgmsg(seg.astype(np.uint8), encoding='mono8') + msg.header.stamp = stamp + self.seg_pub.publish(msg) + class MockActionsPlugin(Plugin): def __init__(self):