Skip to content

Commit 1630447

Browse files
Fix incorrect transform issue due to translation resetting
1 parent 3a0789a commit 1630447

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

kf_hungarian_tracker/kf_hungarian_tracker/kf_hungarian_node.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,15 @@ def callback(self, msg):
9797
try:
9898
trans = self.tf_buffer.lookup_transform(self.global_frame, msg.header.frame_id, rclpy.time.Time())
9999
msg.header.frame_id = self.global_frame
100+
# do_transform_vector3(vector, trans) resets trans.transform.translation
101+
# values to 0.0, so we need to preserve them for future usage in the loop below
102+
translation_backup_x = trans.transform.translation.x
103+
translation_backup_y = trans.transform.translation.y
104+
translation_backup_z = trans.transform.translation.z
100105
for i in range(len(detections)):
106+
trans.transform.translation.x = translation_backup_x
107+
trans.transform.translation.y = translation_backup_y
108+
trans.transform.translation.z = translation_backup_z
101109
# transform position (point)
102110
p = PointStamped()
103111
p.point = detections[i].position

0 commit comments

Comments
 (0)