agv 테스트중

This commit is contained in:
2025-05-23 14:41:31 +09:00
parent ba196b626a
commit 5ab0270392
11 changed files with 316 additions and 37 deletions

View File

@@ -0,0 +1,238 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1505508720499862715
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 421374873455346910}
- component: {fileID: 5492482365278483619}
m_Layer: 0
m_Name: AGV 1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &421374873455346910
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1505508720499862715}
serializedVersion: 2
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:
- {fileID: 3909547189796084948}
- {fileID: 1627652318861080814}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &5492482365278483619
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1505508720499862715}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 84ad40885a5aaa04e85eb7de0489cc8d, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &4488530822671186643
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1627652318861080814}
- component: {fileID: 5506305391979457121}
- component: {fileID: 4473865689154435547}
m_Layer: 0
m_Name: Sensor
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1627652318861080814
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4488530822671186643}
serializedVersion: 2
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: 421374873455346910}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!135 &5506305391979457121
SphereCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4488530822671186643}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 1
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Radius: 10
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &4473865689154435547
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4488530822671186643}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a65fe5e7ae0d6a74dbe40d269a1cb6f7, type: 3}
m_Name:
m_EditorClassIdentifier:
obstacleLayer:
serializedVersion: 2
m_Bits: 256
--- !u!1 &7175446550791974323
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8278436267998297966}
m_Layer: 0
m_Name: Pallet_Socket
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8278436267998297966
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7175446550791974323}
serializedVersion: 2
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: 7020894527220248915}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &154300052577553464
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 421374873455346910}
m_Modifications:
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4046099219731300723, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
propertyPath: m_Name
value: Palletrobot
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects:
- targetCorrespondingSourceObject: {fileID: 7154835845995298155, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
insertIndex: -1
addedObject: {fileID: 8278436267998297966}
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 6070737613420926900, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
insertIndex: -1
addedObject: {fileID: 5083700428396174471}
m_SourcePrefab: {fileID: 100100000, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
--- !u!4 &3909547189796084948 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
m_PrefabInstance: {fileID: 154300052577553464}
m_PrefabAsset: {fileID: 0}
--- !u!1 &6204755932358581132 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 6070737613420926900, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
m_PrefabInstance: {fileID: 154300052577553464}
m_PrefabAsset: {fileID: 0}
--- !u!114 &5083700428396174471
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6204755932358581132}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5fb7059a769257346badd43882bceb27, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &7020894527220248915 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7154835845995298155, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
m_PrefabInstance: {fileID: 154300052577553464}
m_PrefabAsset: {fileID: 0}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 53db74a6e1101d2438a0c0083c5c232b
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using UnityEditor; using UnityEditor;
@@ -197,7 +197,7 @@ public class VirtualFactoryManager : MonoBehaviour
agvWorker.onCompleteTask += OnAGVIdle; agvWorker.onCompleteTask += OnAGVIdle;
} }
void OnAGVIdle(AGV worker) void OnAGVIdle(Studio.VirtualFactory.AGV worker)
{ {
Debug.Log($"{worker.name} is On Enter idle"); Debug.Log($"{worker.name} is On Enter idle");
stackerNeedsChecker.Scanning(); stackerNeedsChecker.Scanning();

View File

@@ -8,15 +8,27 @@ using XED;
namespace Studio namespace Studio
{ {
public class StudioServiceIdEventArgs : EventArgs
{
public readonly string Type;
public Dictionary<string, string> Entity;
public StudioServiceIdEventArgs(string type, Dictionary<string, string> entity)
{
Type = type;
Entity = entity;
}
}
public class StudioServiceTypeEventArgs : EventArgs public class StudioServiceTypeEventArgs : EventArgs
{ {
public readonly string Type; public readonly string Type;
Dictionary<string, string> Entitis; public Dictionary<string,Dictionary<string, string>> Entitis;
public StudioServiceTypeEventArgs(string type, Dictionary<string, string> entity) public StudioServiceTypeEventArgs(string type, Dictionary<string, Dictionary<string, string>> entitis)
{ {
Type = type; Type = type;
Entitis = entity; Entitis = entitis;
} }
} }
@@ -28,27 +40,30 @@ namespace Studio
static StudioService() { } static StudioService() { }
#endregion #endregion
private Dictionary<string, Dictionary<string, EventHandler<StudioServiceTypeEventArgs>>> listenerIdMap; private Dictionary<string, Dictionary<string, EventHandler<StudioServiceIdEventArgs>>> listenerIdMap;
private Dictionary<string, EventHandler<StudioServiceTypeEventArgs>> listenerTypeMap;
private StudioRepoistory repository; private StudioRepoistory repository;
private Dictionary<string, float> updateTime = new(); private Dictionary<string, float> updateTime = new();
#region
private int totalRequestPacket; private int totalRequestPacket;
private int totalResponsePacket; private int totalResponsePacket;
private long maxElapsedTime; private long maxElapsedTime;
private long totalElapsedTime; private long totalElapsedTime;
private int maxReponesSize; private int maxReponesSize;
private int maxReuqestSize; private int maxReuqestSize;
private string maxReuqestApi; private string maxReuqestApi;
private string maxResponseApi; private string maxResponseApi;
private string maxResponseTimeApi; private string maxResponseTimeApi;
#endregion
public Dictionary<string, StudioEntityWithState<object>> baseData = new(); public Dictionary<string, StudioEntityWithState<List<Dictionary<string, string>>>> baseData = new();
//private string //private string
private StudioService(StudioRepoistory repository) private StudioService(StudioRepoistory repository)
{ {
this.repository = repository; this.repository = repository;
listenerIdMap = new Dictionary<string, Dictionary<string, EventHandler<StudioServiceTypeEventArgs>>>(); listenerIdMap = new Dictionary<string, Dictionary<string, EventHandler<StudioServiceIdEventArgs>>>();
repository.OnTopicList += OnTopicList; repository.OnTopicList += OnTopicList;
// repository.OnDetectedError += OnDetectedError; // repository.OnDetectedError += OnDetectedError;
@@ -109,7 +124,7 @@ namespace Studio
return result != null; return result != null;
} }
public void AddTypeListener(string type, string id, EventHandler<StudioServiceTypeEventArgs> listener) public void AddTypeIdListener(string type, string id, EventHandler<StudioServiceIdEventArgs> listener)
{ {
if (!listenerIdMap.ContainsKey(type)) if (!listenerIdMap.ContainsKey(type))
{ {
@@ -125,7 +140,17 @@ namespace Studio
listenerIdMap[type][id] += listener; listenerIdMap[type][id] += listener;
} }
} }
public void AddTypeListener(string type, EventHandler<StudioServiceTypeEventArgs> listener)
{
if (!listenerTypeMap.ContainsKey(type))
{
listenerTypeMap[type] = listener;
}
else
{
listenerTypeMap[type] += listener;
}
}
public async Task LoadBaseData(string url) public async Task LoadBaseData(string url)
{ {
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
@@ -142,7 +167,6 @@ namespace Studio
baseData.Add(url, new()); baseData.Add(url, new());
baseData[url] = data;
CheckAPIBoarder(data.Entity.ToString(), data.ReqSize, url, t); CheckAPIBoarder(data.Entity.ToString(), data.ReqSize, url, t);
UpdateEntity(url, data.Entity.ToString()); UpdateEntity(url, data.Entity.ToString());
} }
@@ -205,24 +229,20 @@ namespace Studio
} }
var datas = json["rows"].ToString(); var datas = json["rows"].ToString();
var list = new List<Dictionary<string, string>>();
JArray jarray = JArray.Parse(datas); JArray jarray = JArray.Parse(datas);
foreach (JObject obj in jarray.Children()) foreach (JObject obj in jarray.Children())
{ {
Dictionary<string, string> keyvalue = new(); Dictionary<string, string> keyvalue = new();
int index = 0;
string id = string.Empty; string id = string.Empty;
foreach (JProperty prop in obj.Children()) foreach (JProperty prop in obj.Children())
{ {
string key = prop.Name.ToString(); string key = prop.Name.ToString();
string value = prop.Value.ToString(); string value = prop.Value.ToString();
if (index == 0)
{
id = value;
index = 1;
}
keyvalue.Add(key, value); keyvalue.Add(key, value);
} }
DispatchMachineEvent(type, id, keyvalue); list.Add(keyvalue);
//DispatchMachineEvent(type, id, keyvalue);
} }
} }
@@ -234,9 +254,20 @@ namespace Studio
} }
if (listenerIdMap[type].ContainsKey(id)) if (listenerIdMap[type].ContainsKey(id))
{ {
listenerIdMap[type][id].Invoke(this, new StudioServiceTypeEventArgs(type, entity)); listenerIdMap[type][id].Invoke(this, new StudioServiceIdEventArgs(type, entity));
} }
} }
private void DispatchTypeMachineEvent(string type, Dictionary<string,Dictionary<string, string>> entities)
{
if (!listenerTypeMap.ContainsKey(type))
{
Debug.LogError($"Key Value is missing!!!! -Key:{type}-");
}
if (listenerTypeMap.ContainsKey(type))
{
listenerTypeMap[type].Invoke(this, new(type, entities));
}
}
} }
} }

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
@@ -340,5 +340,7 @@ namespace Studio.VirtualFactory
{ {
updateAction.Invoke(); updateAction.Invoke();
} }
} }
} }

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using Studio.VirtualFactory; using Studio.VirtualFactory;
@@ -8,17 +8,17 @@ namespace Studio.Manage
{ {
public class AGVManager : Manager public class AGVManager : Manager
{ {
public AGV prf_AGV; public Studio.VirtualFactory.AGV prf_AGV;
public AGVSpec prf_Spec; public AGVSpec prf_Spec;
public HashSet<AGV> agvs = new(); public HashSet<Studio.VirtualFactory.AGV> agvs = new();
public bool autoIndexing; public bool autoIndexing;
public override void Init() public override void Init()
{ {
} }
public bool TryGetIdleAGV(out AGV result) public bool TryGetIdleAGV(out Studio.VirtualFactory.AGV result)
{ {
//Debug.Log($"Try Get Idle AGV"); //Debug.Log($"Try Get Idle AGV");
foreach (var agv in agvs) foreach (var agv in agvs)
@@ -35,7 +35,7 @@ namespace Studio.Manage
return false; return false;
} }
public AGV CreateEmptyAGV() public Studio.VirtualFactory.AGV CreateEmptyAGV()
{ {
var agv = UnityEngine.Object.Instantiate(prf_AGV); var agv = UnityEngine.Object.Instantiate(prf_AGV);
agvs.Add(agv); agvs.Add(agv);

View File

@@ -1,3 +1,4 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
@@ -39,7 +40,7 @@ public class DataReader : MonoBehaviour
void Start() void Start()
{ {
//ReplayTimer.gameObject.SetActive(true); //ReplayTimer.gameObject.SetActive(true);
// Resources 폴더에서 파일을 불러옵니다. // Resources 폴더에서 파일을 불러옵니다.
csvFile = Resources.Load<TextAsset>($"LogData/DataLog"); csvFile = Resources.Load<TextAsset>($"LogData/DataLog");
if (csvFile != null) if (csvFile != null)
@@ -51,7 +52,7 @@ public class DataReader : MonoBehaviour
} }
else else
{ {
Debug.LogError("CSV 파일을 찾을 수 없습니다."); Debug.LogError("CSV 파일을 찾을 수 없습니다.");
} }
} }

View File

@@ -1,6 +1,6 @@
using UnityEngine; using Studio.Core;
using UnityEngine;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
using XED.Core;
using XRLib; using XRLib;
namespace Studio.UI.Modal namespace Studio.UI.Modal

View File

@@ -1,6 +1,6 @@
using UnityEngine; using Studio.Core;
using UnityEngine;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
using XED.Core;
using XRLib; using XRLib;
namespace Studio.UI.Popup namespace Studio.UI.Popup

View File

@@ -1,7 +1,7 @@
using System; using Studio.Core;
using System;
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
using XED.Core;
using XRLib; using XRLib;
namespace Studio.UI.Popup namespace Studio.UI.Popup

View File

@@ -11,7 +11,7 @@ namespace XED
// Start is called once before the first execution of Update after the MonoBehaviour is created // Start is called once before the first execution of Update after the MonoBehaviour is created
private StudioService tt; private StudioService tt;
private int aa; private int aa;
void Start() void Awake()
{ {
Constants.MQTTDomain = "220.90.135.190"; Constants.MQTTDomain = "220.90.135.190";
Constants.APIDomain = "220.90.135.190"; Constants.APIDomain = "220.90.135.190";