From 826b0ef2bdad51a6fe04e47e3a785e589acb4b4a Mon Sep 17 00:00:00 2001 From: Fabrice Larribe <693401+teyssieuman@users.noreply.github.com> Date: Mon, 11 Mar 2024 19:47:12 +0100 Subject: [PATCH] Make the pose_V to TFMessage conform with ROS2 --- ros_gz_bridge/src/convert/tf2_msgs.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ros_gz_bridge/src/convert/tf2_msgs.cpp b/ros_gz_bridge/src/convert/tf2_msgs.cpp index b3d6f877..d965bd52 100644 --- a/ros_gz_bridge/src/convert/tf2_msgs.cpp +++ b/ros_gz_bridge/src/convert/tf2_msgs.cpp @@ -44,9 +44,15 @@ convert_gz_to_ros( tf2_msgs::msg::TFMessage & ros_msg) { ros_msg.transforms.clear(); + builtin_interfaces::msg::Time ros_stamp; + convert_gz_to_ros(gz_msg.header().stamp(), ros_stamp); + for (auto const & p : gz_msg.pose()) { geometry_msgs::msg::TransformStamped tf; convert_gz_to_ros(p, tf); + tf.header.stamp = ros_stamp; + tf.header.frame_id = "world"; + tf.child_frame_id = p.name(); ros_msg.transforms.push_back(tf); } }