From 58c7e1d487f366c34238106186a612d7dd27742f Mon Sep 17 00:00:00 2001 From: chy <1274653465@qq.com> Date: Wed, 20 Nov 2024 20:25:21 +0800 Subject: [PATCH] Add conditional compilation to TFMessageMsgSerializer for ROS2 --- .../Scripts/Serializers/Tf2Msgs/TFMessageMsgSerializer.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/Tf2Msgs/TFMessageMsgSerializer.cs b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/Tf2Msgs/TFMessageMsgSerializer.cs index e5b199de..a894cdbc 100644 --- a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/Tf2Msgs/TFMessageMsgSerializer.cs +++ b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/Tf2Msgs/TFMessageMsgSerializer.cs @@ -38,7 +38,10 @@ public override TFMessageMsg Serialize() TransformStampedMsg transform = new TransformStampedMsg(); transform.header = new HeaderMsg(); transform.header.stamp = headerMsg.stamp; +#if ROS2 +#else transform.header.seq = headerMsg.seq; +#endif transform.header.frame_id = data.frame_id_parent; transform.child_frame_id = data.frame_id_child; transform.transform.translation = data.position.To();