Skip to content

Commit

Permalink
Commonisation of serializers and publishers. (#148) (#163)
Browse files Browse the repository at this point in the history
* Change ROSClock location

* Change GroundTruthEditor location

* Delete TFEditor from UnitySensor

* Separate Data namespace to DataType and Interface

* Create UnitySensorsROSEditor.asmdef

* Move TF from UnitySensors to UnitySensorsROS

* Update GeoCoordinateConverter

* Create TFLinkEditor

* Delete custom ros msgs

* Delete TFMsgSerializer and Publisher

* Update Serializer.cs

* Update RosMsgPublisher.cs

* Update Visualizer.cs

* Update UnitySensor.cs

* Update GNSS scripts

* Update GroundTruth.cs

* Update IMUSensor.cs

* Update HeaderMsgSerializer

* Create PointUtilitites

* Delete NMEA serializer and publisher

* Update tf scripts

* Delete PointCloud2Msg serializer and publisher

* Delete PoseStampedMsg serializer and publisher

* Delete IMUMsg serializer and Publisher

* Delete VelodyneMsg serializer

* Delete CameraInfoMsg serializer and publisher

* Create IMUMsg serializer and publisher

* Delete ImageMsg serializer and publisher

* Create camera sensor scripts

* Create CameraInfoMsg serializer and publisher

* Create CompressedImageMsg serializer and publisher

* Delete PointCloud visualizer

* Delete CameraTextureVisualizer

* Delete old ScanPattern

* Create PoseStampedMsg serializer and publisher

* Delete NavSatFixMsg serializer and publisher

* Delete lidar PointCloud2Msg publisher

* Delete ImageMsgPublisher

* Create NavSatFixMsg serializer and publisher

* Create PointCloud2Msg serializer and publisher

* Delete old Livox sensor scripts

* Update lidar sensor scripts

* Update visualizer scripts

* Update IMU prefabs

* Update GNSS_ros.prefab

* Update camera sensor prefabs

* Create RGBDCamera sensor prefabs

* Update GroundTruth_ros.prefab

* Update lidar prefabs

* Delete TF demo scene

* Create Interface attribute

* Update visualizers

* Update serializers and publishers

* Update prefabs

* Delete clip plane settings from rgb camera

* Fix PointCloud visualizers

* Fix intensity pointfield name

* Fix RGBDCamera color map

* Fix MsgSerializer

---------

Co-authored-by: A-Harada <[email protected]>
Co-authored-by: TaroABEJido <[email protected]>
Co-authored-by: Autumn60 <[email protected]>
  • Loading branch information
4 people authored Oct 6, 2024
1 parent d0c64ae commit 425c9b1
Show file tree
Hide file tree
Showing 262 changed files with 2,163 additions and 3,288 deletions.
62 changes: 62 additions & 0 deletions Assets/UnitySensors/Editor/Attributes/InterfaceDrawer.cs
Original file line number Diff line number Diff line change
@@ -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<Interface>();
}
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
{
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using UnityEditor;
using UnitySensors.Sensor.GroundTruth;
//using UnitySensors.Sensor.GroundTruth;

namespace UnitySensors.Editor
{
/*
[CustomEditor(typeof(GroundTruth))]
public class GroundTruthEditor : UnityEditor.Editor
{
Expand All @@ -12,4 +13,5 @@ public override void OnInspectorGUI()
EditorGUILayout.HelpBox("GroundTruth does not use \"Frequency\" param.", MessageType.Info);
}
}
*/
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using Unity.Mathematics;

namespace UnitySensors.Sensor.LiDAR
namespace UnitySensors.DataType.LiDAR
{
#if UNITY_EDITOR
class ScanPatternGenerator : EditorWindow
Expand Down
15 changes: 0 additions & 15 deletions Assets/UnitySensors/Editor/TF/TFEditor.cs

This file was deleted.

22 changes: 5 additions & 17 deletions Assets/UnitySensors/Runtime/Prefabs/Camera/DepthCamera.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ GameObject:
- component: {fileID: 1105687583338018336}
- component: {fileID: 1105687583338018399}
- component: {fileID: 1105687583338018398}
- component: {fileID: 1105687583338018397}
- component: {fileID: 1105687583338018396}
- component: {fileID: 859923666563037401}
m_Layer: 0
m_Name: DepthCamera
m_TagString: Untagged
Expand Down Expand Up @@ -95,7 +94,8 @@ MonoBehaviour:
_fov: 30
_minRange: 0.05
_maxRange: 100
--- !u!114 &1105687583338018397
_gaussianNoiseSigma: 0
--- !u!114 &859923666563037401
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
Expand All @@ -104,19 +104,7 @@ MonoBehaviour:
m_GameObject: {fileID: 1105687583338018395}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fc838544d115b7741a2cb963bc058b29, type: 3}
m_Name:
m_EditorClassIdentifier:
_image: {fileID: 0}
--- !u!114 &1105687583338018396
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1105687583338018395}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f34cfe1c27eb79849a7bd77d281a5253, type: 3}
m_Script: {fileID: 11500000, guid: f2f05a788e73116488577387bd40affc, type: 3}
m_Name:
m_EditorClassIdentifier:
_source: {fileID: 1105687583338018398}
8 changes: 5 additions & 3 deletions Assets/UnitySensors/Runtime/Prefabs/Camera/RGBCamera.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GameObject:
- component: {fileID: 6023160553514482209}
- component: {fileID: 6023160553514482210}
- component: {fileID: 6023160553514482212}
- component: {fileID: 6023160553514482213}
- component: {fileID: -4194670642642625912}
m_Layer: 0
m_Name: RGBCamera
m_TagString: Untagged
Expand Down Expand Up @@ -94,7 +94,7 @@ MonoBehaviour:
_fov: 30
_minRange: 0.05
_maxRange: 100
--- !u!114 &6023160553514482213
--- !u!114 &-4194670642642625912
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
Expand All @@ -103,7 +103,9 @@ MonoBehaviour:
m_GameObject: {fileID: 6023160553514482222}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fc838544d115b7741a2cb963bc058b29, type: 3}
m_Script: {fileID: 11500000, guid: 5202acb8ddfd0c546b69f23eb10b4e60, type: 3}
m_Name:
m_EditorClassIdentifier:
_source: {fileID: 6023160553514482212}
_sourceTexture: 0
_image: {fileID: 0}
126 changes: 126 additions & 0 deletions Assets/UnitySensors/Runtime/Prefabs/Camera/RGBDCamera.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1785895639420286579
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1785895639420286472}
- component: {fileID: 1785895639420286583}
- component: {fileID: 4070371534656761714}
- component: {fileID: 4022873546115888586}
- component: {fileID: 421189727119020206}
m_Layer: 0
m_Name: RGBDCamera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1785895639420286472
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1785895639420286579}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!20 &1785895639420286583
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1785895639420286579}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!114 &4070371534656761714
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1785895639420286579}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 58044c1bc2a88b943af133119c691560, type: 3}
m_Name:
m_EditorClassIdentifier:
_frequency: 10
_resolution: {x: 640, y: 480}
_fov: 30
_minRange: 0.05
_maxRange: 100
_gaussianNoiseSigma: 0
--- !u!114 &4022873546115888586
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1785895639420286579}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1a3dffef534585740aa9f93736bdd5ca, type: 3}
m_Name:
m_EditorClassIdentifier:
_source: {fileID: 4070371534656761714}
--- !u!114 &421189727119020206
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1785895639420286579}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5202acb8ddfd0c546b69f23eb10b4e60, type: 3}
m_Name:
m_EditorClassIdentifier:
_source: {fileID: 4070371534656761714}
_sourceTexture: 0
_image: {fileID: 0}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Assets/UnitySensors/Runtime/Prefabs/IMU/IMU.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 5305839302562335606}
- component: {fileID: 5305839302562335607}
- component: {fileID: 7445696916328043224}
m_Layer: 0
m_Name: IMU
m_TagString: Untagged
Expand All @@ -32,7 +32,7 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &5305839302562335607
--- !u!114 &7445696916328043224
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
Expand All @@ -44,7 +44,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: de1d05f7ef764aa45be46678498c90e4, type: 3}
m_Name:
m_EditorClassIdentifier:
_frequency: 20
_frequency: 10
_position: {x: 0, y: 0, z: 0}
_velocity: {x: 0, y: 0, z: 0}
_acceleration: {x: 0, y: 0, z: 0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GameObject:
m_Component:
- component: {fileID: 9210621271187283362}
- component: {fileID: 9210621271187283363}
- component: {fileID: 9210621271187283360}
- component: {fileID: 3771061048342558472}
m_Layer: 0
m_Name: Sensor
m_TagString: Untagged
Expand Down Expand Up @@ -52,7 +52,7 @@ MonoBehaviour:
_maxRange: 70
_gaussianNoiseSigma: 0.02
_maxIntensity: 255
--- !u!114 &9210621271187283360
--- !u!114 &3771061048342558472
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
Expand All @@ -61,9 +61,10 @@ MonoBehaviour:
m_GameObject: {fileID: 9210621271187283373}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8a8859907edf5114c9beadbee04254ad, type: 3}
m_Script: {fileID: 11500000, guid: f2ac6256eabda88478ca2a2fc51a2c64, type: 3}
m_Name:
m_EditorClassIdentifier:
_source: {fileID: 9210621271187283363}
--- !u!1 &9210621271227589044
GameObject:
m_ObjectHideFlags: 0
Expand Down
Loading

0 comments on commit 425c9b1

Please sign in to comment.