From 5967d526bc37cf215901a76d99fcf1eb6a650c0f Mon Sep 17 00:00:00 2001 From: Autumn60 Date: Wed, 14 Feb 2024 19:50:50 +0900 Subject: [PATCH 1/2] Delete old code --- .../Scripts/Serializers/TF/TFMsgSerializer.cs | 39 ------------------- 1 file changed, 39 deletions(-) diff --git a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/TF/TFMsgSerializer.cs b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/TF/TFMsgSerializer.cs index 60f7896a..6b11e2c3 100644 --- a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/TF/TFMsgSerializer.cs +++ b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/TF/TFMsgSerializer.cs @@ -46,43 +46,4 @@ public override TFMessageMsg Serialize() return _msg; } } - /* - [System.Serializable] - public class TFSerializer : Serializer - { - - [SerializeField] - private TFMessageMsg _msg; - - private AutoHeader _header; - - public TFMessageMsg msg { get => _msg; } - - public void Init() - { - _msg = new TFMessageMsg(); - _header = new AutoHeader(); - - _header.Init(""); - } - - public TFMessageMsg Serialize(float time, TFData[] tf) - { - _header.Serialize(time); - List transforms = new List(); - foreach(TFData tfData in tf) - { - TransformStampedMsg transform = new TransformStampedMsg(); - transform.header = _header.header; - transform.header.frame_id = tfData.frame_id_parent; - transform.child_frame_id = tfData.frame_id_child; - transform.transform.translation = tfData.position.To(); - transform.transform.rotation = tfData.rotation.To(); - transforms.Add(transform); - } - _msg.transforms = transforms.ToArray(); - return _msg; - } - } - */ } \ No newline at end of file From a3f8e5f8066701726d2cfabbbe454685dae65662 Mon Sep 17 00:00:00 2001 From: Autumn60 Date: Wed, 14 Feb 2024 19:50:58 +0900 Subject: [PATCH 2/2] Fix coordinate calc --- Assets/UnitySensors/Runtime/Scripts/Sensors/TF/TF.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/UnitySensors/Runtime/Scripts/Sensors/TF/TF.cs b/Assets/UnitySensors/Runtime/Scripts/Sensors/TF/TF.cs index ee7d3040..3b5d2a13 100644 --- a/Assets/UnitySensors/Runtime/Scripts/Sensors/TF/TF.cs +++ b/Assets/UnitySensors/Runtime/Scripts/Sensors/TF/TF.cs @@ -54,7 +54,7 @@ public TFData[] GetTFData(string frame_id_parent, Matrix4x4 worldToLocalMatrix, TFData tfData_self; tfData_self.frame_id_parent = frame_id_parent; tfData_self.frame_id_child = _frame_id; - tfData_self.position = worldToLocalMatrix * _transform.position; + tfData_self.position = (Vector3)(worldToLocalMatrix * new Vector4(_transform.position.x, _transform.position.y, _transform.position.z, 1.0f)); tfData_self.rotation = worldToLocalQuaternion * _transform.rotation; tfData.Add(tfData_self);