diff --git a/Assets/Resources/Prefabs/Factory/AGV.prefab b/Assets/Resources/Prefabs/Factory/AGV.prefab
index 02e09d66..c840efe5 100644
--- a/Assets/Resources/Prefabs/Factory/AGV.prefab
+++ b/Assets/Resources/Prefabs/Factory/AGV.prefab
@@ -48,7 +48,7 @@ MonoBehaviour:
modelObject: {fileID: 7493524444357289953}
moveSpeed: 0.9
rotationSpeed: 0.5
- teleportDistanceThreshold: 2
+ teleportDistanceThreshold: 5
teleportRotationThreshold: 45
--- !u!1 &6358428858938227828
GameObject:
diff --git a/Assets/Scenes/SampleProject.unity b/Assets/Scenes/SampleProject.unity
index 1751c7c4..8857323c 100644
--- a/Assets/Scenes/SampleProject.unity
+++ b/Assets/Scenes/SampleProject.unity
@@ -610,7 +610,7 @@ Transform:
m_GameObject: {fileID: 330585543}
serializedVersion: 2
m_LocalRotation: {x: 0.2588191, y: 0, z: 0, w: 0.9659258}
- m_LocalPosition: {x: 77.5, y: 34, z: -15}
+ m_LocalPosition: {x: 141, y: 58, z: -38}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -694,7 +694,7 @@ MonoBehaviour:
zoomSpeed: 10
maxPanDelta: 50
minCameraY: 2
- maxCameraY: 50
+ maxCameraY: 80
minPitch: 20
maxPitch: 85
minYaw: -45
diff --git a/Assets/Scripts/SampleProject/SceneMain.cs b/Assets/Scripts/SampleProject/SceneMain.cs
index 1277e8df..447b6c19 100644
--- a/Assets/Scripts/SampleProject/SceneMain.cs
+++ b/Assets/Scripts/SampleProject/SceneMain.cs
@@ -8,6 +8,7 @@ using UVC.Data.Core;
using UVC.Factory;
using UVC.Factory.Alarm;
using UVC.Factory.Component;
+using UVC.Factory.Modal;
using UVC.Factory.Modal.Settings;
using UVC.Factory.Playback;
using UVC.Log;
@@ -46,6 +47,7 @@ namespace SampleProject
// AGVManager 생성 시 이벤트 처리
AGVManager.Instance.OnAGVCreated += OnAGVCreated;
+ PlaybackService.Instance.OnStartPlayback += OnStartPlayback;
PlaybackService.Instance.OnExitPlayback += OnExitPlayback;
await requestDataAsync();
@@ -59,6 +61,8 @@ namespace SampleProject
}
}
+
+
///
/// AGV 관리자가 생성될 때 발생하는 이벤트를 처리합니다.
///
@@ -99,8 +103,18 @@ namespace SampleProject
}
}
+
+ private void OnStartPlayback()
+ {
+ FactoryObjectSelectionManager.Instance.DeselectAll();
+ InfoWindow.Instance.Hide();
+ }
+
+
private async void OnExitPlayback()
{
+ FactoryObjectSelectionManager.Instance.DeselectAll();
+ InfoWindow.Instance.Hide();
await requestDataAsync();
}
diff --git a/Assets/Scripts/UVC/Factory/Camera/FactoryCameraController.cs b/Assets/Scripts/UVC/Factory/Camera/FactoryCameraController.cs
index 0261a7bc..0960dd30 100644
--- a/Assets/Scripts/UVC/Factory/Camera/FactoryCameraController.cs
+++ b/Assets/Scripts/UVC/Factory/Camera/FactoryCameraController.cs
@@ -42,7 +42,7 @@ namespace UVC.Factory
[Tooltip("카메라 최대 높이")]
[SerializeField]
- private float maxCameraY = 50f;
+ private float maxCameraY = 80f;
[Tooltip("카메라의 최소 수직 회전 각도 (X축)")]
[SerializeField]
diff --git a/Assets/Scripts/UVC/Factory/Component/AGV.cs b/Assets/Scripts/UVC/Factory/Component/AGV.cs
index 67ae1cb8..1de1c4eb 100644
--- a/Assets/Scripts/UVC/Factory/Component/AGV.cs
+++ b/Assets/Scripts/UVC/Factory/Component/AGV.cs
@@ -1,5 +1,6 @@
#nullable enable
using EPOOutline;
+using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
@@ -22,7 +23,7 @@ namespace UVC.Factory.Component
{
// 서버에서 받은 좌표(예: 밀리미터 단위)를 Unity 씬의 단위(미터)로 변환하기 위한 스케일 값입니다.
// 예를 들어, 서버 좌표 1000이 Unity에서 1미터가 되려면 0.001f로 설정합니다.
- private float scaleFactor = 0.0005f; // Unity에서 사용하는 단위로 변환하기 위한 스케일 팩터
+ private float scaleFactor = 0.001f; // Unity에서 사용하는 단위로 변환하기 위한 스케일 팩터
// 데이터로부터 수신한 AGV의 목표 위치와 목표 회전값입니다.
// AGV는 현재 위치에서 이 목표 지점을 향해 부드럽게 움직입니다.
@@ -60,6 +61,9 @@ namespace UVC.Factory.Component
private Outlinable? outlinable;
+ private float agvFloorOffset = 200f; //agv의 층을 구별하기 위한 값
+ private float agvZOffset = -197.5f; //층을 옮긴 agv의 위치를 잡아주기 위한 값
+
///
/// AGV 객체가 생성될 때 처음 한 번 호출되는 초기화 메서드입니다.
///
@@ -151,6 +155,7 @@ namespace UVC.Factory.Component
///
/// 데이터 객체로부터 위치(X, Y) 및 각도(DEGREE) 값을 읽어와 AGV의 목표 위치와 회전을 설정합니다.
+ /// 이전 데이터의 timestamp를 이용해 업데이트 간격을 계산하고, 속도와 회전 속도를 조절합니다.
///
/// 위치와 각도 정보가 포함된 데이터 객체입니다.
private void UpdatePositionAndRotation(DataObject newData)
@@ -173,6 +178,23 @@ namespace UVC.Factory.Component
}
else // 이후 업데이트의 경우
{
+ // 타임스탬프를 이용해 데이터 업데이트 간격을 계산합니다.
+ DateTime? newTimestamp = newData.GetDateTime("TIMESTAMP");
+ DateTime? currentTimestamp = data.GetDateTime("TIMESTAMP");
+ float updateInterval = 1.0f; // 기본 간격은 1초로 설정
+
+ if (newTimestamp.HasValue && currentTimestamp.HasValue)
+ {
+ // 두 타임스탬프의 차이를 초 단위로 계산합니다.
+ TimeSpan interval = newTimestamp.Value - currentTimestamp.Value;
+ updateInterval = (float)interval.TotalSeconds;
+
+ // 간격이 0 이하일 경우(오류 방지), 기본값 1초를 사용합니다.
+ if (updateInterval <= 0)
+ {
+ updateInterval = 1.0f;
+ }
+ }
bool changed = false;
@@ -193,6 +215,9 @@ namespace UVC.Factory.Component
float distanceToTarget = Vector3.Distance(transform.position, newTargetPosition);
if (distanceToTarget > 0)
{
+ // 이동 속도(moveSpeed)를 계산된 시간 간격을 기반으로 설정합니다.
+ moveSpeed = updateInterval * 0.9f; // 90%의 시간 동안 도달하도록 설정
+
// 거리가 설정된 임계값을 초과하면, 보간을 건너뛰고 즉시 위치을 설정합니다.
if (distanceToTarget > teleportDistanceThreshold)
{
@@ -220,6 +245,9 @@ namespace UVC.Factory.Component
// 현재 회전과 새로운 목표 회전 사이의 각도 차이를 계산합니다.
if (distanceToTargetRotation > 0)
{
+ // 회전 속도(rotationSpeed)를 계산된 시간 간격을 기반으로 설정합니다.
+ rotationSpeed = updateInterval * 0.5f; // 50%의 시간 동안 회전하도록 설정
+
// 각도 차이가 설정된 임계값을 초과하면, 보간을 건너뛰고 즉시 회전을 설정합니다.
if (distanceToTargetRotation > teleportRotationThreshold)
{
diff --git a/Assets/Scripts/UVC/Factory/Playback/PlaybackCommand.cs b/Assets/Scripts/UVC/Factory/Playback/PlaybackCommand.cs
index 15746911..5791df91 100644
--- a/Assets/Scripts/UVC/Factory/Playback/PlaybackCommand.cs
+++ b/Assets/Scripts/UVC/Factory/Playback/PlaybackCommand.cs
@@ -1,6 +1,8 @@
#nullable enable
using UnityEngine;
using UVC.Data;
+using UVC.Factory.Component;
+using UVC.Factory.Modal;
using UVC.Factory.Playback.UI;
using UVC.UI.Commands;
using UVC.UI.Loading;
diff --git a/Assets/Scripts/UVC/Factory/Playback/PlaybackService.cs b/Assets/Scripts/UVC/Factory/Playback/PlaybackService.cs
index 8210821d..54edb33d 100644
--- a/Assets/Scripts/UVC/Factory/Playback/PlaybackService.cs
+++ b/Assets/Scripts/UVC/Factory/Playback/PlaybackService.cs
@@ -48,7 +48,8 @@ namespace UVC.Factory.Playback
private string time;
private string fileName;
- public Action OnExitPlayback;
+ public Action? OnStartPlayback;
+ public Action? OnExitPlayback;
private float timeScale = 1.0f;
///
@@ -199,6 +200,7 @@ namespace UVC.Factory.Playback
timeScale = 1.0f; //기본 시간 스케일 설정
UIPlayback.Instance.Show();
await UIPlayback.Instance.SetData(data.date, data.time, data.sqlFileName);
+ OnStartPlayback?.Invoke();
}
///
@@ -345,7 +347,7 @@ namespace UVC.Factory.Playback
if (OnComplete != null) OnComplete.Invoke(errorMessage);
}
},
- (string? error) =>
+ (string error) =>
{
Debug.Log($"DownloadPlaybackData OnError:{error}");
if (OnComplete != null) OnComplete.Invoke(error);
@@ -353,6 +355,5 @@ namespace UVC.Factory.Playback
}
}
-
}
}