diff --git a/.gitignore b/.gitignore index eb89864a..aaf2f7a3 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,14 @@ */[Ll]ogs/ */[Mm]emoryCaptures/ +[Ll]ibrary/ +[Tt]emp/ +[Oo]bj/ +[Bb]uild/ +[Bb]uilds/ +[Ll]ogs/ +[Mm]emoryCaptures/ + # Never ignore Asset meta data !*/[Aa]ssets/**/*.meta @@ -22,6 +30,9 @@ # TextMesh Pro files */[Aa]ssets/TextMesh*Pro/ */[Aa]ssets/TextMesh*Pro.meta +[Aa]ssets/TextMesh*Pro/ +[Aa]ssets/TextMesh*Pro.meta + # Autogenerated Jetbrains Rider plugin */[Aa]ssets/Plugins/Editor/JetBrains* @@ -58,6 +69,8 @@ *.pdb.meta *.mdb.meta +README.md.meta + # Unity3D generated file on crash reports sysinfo.txt diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index 0c41f171..78cd37ba 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -860,7 +860,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} m_AnchoredPosition: {x: -7.5, y: -0.5} - m_SizeDelta: {x: -35, y: 15} + m_SizeDelta: {x: 200, y: 50} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &387521880 MonoBehaviour: @@ -877,6 +877,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -915,14 +916,14 @@ MonoBehaviour: m_fontSizeMin: 18 m_fontSizeMax: 72 m_fontStyle: 1 - m_textAlignment: 513 + m_textAlignment: 514 m_characterSpacing: 0 m_wordSpacing: 0 m_lineSpacing: 0 m_lineSpacingMax: 0 m_paragraphSpacing: 0 m_charWidthMaxAdj: 0 - m_enableWordWrapping: 0 + m_enableWordWrapping: 1 m_wordWrappingRatios: 0.4 m_overflowMode: 1 m_firstOverflowCharacterIndex: -1 @@ -1376,12 +1377,13 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_text: Option A m_isRightToLeft: 0 - m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontAsset: {fileID: 0} m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_fontSharedMaterials: [] m_fontMaterial: {fileID: 0} @@ -1531,6 +1533,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -1940,6 +1943,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -2377,6 +2381,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -3671,6 +3676,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -3807,6 +3813,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -5537,6 +5544,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -5643,6 +5651,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -5922,6 +5931,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -6782,6 +6792,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -6855,6 +6866,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Scripts/CustomPlugins/ElevatorSystem.Elevator.cs b/Assets/Scripts/CustomPlugins/ElevatorSystem.Elevator.cs index 3248b81b..5c829796 100644 --- a/Assets/Scripts/CustomPlugins/ElevatorSystem.Elevator.cs +++ b/Assets/Scripts/CustomPlugins/ElevatorSystem.Elevator.cs @@ -138,16 +138,6 @@ private bool GetCalledElevator(in string currentFloor, in string targetFloor, ou { elevatorIndex = NON_ELEVATOR_INDEX; - // Try to find in task queue - foreach (var task in elevatorTaskQueue) - { - if (task.toFloor.Equals(currentFloor) && task.state.Equals(ElevatorTaskState.PROCESSING)) - { - elevatorIndex = task.elevatorIndex; - return true; - } - } - var currentFloorHeight = GetFloorHeight(currentFloor); // If not, try to find in stopped elevator foreach (var elevatorItem in elevatorList) @@ -156,6 +146,18 @@ private bool GetCalledElevator(in string currentFloor, in string targetFloor, ou if (elevator.State.Equals(ElevatorState.STOP) && elevator.IsArrived(currentFloorHeight)) { elevatorIndex = elevatorItem.Key; + Debug.Log("Already elevator is stopped " + elevatorIndex); + return true; + } + } + + // Try to find in task queue + foreach (var task in elevatorTaskQueue) + { + if (task.toFloor.Equals(currentFloor) && task.state.Equals(ElevatorTaskState.PROCESSING)) + { + elevatorIndex = task.elevatorIndex; + Debug.Log("Calling elevator " + elevatorIndex); return true; } } diff --git a/Assets/Scripts/CustomPlugins/README.md b/Assets/Scripts/CustomPlugins/README.md new file mode 100644 index 00000000..567c92ee --- /dev/null +++ b/Assets/Scripts/CustomPlugins/README.md @@ -0,0 +1,34 @@ +# CustomPlugins + +These plugin scripts are for sensor connection. + +Each class name is important to load plugin in SDF. + +For example, if it describes a name with 'RobotControl' in `` attributesm, SDF Parser will start to find a plugin named 'RobotControl' in Unity project. + +Unlink gazebo, 'filename' attribute shall not be used anywhere on current project. + +``` + + ... + ... + + + 3.0 + 0.2 + 0.0 + + + 449 + 95.5 + LeftWheel + RightWheel + + 0.06 + 13.0 + + + 20 + + +``` diff --git a/Assets/Scripts/ModelLoader.cs b/Assets/Scripts/ModelLoader.cs index 38a763ca..b5ca20c1 100644 --- a/Assets/Scripts/ModelLoader.cs +++ b/Assets/Scripts/ModelLoader.cs @@ -71,9 +71,9 @@ private void ResetTransform() void Awake() { #if UNITY_EDITOR - filesRootDirectory = "../../../SimulatorInstance/gazebo/gazebo/build/Installed/Release/share/gazebo-9/"; - modelRootDirectories.Add("../../../lgrs_resource/assets/models/"); - worldRootDirectories.Add("../../../lgrs_resource/worlds"); + filesRootDirectory = "/usr/share/gazebo-9/"; + modelRootDirectories.Add("../sample-resources/models/"); + worldRootDirectories.Add("../sample-resources/worlds/"); #else var separator = new char[] {':'}; filesRootDirectory = Environment.GetEnvironmentVariable("CLOISIM_FILES_PATH"); diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 7be11ed8..aaaec1f0 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -119,7 +119,7 @@ PlayerSettings: 16:10: 1 16:9: 1 Others: 1 - bundleVersion: 1.2.2 + bundleVersion: 1.0.1 preloadedAssets: [] metroInputSource: 0 wsaTransparentSwapchain: 0 diff --git a/README.md b/README.md index f501f03d..5f3d1474 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,187 @@ # CLOiSim : Multi-Robot Simulator +Happy to announce CLOiSim. It is a new multi-robot simulator to bring-up SDF(www.sdformat.org) file which contains 3d world environemnt and multi-robot descriptions. -SDF Parser for C# +It may looks similar to Gazebo simulator, but we had a problems to load multi-robot which equipped multi-sensors in Gazebo. +So that is why we initiated to utilize a 'Unity 3D'. +I believe 'Unity' can provide a powerful resource handling and can see many possiblity in industrial area by Unity. -SDF Implementation for Unity +So, this project consist of +- [SDF](http://sdformat.org/spec?ver=1.7) Parser for C# +- [SDF](http://sdformat.org/spec?ver=1.7) Implementation for Unity -> **Visual / Collision / Sensor / Physics for joints** +- [SDF](http://sdformat.org/spec?ver=1.7) Plugins for Unity +- UI modules -> On screen information +- Network modules -> transporting sensor data or control data +- Web service -> control and manipulate simulation -SDF Plugins for Unity +## Features +Unfortunately, all sensor models are not fully developed yet. +Because first target for simulation was 2-wheeled mobile robot with 2D lidar sensor. -'simdevice' ros2 packages for sensor are required. \ No newline at end of file +Here are sensor models that already implemented or ongoing. +- [X] 2D Lidar Sensor +- [X] 2-Wheeled Motor +- [X] Sonar sensor +- [X] IMU +- [ ] Camera +- [ ] Multi Camera +- [ ] Depth Camera +- [ ] 3D Lidar Sensor +- [ ] Sensor noise model + +Plus, [SDF](http://sdformat.org/spec?ver=1.7) implementation only works on essenstial elements like ``, ``, ``, ``, ``, etc. +For example, kind of optional elmenets ``, `