From 1fd5f8509ab37e3d96e04231ce978a4b962beee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel=20Gonz=C3=A1lez=20Santamarta?= Date: Tue, 30 Apr 2024 12:00:21 +0200 Subject: [PATCH] marker color fixed --- yolov8_ros/yolov8_ros/debug_node.py | 6 +++--- yolov8_ros/yolov8_ros/yolov8_node.py | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/yolov8_ros/yolov8_ros/debug_node.py b/yolov8_ros/yolov8_ros/debug_node.py index b78690a..ba8b270 100644 --- a/yolov8_ros/yolov8_ros/debug_node.py +++ b/yolov8_ros/yolov8_ros/debug_node.py @@ -205,9 +205,9 @@ def create_bb_marker(self, detection: Detection, color: Tuple[int]) -> Marker: marker.scale.y = bbox3d.size.y marker.scale.z = bbox3d.size.z - marker.color.b = float(color[0]) - marker.color.g = float(color[1]) - marker.color.r = float(color[2]) + marker.color.b = color[0] / 255.0 + marker.color.g = color[1] / 255.0 + marker.color.r = color[2] / 255.0 marker.color.a = 0.4 marker.lifetime = Duration(seconds=0.5).to_msg() diff --git a/yolov8_ros/yolov8_ros/yolov8_node.py b/yolov8_ros/yolov8_ros/yolov8_node.py index 14ecf6b..732859f 100644 --- a/yolov8_ros/yolov8_ros/yolov8_node.py +++ b/yolov8_ros/yolov8_ros/yolov8_node.py @@ -59,8 +59,6 @@ def __init__(self, **kwargs) -> None: self.declare_parameter("image_reliability", QoSReliabilityPolicy.BEST_EFFORT) - self.declare_parameter("input_image_topic", "image_raw") - self.get_logger().info('Yolov8Node created') def on_configure(self, state: LifecycleState) -> TransitionCallbackReturn: @@ -88,9 +86,6 @@ def on_configure(self, state: LifecycleState) -> TransitionCallbackReturn: depth=1 ) - self.topic_name = self.get_parameter( - "input_image_topic").get_parameter_value().string_value - self._pub = self.create_lifecycle_publisher( DetectionArray, "detections", 10) self._srv = self.create_service( @@ -113,7 +108,9 @@ def on_activate(self, state: LifecycleState) -> TransitionCallbackReturn: # subs self._sub = self.create_subscription( - Image, self.topic_name, self.image_cb, + Image, + "image_raw", + self.image_cb, self.image_qos_profile )