From f1819abfe9f5acc4ba943bcc950a9c7a2b481088 Mon Sep 17 00:00:00 2001 From: Autumn60 Date: Mon, 19 Feb 2024 15:07:55 +0900 Subject: [PATCH 1/4] Create Interface attribute --- .../Editor/Attributes/InterfaceDrawer.cs | 62 +++++++++++++++++++ .../Editor/Attributes/InterfaceDrawer.cs.meta | 11 ++++ .../Scripts/Attributes/InterfaceAttribute.cs | 15 +++++ .../Attributes/InterfaceAttribute.cs.meta | 11 ++++ 4 files changed, 99 insertions(+) create mode 100644 Assets/UnitySensors/Editor/Attributes/InterfaceDrawer.cs create mode 100644 Assets/UnitySensors/Editor/Attributes/InterfaceDrawer.cs.meta create mode 100644 Assets/UnitySensors/Runtime/Scripts/Attributes/InterfaceAttribute.cs create mode 100644 Assets/UnitySensors/Runtime/Scripts/Attributes/InterfaceAttribute.cs.meta diff --git a/Assets/UnitySensors/Editor/Attributes/InterfaceDrawer.cs b/Assets/UnitySensors/Editor/Attributes/InterfaceDrawer.cs new file mode 100644 index 00000000..9f164b91 --- /dev/null +++ b/Assets/UnitySensors/Editor/Attributes/InterfaceDrawer.cs @@ -0,0 +1,62 @@ +using UnityEngine; +using UnityEditor; + +namespace UnitySensors.Attribute +{ + [CustomPropertyDrawer(typeof(InterfaceAttribute))] + public class InterfaceTypeDrawer : PropertyDrawer + { + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + InterfaceAttribute ia = attribute as InterfaceAttribute; + + if (property.propertyType != SerializedPropertyType.ObjectReference) return; + + MonoBehaviour old = property.objectReferenceValue as MonoBehaviour; + + GameObject temp = null; + string oldName = ""; + + if (Event.current.type == EventType.Repaint) + { + if (old == null) + { + temp = new GameObject("None [" + ia.type.Name + "]"); + old = temp.AddComponent(); + } + else + { + oldName = old.name; + old.name = oldName + " [" + ia.type.Name + "]"; + } + } + + MonoBehaviour present = EditorGUI.ObjectField(position, label, old, typeof(MonoBehaviour), true) as MonoBehaviour; + + if (Event.current.type == EventType.Repaint) + { + if (temp != null) + GameObject.DestroyImmediate(temp); + else + old.name = oldName; + } + + if (old == present) return; + + if (present != null) + { + if (present.GetType() != ia.type) + present = present.gameObject.GetComponent(ia.type) as MonoBehaviour; + + if (present == null) return; + } + + property.objectReferenceValue = present; + property.serializedObject.ApplyModifiedProperties(); + } + } + + public class Interface : MonoBehaviour + { + } +} \ No newline at end of file diff --git a/Assets/UnitySensors/Editor/Attributes/InterfaceDrawer.cs.meta b/Assets/UnitySensors/Editor/Attributes/InterfaceDrawer.cs.meta new file mode 100644 index 00000000..4046c3fa --- /dev/null +++ b/Assets/UnitySensors/Editor/Attributes/InterfaceDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a9ccf69e968a50843add123f3c020fd6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/UnitySensors/Runtime/Scripts/Attributes/InterfaceAttribute.cs b/Assets/UnitySensors/Runtime/Scripts/Attributes/InterfaceAttribute.cs new file mode 100644 index 00000000..f35c1c8c --- /dev/null +++ b/Assets/UnitySensors/Runtime/Scripts/Attributes/InterfaceAttribute.cs @@ -0,0 +1,15 @@ +using UnityEngine; +using System; + +namespace UnitySensors.Attribute +{ + public class InterfaceAttribute : PropertyAttribute + { + public Type type; + + public InterfaceAttribute(Type type) + { + this.type = type; + } + } +} \ No newline at end of file diff --git a/Assets/UnitySensors/Runtime/Scripts/Attributes/InterfaceAttribute.cs.meta b/Assets/UnitySensors/Runtime/Scripts/Attributes/InterfaceAttribute.cs.meta new file mode 100644 index 00000000..bcdb5e6f --- /dev/null +++ b/Assets/UnitySensors/Runtime/Scripts/Attributes/InterfaceAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4c76b944835877e4a994d87989fd4e3a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From ee4cd31be77c110b606183d0ae594ec1a28ef604 Mon Sep 17 00:00:00 2001 From: Autumn60 Date: Mon, 19 Feb 2024 15:08:19 +0900 Subject: [PATCH 2/4] Update visualizers --- .../DepthCameraPointCloudVisualizer.cs | 11 ++++++++ .../PointCloud/LiDARPointCloudVisualizer.cs | 13 ++++++++- .../RGBDCameraPointCloudVisualizer.cs | 13 ++++++++- .../Sensor/PointCloudVisualizer.cs | 27 +++++++++++-------- .../Visualizers/Sensor/TextureVisualizer.cs | 20 +++++++++----- .../Runtime/Scripts/Visualizers/Visualizer.cs | 16 +---------- 6 files changed, 65 insertions(+), 35 deletions(-) diff --git a/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/PointCloud/DepthCameraPointCloudVisualizer.cs b/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/PointCloud/DepthCameraPointCloudVisualizer.cs index 9664a5cc..6f7faaa1 100644 --- a/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/PointCloud/DepthCameraPointCloudVisualizer.cs +++ b/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/PointCloud/DepthCameraPointCloudVisualizer.cs @@ -1,8 +1,19 @@ +using UnityEngine; +using UnitySensors.Attribute; using UnitySensors.DataType.Sensor.PointCloud; +using UnitySensors.Interface.Sensor; namespace UnitySensors.Visualization.Sensor { public class DepthCameraPointCloudVisualizer : PointCloudVisualizer { + [SerializeField, Interface(typeof(IPointCloudInterface))] + private Object _source; + + protected override void Start() + { + base.SetSource(_source as IPointCloudInterface); + base.Start(); + } } } \ No newline at end of file diff --git a/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/PointCloud/LiDARPointCloudVisualizer.cs b/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/PointCloud/LiDARPointCloudVisualizer.cs index e2897703..b50631ea 100644 --- a/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/PointCloud/LiDARPointCloudVisualizer.cs +++ b/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/PointCloud/LiDARPointCloudVisualizer.cs @@ -1,8 +1,19 @@ +using UnityEngine; +using UnitySensors.Attribute; using UnitySensors.DataType.Sensor.PointCloud; +using UnitySensors.Interface.Sensor; namespace UnitySensors.Visualization.Sensor { public class LiDARPointCloudVisualizer : PointCloudVisualizer { + [SerializeField, Interface(typeof(IPointCloudInterface))] + private Object _source; + + protected override void Start() + { + base.SetSource(_source as IPointCloudInterface); + base.Start(); + } } -} +} \ No newline at end of file diff --git a/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/PointCloud/RGBDCameraPointCloudVisualizer.cs b/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/PointCloud/RGBDCameraPointCloudVisualizer.cs index 3e73fe6b..57263a63 100644 --- a/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/PointCloud/RGBDCameraPointCloudVisualizer.cs +++ b/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/PointCloud/RGBDCameraPointCloudVisualizer.cs @@ -1,8 +1,19 @@ +using UnityEngine; +using UnitySensors.Attribute; using UnitySensors.DataType.Sensor.PointCloud; +using UnitySensors.Interface.Sensor; namespace UnitySensors.Visualization.Sensor { public class RGBDCameraPointCloudVisualizer : PointCloudVisualizer { + [SerializeField, Interface(typeof(IPointCloudInterface))] + private Object _source; + + protected override void Start() + { + base.SetSource(_source as IPointCloudInterface); + base.Start(); + } } -} +} \ No newline at end of file diff --git a/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/PointCloudVisualizer.cs b/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/PointCloudVisualizer.cs index 5104b21a..9f25a97f 100644 --- a/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/PointCloudVisualizer.cs +++ b/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/PointCloudVisualizer.cs @@ -1,14 +1,16 @@ using UnityEngine; +using UnitySensors.Attribute; using UnitySensors.Interface.Sensor; using UnitySensors.Interface.Sensor.PointCloud; +using UnitySensors.Sensor; using UnitySensors.Utils.PointCloud; namespace UnitySensors.Visualization.Sensor { public class PointCloudVisualizer : Visualizer where T : struct, IPointInterface { + private IPointCloudInterface _sourceInterface; private Transform _transform; - private IPointCloudInterface _source; private Material _mat; private Mesh _mesh; @@ -19,11 +21,14 @@ public class PointCloudVisualizer : Visualizer where T : struct, IPointInterf private int _cachedPointsCount = -1; private int _bufferSize; - protected override void Init(MonoBehaviour source) + public void SetSource(IPointCloudInterface sourceInterface) { - Debug.Assert(source is IPointCloudInterface, "No compatibility between source and visualizer.", this); - _transform = source.transform; - _source = (IPointCloudInterface)source; + _sourceInterface = sourceInterface; + } + + protected virtual void Start() + { + _transform = this.transform; _bufferSize = PointUtilities.pointDataSizes[typeof(T)]; _mat = new Material(Shader.Find(PointUtilities.shaderNames[typeof(T)])); _mat.renderQueue = 3000; @@ -36,9 +41,9 @@ protected override void Init(MonoBehaviour source) protected override void Visualize() { - if (_source.pointsNum != _cachedPointsCount) UpdateBuffers(); + if (_sourceInterface.pointsNum != _cachedPointsCount) UpdateBuffers(); _mat.SetMatrix("LocalToWorldMatrix", _transform.localToWorldMatrix); - _pointsBuffer.SetData(_source.pointCloud.points); + _pointsBuffer.SetData(_sourceInterface.pointCloud.points); } private void Update() @@ -49,16 +54,16 @@ private void Update() private void UpdateBuffers() { if (_pointsBuffer != null) _pointsBuffer.Release(); - _pointsBuffer = new ComputeBuffer(_source.pointsNum, _bufferSize); - _pointsBuffer.SetData(_source.pointCloud.points); + _pointsBuffer = new ComputeBuffer(_sourceInterface.pointsNum, _bufferSize); + _pointsBuffer.SetData(_sourceInterface.pointCloud.points); _mat.SetBuffer("PointsBuffer", _pointsBuffer); uint numIndices = (_mesh != null) ? (uint)_mesh.GetIndexCount(0) : 0; _args[0] = numIndices; - _args[1] = (uint)_source.pointsNum; + _args[1] = (uint)_sourceInterface.pointsNum; _argsBuffer.SetData(_args); - _cachedPointsCount = _source.pointsNum; + _cachedPointsCount = _sourceInterface.pointsNum; } private void OnDisable() diff --git a/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/TextureVisualizer.cs b/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/TextureVisualizer.cs index c8f7cb59..4e9cca94 100644 --- a/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/TextureVisualizer.cs +++ b/Assets/UnitySensors/Runtime/Scripts/Visualizers/Sensor/TextureVisualizer.cs @@ -1,5 +1,6 @@ using UnityEngine; using UnityEngine.UI; +using UnitySensors.Attribute; using UnitySensors.Sensor; using UnitySensors.Interface.Sensor; @@ -13,23 +14,28 @@ private enum SourceTexture Texture1 } - [SerializeField] - private RawImage _image; + [SerializeField, Interface(typeof(ITextureInterface))] + private Object _source; [SerializeField] private SourceTexture _sourceTexture; + [SerializeField] + private RawImage _image; - private ITextureInterface _source; + private ITextureInterface _sourceInterface; - protected override void Init(MonoBehaviour source) + private void Start() { - Debug.Assert(source is ITextureInterface, "No compatibility between source and visualizer.", this); - _source = (ITextureInterface)source; + _sourceInterface = _source as ITextureInterface; + if(_source is UnitySensor) + { + (_source as UnitySensor).onSensorUpdated += Visualize; + } } protected override void Visualize() { if (!_image) return; - _image.texture = _sourceTexture == SourceTexture.Texture0 ? _source.texture0 : _source.texture1; + _image.texture = _sourceTexture == SourceTexture.Texture0 ? _sourceInterface.texture0 : _sourceInterface.texture1; } } } \ No newline at end of file diff --git a/Assets/UnitySensors/Runtime/Scripts/Visualizers/Visualizer.cs b/Assets/UnitySensors/Runtime/Scripts/Visualizers/Visualizer.cs index 7ef19295..bab5d64f 100644 --- a/Assets/UnitySensors/Runtime/Scripts/Visualizers/Visualizer.cs +++ b/Assets/UnitySensors/Runtime/Scripts/Visualizers/Visualizer.cs @@ -1,25 +1,11 @@ using UnityEngine; +using UnitySensors.Attribute; using UnitySensors.Sensor; namespace UnitySensors.Visualization { public abstract class Visualizer : MonoBehaviour { - [SerializeField] - private MonoBehaviour _source; - - private void Start() - { - if(_source is UnitySensor) - { - UnitySensor sensor = (UnitySensor)_source; - sensor.onSensorUpdated += Visualize; - } - - Init(_source); - } - - protected abstract void Init(MonoBehaviour source); protected abstract void Visualize(); } } From 193973c7fb58aaa50bae9632112a9e1db6c40429 Mon Sep 17 00:00:00 2001 From: Autumn60 Date: Mon, 19 Feb 2024 15:08:51 +0900 Subject: [PATCH 3/4] Update serializers and publishers --- .../Scripts/Publishers/RosMsgPublisher.cs | 15 +----------- .../DepthCameraPointCloud2MsgPublisher.cs | 10 ++++++++ .../LiDARPointCloud2MsgPublisher.cs | 10 ++++++++ .../RGBDCameraPointCloud2MsgPublisher.cs | 10 ++++++++ .../SensorMsgs/PointCloud2MsgPublisher.cs | 2 +- .../GeometryMsgs/PoseStampedMsgSerializer.cs | 22 ++++++++--------- .../SensorMsgs/CameraInfoMsgSerializer.cs | 21 ++++++++-------- .../CompressedImageMsgSerializer.cs | 20 +++++++--------- .../SensorMsgs/IMUMsgSerializer.cs | 24 +++++++++---------- .../SensorMsgs/NavSatFixMsgSerializer.cs | 24 +++++++++---------- .../SensorMsgs/PointCloud2MsgSerializer.cs | 23 +++++++++--------- .../Runtime/Scripts/Serializers/Serializer.cs | 3 +-- .../Serializers/StdMsgs/HeaderSerializer.cs | 22 ++++++++--------- .../Tf2Msgs/TFMessageMsgSerializer.cs | 16 ++++--------- 14 files changed, 110 insertions(+), 112 deletions(-) diff --git a/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/RosMsgPublisher.cs b/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/RosMsgPublisher.cs index 0226576b..b379b444 100644 --- a/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/RosMsgPublisher.cs +++ b/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/RosMsgPublisher.cs @@ -2,16 +2,12 @@ using Unity.Robotics.ROSTCPConnector; using Unity.Robotics.ROSTCPConnector.MessageGeneration; -using UnitySensors.Sensor; using UnitySensors.ROS.Serializer; namespace UnitySensors.ROS.Publisher { public class RosMsgPublisher : MonoBehaviour where T : RosMsgSerializer where TT : Message, new() { - [SerializeField] - protected MonoBehaviour _source; - [SerializeField] private float _frequency = 10.0f; @@ -36,8 +32,7 @@ protected virtual void Start() _ros = ROSConnection.GetOrCreateInstance(); _ros.RegisterPublisher(_topicName); - Debug.Assert(_serializer.IsCompatible(_source), "No compatibility between source and serializer.", this); - _serializer.Init(_source); + _serializer.Init(); } protected virtual void Update() @@ -54,13 +49,5 @@ private void OnDestroy() { _serializer.OnDestroy(); } - - private void OnValidate() - { - if (_serializer == null || _source == null) return; - if (_serializer.IsCompatible(_source)) return; - Debug.Assert(_serializer.IsCompatible(_source), "No compatibility between source and serializer.", this); - _source = null; - } } } diff --git a/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/SensorMsgs/PointCloud2Msg/DepthCameraPointCloud2MsgPublisher.cs b/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/SensorMsgs/PointCloud2Msg/DepthCameraPointCloud2MsgPublisher.cs index 84be051d..2f4f41e0 100644 --- a/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/SensorMsgs/PointCloud2Msg/DepthCameraPointCloud2MsgPublisher.cs +++ b/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/SensorMsgs/PointCloud2Msg/DepthCameraPointCloud2MsgPublisher.cs @@ -1,8 +1,18 @@ +using UnityEngine; +using UnitySensors.Attribute; using UnitySensors.DataType.Sensor.PointCloud; +using UnitySensors.Interface.Sensor; namespace UnitySensors.ROS.Publisher.Sensor { public class DepthCameraPointCloud2MsgPublisher : PointCloud2MsgPublisher { + [SerializeField, Interface(typeof(IPointCloudInterface))] + private Object _source; + + private void Awake() + { + _serializer.SetSource(_source as IPointCloudInterface); + } } } \ No newline at end of file diff --git a/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/SensorMsgs/PointCloud2Msg/LiDARPointCloud2MsgPublisher.cs b/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/SensorMsgs/PointCloud2Msg/LiDARPointCloud2MsgPublisher.cs index 6d9f13f5..171836a7 100644 --- a/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/SensorMsgs/PointCloud2Msg/LiDARPointCloud2MsgPublisher.cs +++ b/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/SensorMsgs/PointCloud2Msg/LiDARPointCloud2MsgPublisher.cs @@ -1,8 +1,18 @@ +using UnityEngine; +using UnitySensors.Attribute; using UnitySensors.DataType.Sensor.PointCloud; +using UnitySensors.Interface.Sensor; namespace UnitySensors.ROS.Publisher.Sensor { public class LiDARPointCloud2MsgPublisher : PointCloud2MsgPublisher { + [SerializeField, Interface(typeof(IPointCloudInterface))] + private Object _source; + + private void Awake() + { + _serializer.SetSource(_source as IPointCloudInterface); + } } } \ No newline at end of file diff --git a/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/SensorMsgs/PointCloud2Msg/RGBDCameraPointCloud2MsgPublisher.cs b/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/SensorMsgs/PointCloud2Msg/RGBDCameraPointCloud2MsgPublisher.cs index d5eec7e7..a4a95de6 100644 --- a/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/SensorMsgs/PointCloud2Msg/RGBDCameraPointCloud2MsgPublisher.cs +++ b/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/SensorMsgs/PointCloud2Msg/RGBDCameraPointCloud2MsgPublisher.cs @@ -1,8 +1,18 @@ +using UnityEngine; +using UnitySensors.Attribute; using UnitySensors.DataType.Sensor.PointCloud; +using UnitySensors.Interface.Sensor; namespace UnitySensors.ROS.Publisher.Sensor { public class RGBDCameraPointCloud2MsgPublisher : PointCloud2MsgPublisher { + [SerializeField, Interface(typeof(IPointCloudInterface))] + private Object _source; + + private void Awake() + { + _serializer.SetSource(_source as IPointCloudInterface); + } } } \ No newline at end of file diff --git a/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/SensorMsgs/PointCloud2MsgPublisher.cs b/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/SensorMsgs/PointCloud2MsgPublisher.cs index 2a99b701..398655ac 100644 --- a/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/SensorMsgs/PointCloud2MsgPublisher.cs +++ b/Assets/UnitySensorsROS/Runtime/Scripts/Publishers/SensorMsgs/PointCloud2MsgPublisher.cs @@ -5,7 +5,7 @@ namespace UnitySensors.ROS.Publisher.Sensor { - public class PointCloud2MsgPublisher : RosMsgPublisher, PointCloud2Msg> where T : struct, IPointInterface + public abstract class PointCloud2MsgPublisher : RosMsgPublisher, PointCloud2Msg> where T : struct, IPointInterface { } } diff --git a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/GeometryMsgs/PoseStampedMsgSerializer.cs b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/GeometryMsgs/PoseStampedMsgSerializer.cs index 36869cf7..60c28dd9 100644 --- a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/GeometryMsgs/PoseStampedMsgSerializer.cs +++ b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/GeometryMsgs/PoseStampedMsgSerializer.cs @@ -3,6 +3,7 @@ using Unity.Robotics.ROSTCPConnector.ROSGeometry; using RosMessageTypes.Geometry; +using UnitySensors.Attribute; using UnitySensors.Interface.Geometry; using UnitySensors.ROS.Serializer.Std; @@ -11,29 +12,26 @@ namespace UnitySensors.ROS.Serializer.Geometry [System.Serializable] public class PoseStampedMsgSerializer : RosMsgSerializer { + [SerializeField, Interface(typeof(IPoseInterface))] + private Object _source; [SerializeField] private HeaderSerializer _header; - private IPoseInterface _source; + private IPoseInterface _sourceInterface; - public override void Init(MonoBehaviour source) + public override void Init() { - base.Init(source); - _header.Init(source); - _source = (IPoseInterface)source; + base.Init(); + _header.Init(); + _sourceInterface = _source as IPoseInterface; } public override PoseStampedMsg Serialize() { _msg.header = _header.Serialize(); - _msg.pose.position = _source.position.To(); - _msg.pose.orientation = _source.rotation.To(); + _msg.pose.position = _sourceInterface.position.To(); + _msg.pose.orientation = _sourceInterface.rotation.To(); return _msg; } - - public override bool IsCompatible(MonoBehaviour source) - { - return (_header.IsCompatible(source) && source is IPoseInterface); - } } } diff --git a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/CameraInfoMsgSerializer.cs b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/CameraInfoMsgSerializer.cs index af315e4e..e54587b1 100644 --- a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/CameraInfoMsgSerializer.cs +++ b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/CameraInfoMsgSerializer.cs @@ -2,6 +2,7 @@ using Unity.Robotics.ROSTCPConnector.MessageGeneration; using RosMessageTypes.Sensor; +using UnitySensors.Attribute; using UnitySensors.Interface.Sensor; using UnitySensors.ROS.Serializer.Std; @@ -10,27 +11,25 @@ namespace UnitySensors.ROS.Serializer.Sensor [System.Serializable] public class CameraInfoMsgSerializer : RosMsgSerializer { + [SerializeField, Interface(typeof(ICameraInterface))] + private Object _source; + [SerializeField] private HeaderSerializer _header; - private ICameraInterface _source; + private ICameraInterface _sourceInterface; - public override void Init(MonoBehaviour source) + public override void Init() { - base.Init(source); - _header.Init(source); - _source = (ICameraInterface)source; + base.Init(); + _header.Init(); + _sourceInterface = _source as ICameraInterface; } public override CameraInfoMsg Serialize() { - _msg = CameraInfoGenerator.ConstructCameraInfoMessage(_source.m_camera, _header.Serialize()); + _msg = CameraInfoGenerator.ConstructCameraInfoMessage(_sourceInterface.m_camera, _header.Serialize()); return _msg; } - - public override bool IsCompatible(MonoBehaviour source) - { - return (_header.IsCompatible(source) && source is ICameraInterface); - } } } diff --git a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/CompressedImageMsgSerializer.cs b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/CompressedImageMsgSerializer.cs index 8162a06d..11dc8844 100644 --- a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/CompressedImageMsgSerializer.cs +++ b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/CompressedImageMsgSerializer.cs @@ -2,6 +2,7 @@ using RosMessageTypes.Sensor; +using UnitySensors.Attribute; using UnitySensors.Interface.Sensor; using UnitySensors.ROS.Serializer.Std; @@ -16,6 +17,8 @@ private enum SourceTexture Texture1 } + [SerializeField, Interface(typeof(ITextureInterface))] + private Object _source; [SerializeField] private SourceTexture _sourceTexture; @@ -24,26 +27,21 @@ private enum SourceTexture [SerializeField, Range(1, 100)] private int quality = 75; - private ITextureInterface _source; + private ITextureInterface _sourceInterface; - public override void Init(MonoBehaviour source) + public override void Init() { - base.Init(source); - _header.Init(source); - _source = (ITextureInterface)source; + base.Init(); + _header.Init(); + _sourceInterface = _source as ITextureInterface; _msg.format = "jpeg"; } public override CompressedImageMsg Serialize() { _msg.header = _header.Serialize(); - _msg.data = (_sourceTexture == SourceTexture.Texture0 ? _source.texture0 : _source.texture1).EncodeToJPG(quality); + _msg.data = (_sourceTexture == SourceTexture.Texture0 ? _sourceInterface.texture0 : _sourceInterface.texture1).EncodeToJPG(quality); return _msg; } - - public override bool IsCompatible(MonoBehaviour source) - { - return (_header.IsCompatible(source) && source is ITextureInterface); - } } } diff --git a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/IMUMsgSerializer.cs b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/IMUMsgSerializer.cs index cb91ae76..95a4fafd 100644 --- a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/IMUMsgSerializer.cs +++ b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/IMUMsgSerializer.cs @@ -2,6 +2,7 @@ using Unity.Robotics.ROSTCPConnector.ROSGeometry; using RosMessageTypes.Sensor; +using UnitySensors.Attribute; using UnitySensors.Interface.Sensor; using UnitySensors.ROS.Serializer.Std; @@ -10,30 +11,27 @@ namespace UnitySensors.ROS.Serializer.Sensor [System.Serializable] public class IMUMsgSerializer : RosMsgSerializer { + [SerializeField, Interface(typeof(IImuDataInterface))] + private Object _source; [SerializeField] private HeaderSerializer _header; - private IImuDataInterface _source; + private IImuDataInterface _sourceInterface; - public override void Init(MonoBehaviour source) + public override void Init() { - base.Init(source); - _header.Init(source); - _source = (IImuDataInterface)source; + base.Init(); + _header.Init(); + _sourceInterface = _source as IImuDataInterface; } public override ImuMsg Serialize() { _msg.header = _header.Serialize(); - _msg.linear_acceleration = _source.acceleration.To(); - _msg.orientation = _source.rotation.To(); - _msg.angular_velocity = _source.angularVelocity.To(); + _msg.linear_acceleration = _sourceInterface.acceleration.To(); + _msg.orientation = _sourceInterface.rotation.To(); + _msg.angular_velocity = _sourceInterface.angularVelocity.To(); return _msg; } - - public override bool IsCompatible(MonoBehaviour source) - { - return (_header.IsCompatible(source) && source is IImuDataInterface); - } } } diff --git a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/NavSatFixMsgSerializer.cs b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/NavSatFixMsgSerializer.cs index f25597b2..12a84c82 100644 --- a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/NavSatFixMsgSerializer.cs +++ b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/NavSatFixMsgSerializer.cs @@ -1,6 +1,7 @@ using UnityEngine; using RosMessageTypes.Sensor; +using UnitySensors.Attribute; using UnitySensors.Interface.Geometry; using UnitySensors.ROS.Serializer.Std; @@ -25,6 +26,8 @@ private enum Service GALILEO } + [SerializeField, Interface(typeof(IGeoCoordinateInterface))] + private Object _source; [SerializeField] private HeaderSerializer _header; @@ -33,13 +36,13 @@ private enum Service [SerializeField] private Service _service = Service.GPS; - private IGeoCoordinateInterface _source; + private IGeoCoordinateInterface _sourceInterface; - public override void Init(MonoBehaviour source) + public override void Init() { - base.Init(source); - _header.Init(source); - _source = (IGeoCoordinateInterface)source; + base.Init(); + _header.Init(); + _sourceInterface = _source as IGeoCoordinateInterface; _msg.status = new NavSatStatusMsg(); _msg.status.service = (ushort)Mathf.Pow(2, (int)(_service)); @@ -49,16 +52,11 @@ public override NavSatFixMsg Serialize() { _msg.header = _header.Serialize(); _msg.status.status = (sbyte)((int)(_status) - 1); - _msg.latitude = _source.coordinate.latitude; - _msg.longitude = _source.coordinate.longitude; - _msg.altitude = _source.coordinate.altitude; + _msg.latitude = _sourceInterface.coordinate.latitude; + _msg.longitude = _sourceInterface.coordinate.longitude; + _msg.altitude = _sourceInterface.coordinate.altitude; _msg.position_covariance_type = 0; return _msg; } - - public override bool IsCompatible(MonoBehaviour source) - { - return (_header.IsCompatible(source) && source is IGeoCoordinateInterface); - } } } \ No newline at end of file diff --git a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/PointCloud2MsgSerializer.cs b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/PointCloud2MsgSerializer.cs index d35efaea..fae25d77 100644 --- a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/PointCloud2MsgSerializer.cs +++ b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/SensorMsgs/PointCloud2MsgSerializer.cs @@ -18,20 +18,24 @@ public class PointCloud2MsgSerializer : RosMsgSerializer wher [SerializeField] private HeaderSerializer _header; - private IPointCloudInterface _source; + protected IPointCloudInterface _sourceInterface; private int _pointsNum; private JobHandle _jobHandle; private IInvertXJob _invertXJob; private NativeArray _data; - public override void Init(MonoBehaviour source) + public void SetSource(IPointCloudInterface sourceInterface) { - base.Init(source); - _header.Init(source); + _sourceInterface = sourceInterface; + } + + public override void Init() + { + base.Init(); + _header.Init(); - _source = (IPointCloudInterface)source; - _pointsNum = _source.pointCloud.points.Length; + _pointsNum = _sourceInterface.pointCloud.points.Length; int sizeOfPoint = PointUtilities.pointDataSizes[typeof(T)]; int dataSize = _pointsNum * sizeOfPoint; @@ -59,7 +63,7 @@ public override PointCloud2Msg Serialize() unsafe { - UnsafeUtility.MemCpy(NativeArrayUnsafeUtility.GetUnsafePtr(_data), NativeArrayUnsafeUtility.GetUnsafePtr(_source.pointCloud.points), _data.Length); + UnsafeUtility.MemCpy(NativeArrayUnsafeUtility.GetUnsafePtr(_data), NativeArrayUnsafeUtility.GetUnsafePtr(_sourceInterface.pointCloud.points), _data.Length); } _jobHandle = _invertXJob.Schedule(_pointsNum, 1); _jobHandle.Complete(); @@ -74,10 +78,5 @@ public override void OnDestroy() _jobHandle.Complete(); if (_data.IsCreated) _data.Dispose(); } - - public override bool IsCompatible(MonoBehaviour source) - { - return (_header.IsCompatible(source) && source is IPointCloudInterface); - } } } \ No newline at end of file diff --git a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/Serializer.cs b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/Serializer.cs index 456dd146..df21fb94 100644 --- a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/Serializer.cs +++ b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/Serializer.cs @@ -9,9 +9,8 @@ namespace UnitySensors.ROS.Serializer protected T _msg; public T msg { get => _msg; } - public virtual void Init(MonoBehaviour source) { _msg = new T(); } + public virtual void Init() { _msg = new T(); } public abstract T Serialize(); public virtual void OnDestroy() { } - public abstract bool IsCompatible(MonoBehaviour source); } } diff --git a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/StdMsgs/HeaderSerializer.cs b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/StdMsgs/HeaderSerializer.cs index 00e4deb9..4ad1cc30 100644 --- a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/StdMsgs/HeaderSerializer.cs +++ b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/StdMsgs/HeaderSerializer.cs @@ -2,6 +2,7 @@ using UnityEngine; using RosMessageTypes.Std; +using UnitySensors.Attribute; using UnitySensors.Interface.Std; namespace UnitySensors.ROS.Serializer.Std @@ -9,15 +10,17 @@ namespace UnitySensors.ROS.Serializer.Std [System.Serializable] public class HeaderSerializer : RosMsgSerializer { + [SerializeField, Interface(typeof(ITimeInterface))] + private UnityEngine.Object _source; [SerializeField] private string _frame_id; - private ITimeInterface _source; + private ITimeInterface _sourceInterface; - public override void Init(MonoBehaviour source) + public override void Init() { - base.Init(source); - _source = (ITimeInterface)source; + base.Init(); + _sourceInterface = _source as ITimeInterface; _msg = new HeaderMsg(); @@ -31,22 +34,17 @@ public override void Init(MonoBehaviour source) public override HeaderMsg Serialize() { #if ROS2 - int sec = (int)Math.Truncate(_source.time); + int sec = (int)Math.Truncate(_sourceInterface.time); #else - uint sec = (uint)Math.Truncate(_source.time); + uint sec = (uint)Math.Truncate(_sourceInterface.time); #endif _msg.stamp.sec = sec; - _msg.stamp.nanosec = (uint)((_source.time - sec) * 1e+9); + _msg.stamp.nanosec = (uint)((_sourceInterface.time - sec) * 1e+9); #if ROS2 #else _msg.seq++; #endif return _msg; } - - public override bool IsCompatible(MonoBehaviour source) - { - return (source is ITimeInterface); - } } } diff --git a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/Tf2Msgs/TFMessageMsgSerializer.cs b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/Tf2Msgs/TFMessageMsgSerializer.cs index 52c35605..b6b700e8 100644 --- a/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/Tf2Msgs/TFMessageMsgSerializer.cs +++ b/Assets/UnitySensorsROS/Runtime/Scripts/Serializers/Tf2Msgs/TFMessageMsgSerializer.cs @@ -17,15 +17,14 @@ namespace UnitySensors.ROS.Serializer.Tf2 public class TFMessageMsgSerializer : RosMsgSerializer { [SerializeField] - private HeaderSerializer _header; - private TFLink _source; + [SerializeField] + private HeaderSerializer _header; - public override void Init(MonoBehaviour source) + public override void Init() { - base.Init(source); - _header.Init(source); - _source = (TFLink)source; + base.Init(); + _header.Init(); } public override TFMessageMsg Serialize() @@ -48,10 +47,5 @@ public override TFMessageMsg Serialize() _msg.transforms = transforms.ToArray(); return _msg; } - - public override bool IsCompatible(MonoBehaviour source) - { - return (_header.IsCompatible(source) && source is TFLink); - } } } \ No newline at end of file From 0b91263e9e98a8dac28a3c364de8d2b8e9724063 Mon Sep 17 00:00:00 2001 From: Autumn60 Date: Mon, 19 Feb 2024 15:08:59 +0900 Subject: [PATCH 4/4] Update prefabs --- .../UnitySensors/Runtime/Prefabs/Camera/RGBCamera.prefab | 2 +- .../Runtime/Prefabs/Camera/RGBDCamera.prefab | 2 +- .../Runtime/Prefabs/Camera/DepthCamera_ros.prefab | 9 ++++++--- .../Runtime/Prefabs/Camera/RGBCamera_ros.prefab | 6 ++++-- .../UnitySensorsROS/Runtime/Prefabs/GNSS/GNSS_ros.prefab | 3 ++- .../Runtime/Prefabs/GroundTruth/GroundTruth_ros.prefab | 3 ++- .../UnitySensorsROS/Runtime/Prefabs/IMU/IMU_ros.prefab | 3 ++- .../Runtime/Prefabs/LiDAR/Livox/Mid-360_ros.prefab | 3 ++- .../Runtime/Prefabs/LiDAR/Velodyne/VLP-16_ros.prefab | 3 ++- 9 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Assets/UnitySensors/Runtime/Prefabs/Camera/RGBCamera.prefab b/Assets/UnitySensors/Runtime/Prefabs/Camera/RGBCamera.prefab index 18d7ec6e..2a34e64e 100644 --- a/Assets/UnitySensors/Runtime/Prefabs/Camera/RGBCamera.prefab +++ b/Assets/UnitySensors/Runtime/Prefabs/Camera/RGBCamera.prefab @@ -107,5 +107,5 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _source: {fileID: 6023160553514482212} - _image: {fileID: 0} _sourceTexture: 0 + _image: {fileID: 0} diff --git a/Assets/UnitySensors/Runtime/Prefabs/Camera/RGBDCamera.prefab b/Assets/UnitySensors/Runtime/Prefabs/Camera/RGBDCamera.prefab index 8dab67be..a28e1867 100644 --- a/Assets/UnitySensors/Runtime/Prefabs/Camera/RGBDCamera.prefab +++ b/Assets/UnitySensors/Runtime/Prefabs/Camera/RGBDCamera.prefab @@ -122,5 +122,5 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _source: {fileID: 4070371534656761714} - _image: {fileID: 0} _sourceTexture: 0 + _image: {fileID: 0} diff --git a/Assets/UnitySensorsROS/Runtime/Prefabs/Camera/DepthCamera_ros.prefab b/Assets/UnitySensorsROS/Runtime/Prefabs/Camera/DepthCamera_ros.prefab index 4c9f8848..7c6942af 100644 --- a/Assets/UnitySensorsROS/Runtime/Prefabs/Camera/DepthCamera_ros.prefab +++ b/Assets/UnitySensorsROS/Runtime/Prefabs/Camera/DepthCamera_ros.prefab @@ -109,11 +109,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: ca85518969b9bf94aa9948188d795075, type: 3} m_Name: m_EditorClassIdentifier: - _source: {fileID: 4853532333615571030} _frequency: 10 _topicName: /camera/depth/info _serializer: + _source: {fileID: 4853532333615571030} _header: + _source: {fileID: 4853532333615571030} _frame_id: /camera_frame --- !u!114 &9201004833233192004 MonoBehaviour: @@ -127,12 +128,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4840ee4519c33a142a3fb06d6d6b3b50, type: 3} m_Name: m_EditorClassIdentifier: - _source: {fileID: 4853532333615571030} _frequency: 10 _topicName: /camera/depth/points _serializer: _header: + _source: {fileID: 4853532333615571030} _frame_id: /camera_frame + _source: {fileID: 4853532333615571030} --- !u!114 &3086342091309557783 MonoBehaviour: m_ObjectHideFlags: 0 @@ -145,11 +147,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: b474a6242e811f04488e3cb67b65dd35, type: 3} m_Name: m_EditorClassIdentifier: - _source: {fileID: 4853532333615571030} _frequency: 10 _topicName: /camera/depth/image/compressed _serializer: + _source: {fileID: 4853532333615571030} _sourceTexture: 0 _header: + _source: {fileID: 4853532333615571030} _frame_id: /camera_frame quality: 75 diff --git a/Assets/UnitySensorsROS/Runtime/Prefabs/Camera/RGBCamera_ros.prefab b/Assets/UnitySensorsROS/Runtime/Prefabs/Camera/RGBCamera_ros.prefab index b4aaac0d..fac2ba6a 100644 --- a/Assets/UnitySensorsROS/Runtime/Prefabs/Camera/RGBCamera_ros.prefab +++ b/Assets/UnitySensorsROS/Runtime/Prefabs/Camera/RGBCamera_ros.prefab @@ -107,11 +107,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: ca85518969b9bf94aa9948188d795075, type: 3} m_Name: m_EditorClassIdentifier: - _source: {fileID: 2016422477619200576} _frequency: 10 _topicName: /camera/color/info _serializer: + _source: {fileID: 2016422477619200576} _header: + _source: {fileID: 2016422477619200576} _frame_id: /camera_frame --- !u!114 &7476313626036288691 MonoBehaviour: @@ -125,11 +126,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: b474a6242e811f04488e3cb67b65dd35, type: 3} m_Name: m_EditorClassIdentifier: - _source: {fileID: 2016422477619200576} _frequency: 10 _topicName: /camera/color/image/compressed _serializer: + _source: {fileID: 2016422477619200576} _sourceTexture: 0 _header: + _source: {fileID: 2016422477619200576} _frame_id: /camera_frame quality: 75 diff --git a/Assets/UnitySensorsROS/Runtime/Prefabs/GNSS/GNSS_ros.prefab b/Assets/UnitySensorsROS/Runtime/Prefabs/GNSS/GNSS_ros.prefab index 3f5bac83..7e26f6a6 100644 --- a/Assets/UnitySensorsROS/Runtime/Prefabs/GNSS/GNSS_ros.prefab +++ b/Assets/UnitySensorsROS/Runtime/Prefabs/GNSS/GNSS_ros.prefab @@ -63,11 +63,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c11ec5602b9e12544b78d1d2a4bdd5c6, type: 3} m_Name: m_EditorClassIdentifier: - _source: {fileID: 3192925013080293982} _frequency: 10 _topicName: navsat _serializer: + _source: {fileID: 3192925013080293982} _header: + _source: {fileID: 3192925013080293982} _frame_id: map _status: 1 _service: 0 diff --git a/Assets/UnitySensorsROS/Runtime/Prefabs/GroundTruth/GroundTruth_ros.prefab b/Assets/UnitySensorsROS/Runtime/Prefabs/GroundTruth/GroundTruth_ros.prefab index 04db5b7d..caa14f08 100644 --- a/Assets/UnitySensorsROS/Runtime/Prefabs/GroundTruth/GroundTruth_ros.prefab +++ b/Assets/UnitySensorsROS/Runtime/Prefabs/GroundTruth/GroundTruth_ros.prefab @@ -58,9 +58,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 58c946e57b0f2a943abcff0d129aa500, type: 3} m_Name: m_EditorClassIdentifier: - _source: {fileID: 2623422876239157573} _frequency: 10 _topicName: ground_truth _serializer: + _source: {fileID: 2623422876239157573} _header: + _source: {fileID: 2623422876239157573} _frame_id: map diff --git a/Assets/UnitySensorsROS/Runtime/Prefabs/IMU/IMU_ros.prefab b/Assets/UnitySensorsROS/Runtime/Prefabs/IMU/IMU_ros.prefab index a75a0e2d..1ad7c1b2 100644 --- a/Assets/UnitySensorsROS/Runtime/Prefabs/IMU/IMU_ros.prefab +++ b/Assets/UnitySensorsROS/Runtime/Prefabs/IMU/IMU_ros.prefab @@ -63,9 +63,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6c47c42043b800c4a9a6595f963c7c6c, type: 3} m_Name: m_EditorClassIdentifier: - _source: {fileID: 3526848927119471302} _frequency: 20 _topicName: /imu _serializer: + _source: {fileID: 3526848927119471302} _header: + _source: {fileID: 3526848927119471302} _frame_id: imu_link diff --git a/Assets/UnitySensorsROS/Runtime/Prefabs/LiDAR/Livox/Mid-360_ros.prefab b/Assets/UnitySensorsROS/Runtime/Prefabs/LiDAR/Livox/Mid-360_ros.prefab index 053bfb3f..128a6fb5 100644 --- a/Assets/UnitySensorsROS/Runtime/Prefabs/LiDAR/Livox/Mid-360_ros.prefab +++ b/Assets/UnitySensorsROS/Runtime/Prefabs/LiDAR/Livox/Mid-360_ros.prefab @@ -129,12 +129,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 32c6ed908b3e5d74697c679c7798bcc2, type: 3} m_Name: m_EditorClassIdentifier: - _source: {fileID: 7522962572353966418} _frequency: 10 _topicName: /livox/lidar _serializer: _header: + _source: {fileID: 7522962572353966418} _frame_id: livox_frame + _source: {fileID: 7522962572353966418} --- !u!1 &7522962572398341445 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/UnitySensorsROS/Runtime/Prefabs/LiDAR/Velodyne/VLP-16_ros.prefab b/Assets/UnitySensorsROS/Runtime/Prefabs/LiDAR/Velodyne/VLP-16_ros.prefab index 5ffdf5a5..cbfc5818 100644 --- a/Assets/UnitySensorsROS/Runtime/Prefabs/LiDAR/Velodyne/VLP-16_ros.prefab +++ b/Assets/UnitySensorsROS/Runtime/Prefabs/LiDAR/Velodyne/VLP-16_ros.prefab @@ -380,9 +380,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 32c6ed908b3e5d74697c679c7798bcc2, type: 3} m_Name: m_EditorClassIdentifier: - _source: {fileID: 773861080551603223} _frequency: 10 _topicName: /velodyne_points _serializer: _header: + _source: {fileID: 773861080551603223} _frame_id: velodyne_link + _source: {fileID: 773861080551603223}