From d599d066bee5bfe86206284a8a0c25827fb0f155 Mon Sep 17 00:00:00 2001 From: SOOBEEN HAN Date: Fri, 21 Nov 2025 13:18:03 +0900 Subject: [PATCH] =?UTF-8?q?=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=20(hover=EC=8B=9C=20mat=20=EC=84=A4=EC=A0=95,=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20mat=20=EC=84=A4=EC=A0=95,=20=ED=99=98=EA=B2=BD?= =?UTF-8?q?=EC=84=A4=EC=A0=95-=EB=8B=A4=EB=A5=B8=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EB=9E=A8=20=EC=97=B4=EA=B8=B0=20=EC=84=A4=EC=A0=95,?= =?UTF-8?q?=20=ED=8C=9D=EC=97=85=20=EC=9C=84=EC=B9=98=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HybridIK/Scripts/Main/RobotController.cs | 1 + .../그리퍼_1/그리퍼_1_에러하이라이트.mat | 139 ++++++++++++++++++ .../그리퍼_1/그리퍼_1_에러하이라이트.mat.meta | 8 + .../Resources/Prefabs/DragArrowPrefab.prefab | 2 +- Assets/Scenes/HDRobo_Main.unity | 40 ++++- Assets/Scripts/AppManager.cs | 10 ++ Assets/Scripts/Model/ProgramModel.cs | 26 +--- Assets/Scripts/Presenter/ProgramPresenter.cs | 75 +++++++--- Assets/Scripts/View/EnvView.cs | 3 + Assets/Scripts/View/InteractionView.cs | 21 +++ Assets/Scripts/View/PointManagerView.cs | 18 ++- Assets/Scripts/View/PopupView.cs | 11 +- Assets/Scripts/View/ProgramView.cs | 4 +- ...niversalRenderPipelineGlobalSettings.asset | 48 +++--- ProjectSettings/ProjectSettings.asset | 3 + 15 files changed, 325 insertions(+), 84 deletions(-) create mode 100644 Assets/Resources/Materials/그리퍼_1/그리퍼_1_에러하이라이트.mat create mode 100644 Assets/Resources/Materials/그리퍼_1/그리퍼_1_에러하이라이트.mat.meta diff --git a/Assets/HybridIK/Scripts/Main/RobotController.cs b/Assets/HybridIK/Scripts/Main/RobotController.cs index 11d6a02..34ae766 100644 --- a/Assets/HybridIK/Scripts/Main/RobotController.cs +++ b/Assets/HybridIK/Scripts/Main/RobotController.cs @@ -21,6 +21,7 @@ public class RobotController : MonoBehaviour [SerializeField] public GameObject toolEndpoint; [SerializeField] public Material toolEndpointHighlight; + [SerializeField] public Material toolEndpointErrorHighlight; [SerializeField] public Material toolEndpointOriginal; public event Action OnPoseUpdateRequest; diff --git a/Assets/Resources/Materials/그리퍼_1/그리퍼_1_에러하이라이트.mat b/Assets/Resources/Materials/그리퍼_1/그리퍼_1_에러하이라이트.mat new file mode 100644 index 0000000..7c85769 --- /dev/null +++ b/Assets/Resources/Materials/그리퍼_1/그리퍼_1_에러하이라이트.mat @@ -0,0 +1,139 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-3510046676888012492 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: "\uADF8\uB9AC\uD37C_1_\uC5D0\uB7EC\uD558\uC774\uB77C\uC774\uD2B8" + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _METALLICSPECGLOSSMAP + - _NORMALMAP + - _OCCLUSIONMAP + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: 2000 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: ec9b000d5ff843747a5befb9de2a1094, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 2800000, guid: c0234c7455df80b48aaf5f134c7c8714, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: ec9b000d5ff843747a5befb9de2a1094, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 2800000, guid: 4bceebc6a01397d47bf9e23ec9495a07, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 2800000, guid: ca085ca1fc3f4e04c96e173f75ea6877, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 0 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.758 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 0.8024385, b: 0.7882353, a: 1} + - _Color: {r: 1, g: 0.80243844, b: 0.7882353, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/Resources/Materials/그리퍼_1/그리퍼_1_에러하이라이트.mat.meta b/Assets/Resources/Materials/그리퍼_1/그리퍼_1_에러하이라이트.mat.meta new file mode 100644 index 0000000..12a18ac --- /dev/null +++ b/Assets/Resources/Materials/그리퍼_1/그리퍼_1_에러하이라이트.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0f852b48997da5a459e3c490a2b2ba80 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Prefabs/DragArrowPrefab.prefab b/Assets/Resources/Prefabs/DragArrowPrefab.prefab index c4b8d2d..4ddbbc6 100644 --- a/Assets/Resources/Prefabs/DragArrowPrefab.prefab +++ b/Assets/Resources/Prefabs/DragArrowPrefab.prefab @@ -134,7 +134,7 @@ Transform: m_GameObject: {fileID: 9153036347640126610} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -9.563122, y: 4.738362, z: 3.6356869} + m_LocalPosition: {x: -0.8996404, y: 1.4682918, z: 1.5212109} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: diff --git a/Assets/Scenes/HDRobo_Main.unity b/Assets/Scenes/HDRobo_Main.unity index d1c096b..abc22c3 100644 --- a/Assets/Scenes/HDRobo_Main.unity +++ b/Assets/Scenes/HDRobo_Main.unity @@ -21008,6 +21008,32 @@ Transform: m_CorrespondingSourceObject: {fileID: 4106791946970566897, guid: 04e2e84adfe5ce6408a6777431fcb927, type: 3} m_PrefabInstance: {fileID: 650262862} m_PrefabAsset: {fileID: 0} +--- !u!1 &650823704 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: -7009699649911652522, guid: 6c52fe1416d967a409332c0065a41575, type: 3} + m_PrefabInstance: {fileID: 2077727516} + m_PrefabAsset: {fileID: 0} +--- !u!65 &650823708 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 650823704} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 0.99999994, y: 0.14999999, z: 0.99999994} + m_Center: {x: 0, y: 0.074999996, z: 0} --- !u!1001 &654629905 PrefabInstance: m_ObjectHideFlags: 0 @@ -34480,6 +34506,7 @@ MonoBehaviour: indicatorMaterial2: {fileID: 2100000, guid: d5b595f8848b48a418815999bef1b127, type: 2} toolEndpoint: {fileID: 0} toolEndpointHighlight: {fileID: 0} + toolEndpointErrorHighlight: {fileID: 0} toolEndpointOriginal: {fileID: 0} movementPosition: {x: 0, y: 0, z: 0} IsMovementRunning: 0 @@ -41594,7 +41621,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: e0ed0df5326d1e64da9e29ac5d4f41f4, type: 3} m_Name: m_EditorClassIdentifier: - loadProgramButton: {fileID: 108388295} programSelectPanel: {fileID: 1243479628} programNewPanel: {fileID: 857356697} programListPanel: {fileID: 1674389728} @@ -41614,6 +41640,7 @@ MonoBehaviour: - {fileID: 36913854} backspaceButton: {fileID: 1465393240} createProgramButton: {fileID: 1635802844} + loadProgramButton: {fileID: 108388295} openProgramButton: {fileID: 1048338101} closeProgramListButton: {fileID: 1931540222} --- !u!1001 &1243561883 @@ -43824,7 +43851,7 @@ Transform: m_GameObject: {fileID: 1299890569} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 1077.7422, y: 678.22485, z: -66.30469} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -43962,6 +43989,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: pointPrefab: {fileID: 5391214215580958641, guid: bb50b26301943754e8d5e7a7b3e24085, type: 3} + robotBaseTransform: {fileID: 1321434833} movingAlert: {fileID: 564077395} kinematicsNode: {fileID: 1276194696} --- !u!82 &1299890575 @@ -72573,6 +72601,9 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 6c52fe1416d967a409332c0065a41575, type: 3} insertIndex: -1 addedObject: {fileID: 2077727518} + - targetCorrespondingSourceObject: {fileID: -7009699649911652522, guid: 6c52fe1416d967a409332c0065a41575, type: 3} + insertIndex: -1 + addedObject: {fileID: 650823708} m_SourcePrefab: {fileID: 100100000, guid: 6c52fe1416d967a409332c0065a41575, type: 3} --- !u!1 &2077727517 stripped GameObject: @@ -72598,8 +72629,8 @@ BoxCollider: m_ProvidesContacts: 0 m_Enabled: 1 serializedVersion: 3 - m_Size: {x: 0.99999976, y: 0.3594838, z: 0.99999976} - m_Center: {x: 0, y: 0.17245668, z: 0} + m_Size: {x: 0.7597172, y: 0.3594838, z: 0.99999976} + m_Center: {x: -0.12014015, y: 0.17245668, z: 0} --- !u!4 &2077727520 stripped Transform: m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 6c52fe1416d967a409332c0065a41575, type: 3} @@ -75021,6 +75052,7 @@ MonoBehaviour: indicatorMaterial2: {fileID: 2100000, guid: d5b595f8848b48a418815999bef1b127, type: 2} toolEndpoint: {fileID: 2254038508360166054} toolEndpointHighlight: {fileID: 2100000, guid: f6a724c30f974a14b9c410d53854f22e, type: 2} + toolEndpointErrorHighlight: {fileID: 2100000, guid: 0f852b48997da5a459e3c490a2b2ba80, type: 2} toolEndpointOriginal: {fileID: 2100000, guid: be82159c701af0d418c499905aecf4e3, type: 2} movementPosition: {x: 0, y: 0, z: 0} IsMovementRunning: 0 diff --git a/Assets/Scripts/AppManager.cs b/Assets/Scripts/AppManager.cs index fd79369..ee71ffa 100644 --- a/Assets/Scripts/AppManager.cs +++ b/Assets/Scripts/AppManager.cs @@ -45,6 +45,16 @@ public class AppManager : MonoBehaviour { Instance = this; } + + // RTT + // Nagle ˰ Ȱȭ ( ) + System.Net.ServicePointManager.UseNagleAlgorithm = false; + + // 100-Continue ( ٸ ) + System.Net.ServicePointManager.Expect100Continue = false; + + // ( ) + System.Net.ServicePointManager.DefaultConnectionLimit = 10; } async void Start() diff --git a/Assets/Scripts/Model/ProgramModel.cs b/Assets/Scripts/Model/ProgramModel.cs index 6fb9f66..5867044 100644 --- a/Assets/Scripts/Model/ProgramModel.cs +++ b/Assets/Scripts/Model/ProgramModel.cs @@ -32,7 +32,6 @@ public class ProgramModel private int currentToolNum = 0; private readonly SemaphoreSlim clientLock = new SemaphoreSlim(1, 1); - private CancellationTokenSource moveCts = new CancellationTokenSource(); public event Action OnRobotErrorStateChanged; public ProgramModel(string hostip, int tcpPort, int udpPort, RobotController robotController) @@ -458,11 +457,6 @@ public class ProgramModel public async Task MoveToPoseTcpAsync(Vector3 position) { //await clientLock.WaitAsync(); - if (moveCts.IsCancellationRequested) - { - Debug.LogError($"[Token] ̹ ū õ (ID: {moveCts.GetHashCode()}) - Reset "); - return false; - } try { startMovementPosition.x = Convert.ToSingle(Math.Round(-1 * position.x * 1000, 2)); @@ -470,8 +464,7 @@ public class ProgramModel startMovementPosition.z = Convert.ToSingle(Math.Round(position.y * 1000, 2)); string jsonResponse = await tcpClient.SendPostRequestAsync("/project/robot/move_to_pose_manual", - $"{{\"pose_tg\":{{\"crd\":\"robot\",\"_type\":\"Pose\",\"mechinfo\":1,\"x\":{startMovementPosition.x},\"y\":{startMovementPosition.y},\"z\":{startMovementPosition.z}, \"rx\":{robotData.rx}, \"ry\":{robotData.ry}, \"rz\":{robotData.rz}}}}}", - null, moveCts.Token); + $"{{\"pose_tg\":{{\"crd\":\"robot\",\"_type\":\"Pose\",\"mechinfo\":1,\"x\":{startMovementPosition.x},\"y\":{startMovementPosition.y},\"z\":{startMovementPosition.z}, \"rx\":{robotData.rx}, \"ry\":{robotData.ry}, \"rz\":{robotData.rz}}}}}"); if (jsonResponse.Contains("200")) { @@ -584,23 +577,6 @@ public class ProgramModel } } - // ̵ ߴ - public void CancelCurrentMovements() - { - if (moveCts != null) - { - moveCts.Cancel(); // MoveToPoseTcpAsync ⼭ - Debug.LogWarning(" ̵ TCP û "); - } - } - - // ٽ ̵ ϵ ū ( ȣ) - public void ResetMovementToken() - { - moveCts?.Dispose(); - moveCts = new CancellationTokenSource(); - } - // ̵ Ǵ public async Task GetMovingState() { diff --git a/Assets/Scripts/Presenter/ProgramPresenter.cs b/Assets/Scripts/Presenter/ProgramPresenter.cs index 280aba6..88178a9 100644 --- a/Assets/Scripts/Presenter/ProgramPresenter.cs +++ b/Assets/Scripts/Presenter/ProgramPresenter.cs @@ -1,14 +1,9 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Net.Sockets; using System.Threading; using System.Threading.Tasks; using UnityEngine; -using UnityEngine.UIElements; -using UnityEngine.XR.ARSubsystems; -using UnityEngine.XR.Interaction.Toolkit; -using UnityEngine.XR.Interaction.Toolkit.Interactors; public enum PopupState { @@ -49,6 +44,9 @@ public class ProgramPresenter private CancellationTokenSource appCts; private RobotData latestTargetPose; // 䰡 ֽ ǥ private bool IsDragging = false; + private bool IsStopped = false; // + private bool errMatChanged = false; // κ mat ٲ + private bool isHovering = false; private RobotData originalDragPose; // ư ġ private float lastMoveSendTime = 0f; private const float MOVE_SEND_INTERVAL = 0.1f; // 0.1(100ms) (ʴ 10ȸ) @@ -89,7 +87,9 @@ public class ProgramPresenter this.programInfoView.OnPlusClicked += async (dir) => await HandlePlaySpeed(dir); this.envView.OnToggleClicked += (active) => HandleTCPViewToggle(active); + this.envView.OnLoadProgramListRequested += HandleLoadProgramList; + this.leftInteractionView.OnRobotHoverStateChanged += (state) => HandleRobotHover(state); this.leftInteractionView.OnRobotGrabStart += () => HandleRobotGrabStart(leftView); this.leftInteractionView.OnRobotGrabbed += (pos, rot) => HandleRobotGrabbed(leftView, pos, rot); this.leftInteractionView.OnRobotReleased += (data) => HandleRobotReleased(leftView, data); @@ -98,6 +98,7 @@ public class ProgramPresenter this.leftInteractionView.OnPointDragUpdate += (index, pos, rot) => HandlePointDragUpdate(leftView, index, pos, rot); this.leftInteractionView.OnPointDragEnd += (index) => HandlePointDragEnd(leftView, index); + this.rightInteractionView.OnRobotHoverStateChanged += (state) => HandleRobotHover(state); this.rightInteractionView.OnRobotGrabStart += () => HandleRobotGrabStart(rightView); this.rightInteractionView.OnRobotGrabbed += (pos, rot) => HandleRobotGrabbed(rightView, pos, rot); this.rightInteractionView.OnRobotReleased += (data) => HandleRobotReleased(rightView, data); @@ -427,6 +428,23 @@ public class ProgramPresenter return new Vector3(x, y, z); } + private void HandleRobotHover(bool state) + { + isHovering = state; + + if (IsDragging) return; + + if (isHovering) + { + controlledRobot.toolEndpoint.GetComponent().material = controlledRobot.toolEndpointHighlight; + } + else + { + // + controlledRobot.toolEndpoint.GetComponent().material = controlledRobot.toolEndpointOriginal; + } + } + private void HandleRobotGrabStart(InteractionView view) { activeInteractionView = view; @@ -438,6 +456,8 @@ public class ProgramPresenter Debug.Log("κ : "); } model.ResetLocalErrorState(); + IsStopped = false; + errMatChanged = false; } private async void HandleRobotGrabbed(InteractionView view, Vector3 newWorldPos, Quaternion newWorldRot) @@ -445,11 +465,21 @@ public class ProgramPresenter try { activeInteractionView = view; - - if (model.isError) + controlledRobot.toolEndpoint.GetComponent().material = controlledRobot.toolEndpointHighlight; + + if (model.isError) { - //model.CancelCurrentMovements(); // ̵ - return; + IsStopped = true; + if (!errMatChanged) // ⿡ false ˷ ʾƼ model.isError true Ǿ ǹ + { + controlledRobot.toolEndpoint.GetComponent().material = controlledRobot.toolEndpointErrorHighlight; + errMatChanged = true; + return; + } + else + { + controlledRobot.toolEndpoint.GetComponent().material = controlledRobot.toolEndpointHighlight; + } } if (!IsDragging) @@ -459,7 +489,6 @@ public class ProgramPresenter } this.latestTargetPose = ConvertPoseToRobotData(newWorldPos, newWorldRot); - controlledRobot.toolEndpoint.GetComponent().material = controlledRobot.toolEndpointHighlight; // ȭ ӵ ø Ƚ if (!model.isError) @@ -493,14 +522,15 @@ public class ProgramPresenter if (view != activeInteractionView) return; IsDragging = false; - pendingPointData = this.latestTargetPose; // ӽ + //pendingPointData = this.latestTargetPose; // ӽ + pendingPointData = pose; controlledRobot.toolEndpoint.GetComponent().material = controlledRobot.toolEndpointOriginal; - if (!model.isError) - { + //if (!IsStopped) + //{ currentPopupState = PopupState.ConfirmAddPoint; // _ = WaitForRobotToStopAndShowPopup(currentPopupState); - } + //} activeInteractionView = null; } @@ -739,13 +769,18 @@ public class ProgramPresenter this.programInfoView.OnMinusClicked -= async (dir) => await HandlePlaySpeed(dir); this.programInfoView.OnPlusClicked -= async (dir) => await HandlePlaySpeed(dir); - leftInteractionView.OnRobotGrabbed -= (pos, rot) => HandleRobotGrabbed(leftInteractionView, pos, rot); - leftInteractionView.OnRobotReleased -= (data) => HandleRobotReleased(leftInteractionView, data); - leftInteractionView.OnPointClicked -= (index, pos) => HandlePointClicked(leftInteractionView, index, pos); - leftInteractionView.OnPointDragStart -= (index) => HandlePointDragStart(leftInteractionView, index); - leftInteractionView.OnPointDragUpdate -= (index, pos, rot) => HandlePointDragUpdate(leftInteractionView, index, pos, rot); - leftInteractionView.OnPointDragEnd -= (index) => HandlePointDragEnd(leftInteractionView, index); + this.envView.OnToggleClicked -= (active) => HandleTCPViewToggle(active); + this.envView.OnLoadProgramListRequested -= HandleLoadProgramList; + this.leftInteractionView.OnRobotHoverStateChanged -= (state) => HandleRobotHover(state); + this.leftInteractionView.OnRobotGrabbed -= (pos, rot) => HandleRobotGrabbed(leftInteractionView, pos, rot); + this.leftInteractionView.OnRobotReleased -= (data) => HandleRobotReleased(leftInteractionView, data); + this.leftInteractionView.OnPointClicked -= (index, pos) => HandlePointClicked(leftInteractionView, index, pos); + this.leftInteractionView.OnPointDragStart -= (index) => HandlePointDragStart(leftInteractionView, index); + this.leftInteractionView.OnPointDragUpdate -= (index, pos, rot) => HandlePointDragUpdate(leftInteractionView, index, pos, rot); + this.leftInteractionView.OnPointDragEnd -= (index) => HandlePointDragEnd(leftInteractionView, index); + + this.rightInteractionView.OnRobotHoverStateChanged -= (state) => HandleRobotHover(state); this.rightInteractionView.OnRobotGrabbed -= (pos, rot) => HandleRobotGrabbed(this.rightInteractionView, pos, rot); this.rightInteractionView.OnRobotReleased -= (data) => HandleRobotReleased(this.rightInteractionView, data); this.rightInteractionView.OnPointClicked -= (index, pos) => HandlePointClicked(this.rightInteractionView, index, pos); diff --git a/Assets/Scripts/View/EnvView.cs b/Assets/Scripts/View/EnvView.cs index 5074ffa..c1a2836 100644 --- a/Assets/Scripts/View/EnvView.cs +++ b/Assets/Scripts/View/EnvView.cs @@ -29,6 +29,7 @@ public class EnvView : MonoBehaviour private bool isPressingMenu = false; public event Action OnToggleClicked; + public event Action OnLoadProgramListRequested; void Start() { @@ -113,6 +114,8 @@ public class EnvView : MonoBehaviour ProgramEnterPanel.SetActive(true); NewProgramPanel.SetActive(false); OriginalProgramPanel.SetActive(true); + + OnLoadProgramListRequested?.Invoke(); } private void OpenNewProgramPanel() diff --git a/Assets/Scripts/View/InteractionView.cs b/Assets/Scripts/View/InteractionView.cs index a1b3279..ac348f3 100644 --- a/Assets/Scripts/View/InteractionView.cs +++ b/Assets/Scripts/View/InteractionView.cs @@ -9,6 +9,7 @@ public enum HandSide { Left, Right } public class InteractionView : MonoBehaviour { + public event Action OnRobotHoverStateChanged; public event Action OnRobotGrabStart; public event Action OnRobotGrabbed; public event Action OnRobotReleased; @@ -91,6 +92,8 @@ public class InteractionView : MonoBehaviour // XRI ̺Ʈ baseInteractor.selectEntered.AddListener(HandleGrabStart); baseInteractor.selectExited.AddListener(HandleGrabEnd); + baseInteractor.hoverEntered.AddListener(OnHoverEntered); + baseInteractor.hoverExited.AddListener(OnHoverExited); TryInitializeHapticDevice(); @@ -203,6 +206,24 @@ public class InteractionView : MonoBehaviour currentGrabbedPointIndex = -1; } + private void OnHoverEntered(HoverEnterEventArgs args) + { + // ȣ ü 'κ' Ȯ + if (args.interactableObject.transform.CompareTag("RobotArm")) + { + OnRobotHoverStateChanged?.Invoke(true); + } + } + + // ȣ ȣ + private void OnHoverExited(HoverExitEventArgs args) + { + if (args.interactableObject.transform.CompareTag("RobotArm")) + { + OnRobotHoverStateChanged?.Invoke(false); + } + } + // Ŭ/巡 ϴ Ÿ̸ ڷƾ private IEnumerator ClickOrDragTimer() { diff --git a/Assets/Scripts/View/PointManagerView.cs b/Assets/Scripts/View/PointManagerView.cs index e133a1c..bb2fb5e 100644 --- a/Assets/Scripts/View/PointManagerView.cs +++ b/Assets/Scripts/View/PointManagerView.cs @@ -7,6 +7,7 @@ public class PointManagerView : MonoBehaviour { [SerializeField] private GameObject pointPrefab; private List activePoints = new List(); + public Transform robotBaseTransform; // κǥ Ǵ ġ [SerializeField] public GameObject movingAlert; [SerializeField] @@ -28,8 +29,21 @@ public class PointManagerView : MonoBehaviour public void CreatePoint(RobotData pose, int index) { - Vector3 position = ConvertRobotDataToVector3(pose); - GameObject pointObj = Instantiate(pointPrefab, position, Quaternion.identity, this.transform); + Vector3 localPos = ConvertRobotDataToVector3(pose); + Vector3 worldPos = localPos; + + // κ Base ִٸ, ǥ ǥ ȯ + if (robotBaseTransform != null) + { + worldPos = robotBaseTransform.TransformPoint(localPos); + } + else + { + Debug.LogWarning("PointManagerView: RobotBaseTransform Ҵ ʾ ˴ϴ."); + } + + // ȯ ǥ + GameObject pointObj = Instantiate(pointPrefab, worldPos, Quaternion.identity, this.transform); activePoints.Add(pointObj); RobotPoint pointComponent = pointObj.GetComponent(); diff --git a/Assets/Scripts/View/PopupView.cs b/Assets/Scripts/View/PopupView.cs index 7617988..8491c11 100644 --- a/Assets/Scripts/View/PopupView.cs +++ b/Assets/Scripts/View/PopupView.cs @@ -78,17 +78,18 @@ public class PopupView : MonoBehaviour, IPopupView public void ShowDeletePopup(Vector3 popPose) { - deletePopupPanel.transform.position = popPose; - deletePopupPanel.transform.LookAt(Camera.main.transform); - deletePopupPanel.transform.Rotate(0, 180, 0); + //deletePopupPanel.transform.position = popPose; + //deletePopupPanel.transform.LookAt(Camera.main.transform); + //deletePopupPanel.transform.Rotate(0, 180, 0); deletePopupPanel.SetActive(true); } public void ShowOptionPopup(Vector3 popPose) { optionPopupPanel.transform.position = popPose; - optionPopupPanel.transform.LookAt(Camera.main.transform); - optionPopupPanel.transform.Rotate(0, 180, 0); + optionPopupPanel.transform.localRotation = Quaternion.identity; + //optionPopupPanel.transform.LookAt(Camera.main.transform); + //optionPopupPanel.transform.Rotate(0, 180, 0); optionPopupPanel.SetActive(true); } diff --git a/Assets/Scripts/View/ProgramView.cs b/Assets/Scripts/View/ProgramView.cs index dbfa779..56d959d 100644 --- a/Assets/Scripts/View/ProgramView.cs +++ b/Assets/Scripts/View/ProgramView.cs @@ -7,9 +7,6 @@ using UnityEngine.UI; public class ProgramView : MonoBehaviour { - // --- UI --- - [SerializeField] private Button loadProgramButton; - // --- α׷ г --- [SerializeField] private GameObject programSelectPanel; [SerializeField] private GameObject programNewPanel; @@ -21,6 +18,7 @@ public class ProgramView : MonoBehaviour [SerializeField] private Button[] numberPadButtons; // 0-9 ư 迭 [SerializeField] private Button backspaceButton; [SerializeField] private Button createProgramButton; + [SerializeField] private Button loadProgramButton; [SerializeField] private Button openProgramButton; [SerializeField] private Button closeProgramListButton; diff --git a/Assets/Settings/Project Configuration/UniversalRenderPipelineGlobalSettings.asset b/Assets/Settings/Project Configuration/UniversalRenderPipelineGlobalSettings.asset index 5d8d0dc..43e4fa2 100644 --- a/Assets/Settings/Project Configuration/UniversalRenderPipelineGlobalSettings.asset +++ b/Assets/Settings/Project Configuration/UniversalRenderPipelineGlobalSettings.asset @@ -36,25 +36,25 @@ MonoBehaviour: - rid: 1876391467148115968 - rid: 1876391467148115969 - rid: 1876391467148115970 - - rid: 134555345068490825 + - rid: 134555388197732425 - rid: 1876391467148115972 - rid: 1876391467148115973 - - rid: 134555345068490826 - - rid: 134555345068490827 + - rid: 134555388197732426 + - rid: 134555388197732427 - rid: 1876391467148115976 - - rid: 134555345068490828 + - rid: 134555388197732428 - rid: 1876391467148115978 - - rid: 134555345068490829 - - rid: 134555345068490830 - - rid: 134555345068490831 - - rid: 134555345068490832 - - rid: 134555345068490833 - - rid: 134555345068490834 - - rid: 134555345068490835 + - rid: 134555388197732429 + - rid: 134555388197732430 + - rid: 134555388197732431 + - rid: 134555388197732432 + - rid: 134555388197732433 + - rid: 134555388197732434 + - rid: 134555388197732435 - rid: 1876391467148115986 - rid: 1876391467148115987 - rid: 1876391467148115988 - - rid: 134555345068490836 + - rid: 134555388197732436 m_RuntimeSettings: m_List: - rid: 1876391467148115968 @@ -97,7 +97,7 @@ MonoBehaviour: references: version: 2 RefIds: - - rid: 134555345068490825 + - rid: 134555388197732425 type: {class: Renderer2DResources, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_Version: 0 @@ -112,14 +112,14 @@ MonoBehaviour: m_DefaultLitMaterial: {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} m_DefaultUnlitMaterial: {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2} m_DefaultMaskMaterial: {fileID: 2100000, guid: 15d0c3709176029428a0da2f8cecf0b5, type: 2} - - rid: 134555345068490826 + - rid: 134555388197732426 type: {class: URPShaderStrippingSetting, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_Version: 0 m_StripUnusedPostProcessingVariants: 1 m_StripUnusedVariants: 1 m_StripScreenCoordOverrideVariants: 1 - - rid: 134555345068490827 + - rid: 134555388197732427 type: {class: UniversalRenderPipelineEditorMaterials, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_DefaultMaterial: {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} @@ -128,7 +128,7 @@ MonoBehaviour: m_DefaultTerrainMaterial: {fileID: 2100000, guid: 594ea882c5a793440b60ff72d896021e, type: 2} m_DefaultDecalMaterial: {fileID: 2100000, guid: 31d0dcc6f2dd4e4408d18036a2c93862, type: 2} m_DefaultSpriteMaterial: {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2} - - rid: 134555345068490828 + - rid: 134555388197732428 type: {class: UniversalRenderPipelineEditorShaders, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_AutodeskInteractive: {fileID: 4800000, guid: 0e9d5a909a1f7e84882a534d0d11e49f, type: 3} @@ -140,7 +140,7 @@ MonoBehaviour: m_DefaultSpeedTree7Shader: {fileID: 4800000, guid: 0f4122b9a743b744abe2fb6a0a88868b, type: 3} m_DefaultSpeedTree8Shader: {fileID: -6465566751694194690, guid: 9920c1f1781549a46ba081a2a15a16ec, type: 3} m_DefaultSpeedTree9Shader: {fileID: -6465566751694194690, guid: cbd3e1cc4ae141c42a30e33b4d666a61, type: 3} - - rid: 134555345068490829 + - rid: 134555388197732429 type: {class: GPUResidentDrawerResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.GPUDriven.Runtime} data: m_Version: 0 @@ -153,13 +153,13 @@ MonoBehaviour: m_OcclusionCullingDebugKernels: {fileID: 7200000, guid: b23e766bcf50ca4438ef186b174557df, type: 3} m_DebugOcclusionTestPS: {fileID: 4800000, guid: d3f0849180c2d0944bc71060693df100, type: 3} m_DebugOccluderPS: {fileID: 4800000, guid: b3c92426a88625841ab15ca6a7917248, type: 3} - - rid: 134555345068490830 + - rid: 134555388197732430 type: {class: STP/RuntimeResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_setupCS: {fileID: 7200000, guid: 33be2e9a5506b2843bdb2bdff9cad5e1, type: 3} m_preTaaCS: {fileID: 7200000, guid: a679dba8ec4d9ce45884a270b0e22dda, type: 3} m_taaCS: {fileID: 7200000, guid: 3923900e2b41b5e47bc25bfdcbcdc9e6, type: 3} - - rid: 134555345068490831 + - rid: 134555388197732431 type: {class: ProbeVolumeBakingResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_Version: 1 @@ -172,12 +172,12 @@ MonoBehaviour: skyOcclusionRT: {fileID: -5126288278712620388, guid: 5a2a534753fbdb44e96c3c78b5a6999d, type: 3} renderingLayerCS: {fileID: -6772857160820960102, guid: 94a070d33e408384bafc1dea4a565df9, type: 3} renderingLayerRT: {fileID: -5126288278712620388, guid: 94a070d33e408384bafc1dea4a565df9, type: 3} - - rid: 134555345068490832 + - rid: 134555388197732432 type: {class: ProbeVolumeGlobalSettings, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_Version: 1 m_ProbeVolumeDisableStreamingAssets: 0 - - rid: 134555345068490833 + - rid: 134555388197732433 type: {class: ProbeVolumeDebugResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_Version: 1 @@ -187,21 +187,21 @@ MonoBehaviour: probeVolumeOffsetDebugShader: {fileID: 4800000, guid: db8bd7436dc2c5f4c92655307d198381, type: 3} probeSamplingDebugMesh: {fileID: -3555484719484374845, guid: 20be25aac4e22ee49a7db76fb3df6de2, type: 3} numbersDisplayTex: {fileID: 2800000, guid: 73fe53b428c5b3440b7e87ee830b608a, type: 3} - - rid: 134555345068490834 + - rid: 134555388197732434 type: {class: IncludeAdditionalRPAssets, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_version: 0 m_IncludeReferencedInScenes: 0 m_IncludeAssetsByLabel: 0 m_LabelToInclude: - - rid: 134555345068490835 + - rid: 134555388197732435 type: {class: ProbeVolumeRuntimeResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_Version: 1 probeVolumeBlendStatesCS: {fileID: 7200000, guid: a3f7b8c99de28a94684cb1daebeccf5d, type: 3} probeVolumeUploadDataCS: {fileID: 7200000, guid: 0951de5992461754fa73650732c4954c, type: 3} probeVolumeUploadDataL2CS: {fileID: 7200000, guid: 6196f34ed825db14b81fb3eb0ea8d931, type: 3} - - rid: 134555345068490836 + - rid: 134555388197732436 type: {class: UniversalRenderPipelineEditorAssets, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_DefaultSettingsVolumeProfile: {fileID: 11400000, guid: eda47df5b85f4f249abf7abd73db2cb2, type: 2} diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 8989e78..39fb9ba 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -144,6 +144,9 @@ PlayerSettings: preloadedAssets: - {fileID: 0} - {fileID: 0} + - {fileID: 11400000, guid: 5dcc2603f77432c4b8f783205c89bc27, type: 2} + - {fileID: -6517218471499782410, guid: 1a4c68ca72a83449f938d669337cb305, type: 2} + - {fileID: 2707690468414890467, guid: a9a6963505ddf7f4d886008c6dc86122, type: 2} metroInputSource: 0 wsaTransparentSwapchain: 0 m_HolographicPauseOnTrackingLoss: 1