From 36c865ea003ef03077476e9e89711bd300866a6e Mon Sep 17 00:00:00 2001 From: Wiktor Bajor Date: Sun, 14 Jul 2024 16:21:56 +0200 Subject: [PATCH] Use camera_frame_id parameter as the frame id of transform to the detected human --- .../human_detector/human_detector.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/human_detector/human_detector/human_detector.py b/human_detector/human_detector/human_detector.py index 7884d5f..886cfd0 100644 --- a/human_detector/human_detector/human_detector.py +++ b/human_detector/human_detector/human_detector.py @@ -138,18 +138,18 @@ def timer_callback(self): self.publish_image_with_detected_human() def broadcast_timer_callback(self): - t = TransformStamped() - t.header.stamp = self.get_clock().now().to_msg() - t.header.frame_id = 'camera_link' - t.child_frame_id = self.parameters.detected_human_frame_id - t.transform.translation.x = self.detected_human_position_world['x'] - t.transform.translation.y = self.detected_human_position_world['y'] - t.transform.translation.z = self.detected_human_position_world['z'] - t.transform.rotation.x = 0.0 - t.transform.rotation.y = 0.0 - t.transform.rotation.z = 0.0 - t.transform.rotation.w = 1.0 - self.tf_broadcaster.sendTransform(t) + transform = TransformStamped() + transform.header.stamp = self.get_clock().now().to_msg() + transform.header.frame_id = self.parameters.camera_frame_id + transform.child_frame_id = self.parameters.detected_human_frame_id + transform.transform.translation.x = self.detected_human_position_world['x'] + transform.transform.translation.y = self.detected_human_position_world['y'] + transform.transform.translation.z = self.detected_human_position_world['z'] + transform.transform.rotation.x = 0.0 + transform.transform.rotation.y = 0.0 + transform.transform.rotation.z = 0.0 + transform.transform.rotation.w = 1.0 + self.tf_broadcaster.sendTransform(transform) def draw_person_pose(self, image, landmarks): if landmarks is not None: