Commit 13f4aa09 authored by 杨泽宇's avatar 杨泽宇

更新

parent 8add1851
......@@ -9,13 +9,30 @@ public class AGVDemoV2 : MonoBehaviour
public DTAGVManager AGVManager;
public FacilityManager facilityManager;
public void Update()
{
UpdatePosition();
//UpdateErrorReporting();
}
private void UpdatePosition()
{
AGVManager.AddMoveMsg("AGV1", manager.position,manager.angle);
AGVManager.AddMoveMsg("AGV1", manager.position, manager.angle);
}
private void UpdateErrorReporting()
{
foreach (var faultData in manager.Failure.data)
{
for (int i = 0; i < facilityManager.Facilitys.Count; i++)
{
if (facilityManager.Facilitys[i].FacilityName == faultData.name)
{
facilityManager.OpenHighlighter(facilityManager.Facilitys[i]);
}
}
}
}
}
using HighlightPlus;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FacilityManager : MonoBehaviour
{
public List<Facility> Facilitys;
public void OpenHighlighter(Facility facility)
{
facility.highlight.highlighted = true;
}
public void CloseHighlighter(Facility facility)
{
facility.highlight.highlighted = false;
}
public void CloseAll()
{
for (int i = 0; i < Facilitys.Count; i++)
{
Facilitys[i].highlight.highlighted = false;
}
}
}
/// <summary>
/// 设备属性
/// </summary>
[System.Serializable]
public class Facility
{
[Tooltip("设备名称")]
public string FacilityName;
public HighlightEffect highlight;
}
fileFormatVersion: 2
guid: 589268cee7680404b8978b339c1bef55
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -8,7 +8,14 @@ public class LoginManager : MonoBehaviour
public TMP_InputField productionlineID;
public string ProductionlineID;
public TMP_InputField faultInterface;
public string FaultInterface;
public TMP_InputField lineID;
public string LineID;
private RobotPositionData positionData;
private FaultEventData faultData;
[Header("收到服务器信息事件")]
public ReceiveMsgEvent<object, string> OnReceiveMsg = new ReceiveMsgEvent<object, string>();
......@@ -17,7 +24,10 @@ public class LoginManager : MonoBehaviour
[Space]
[Header("获取的信息")]
public Vector3 position;
public bool IsFault = false;
public FaultEventData Failure;
public float angle;
private void Awake()
{
OnReceiveMsg.AddListener(_getData);
......@@ -26,11 +36,13 @@ public class LoginManager : MonoBehaviour
private void Start()
{
StartCoroutine(GetPositionData());
StartCoroutine(FaultInformation());
}
public void StartLogin()
{
StartCoroutine(GetPositionData());
StartCoroutine(FaultInformation());
}
protected void _getData(object data, string parameter)
......@@ -41,6 +53,21 @@ public class LoginManager : MonoBehaviour
position = new Vector3(robotPositionData.data.x, robotPositionData.data.y, robotPositionData.data.h);
angle = robotPositionData.data.angle * Mathf.Rad2Deg;
}
if (data.GetType().Equals(typeof(FaultEventData)))
{
FaultEventData faultEventData = (FaultEventData)data;
if (faultEventData.data != null && faultEventData.data.Length > 0)
{
IsFault = true;
Failure = faultEventData;
}
else
{
IsFault = false;
Failure = null;
}
}
}
private IEnumerator GetPositionData()
......@@ -75,6 +102,53 @@ public class LoginManager : MonoBehaviour
yield return new WaitForSeconds(1);
}
}
private IEnumerator FaultInformation()
{
string jsonData = "{\"lineId\":\"" + lineID.text + "\"}";
while (true)
{
using (UnityWebRequest request = UnityWebRequest.PostWwwForm(faultInterface.text, jsonData))
{
// 设置请求头
request.SetRequestHeader("Content-Type", "application/json");
// 设置请求体
byte[] bodyRaw = System.Text.Encoding.UTF8.GetBytes(jsonData);
request.uploadHandler = new UploadHandlerRaw(bodyRaw);
// 发送请求并等待响应
yield return request.SendWebRequest();
if (!string.IsNullOrEmpty(request.error))
{
Debug.LogError(request.error);
}
else
{
// 解析响应数据
string responseJson = request.downloadHandler.text;
// 使用 JsonUtility 解析 JSON 数据
faultData = JsonUtility.FromJson<FaultEventData>(responseJson);
// 检查是否成功拿到数据
if (faultData != null && faultData.code == 200)
{
OnReceiveMsg.Invoke(faultData, "FaultEventData");
Debug.Log(faultData);
}
else
{
Debug.Log("获取故障数据失败");
}
}
}
yield return new WaitForSeconds(60);
}
}
}
// 定义机器人位置数据结构
......@@ -93,3 +167,21 @@ public class RobotPositionDataDetails
public float h;
public float angle;
}
//定义机器人故障数据结构
[System.Serializable]
public class FaultEventData
{
public int code;
public string message;
public FaultData[] data;
}
[System.Serializable]
public class FaultData
{
public string faultDesc;
public string lineId;
public string faultStatusName;
public int distance;
public string name;
}
\ No newline at end of file
......@@ -103,7 +103,7 @@ MonoBehaviour:
m_PrefilterSSAOSampleCountHigh: 1
m_PrefilterDBufferMRT1: 1
m_PrefilterDBufferMRT2: 1
m_PrefilterDBufferMRT3: 0
m_PrefilterDBufferMRT3: 1
m_PrefilterSoftShadowsQualityLow: 1
m_PrefilterSoftShadowsQualityMedium: 1
m_PrefilterSoftShadowsQualityHigh: 1
......
......@@ -103,7 +103,7 @@ MonoBehaviour:
m_PrefilterSSAOSampleCountHigh: 0
m_PrefilterDBufferMRT1: 1
m_PrefilterDBufferMRT2: 1
m_PrefilterDBufferMRT3: 0
m_PrefilterDBufferMRT3: 1
m_PrefilterSoftShadowsQualityLow: 1
m_PrefilterSoftShadowsQualityMedium: 1
m_PrefilterSoftShadowsQualityHigh: 1
......
......@@ -526,6 +526,16 @@ PrefabInstance:
propertyPath: errorMessage
value:
objectReference: {fileID: 0}
- target: {fileID: 7167641365959060950, guid: 1728ef96ff7b1b44f943e3c988d53d15,
type: 3}
propertyPath: sampleCount
value: 99
objectReference: {fileID: 0}
- target: {fileID: 7167641365959060950, guid: 1728ef96ff7b1b44f943e3c988d53d15,
type: 3}
propertyPath: maxRayLength
value: 22.15
objectReference: {fileID: 0}
- target: {fileID: 7420797407481531335, guid: 1728ef96ff7b1b44f943e3c988d53d15,
type: 3}
propertyPath: m_LocalPosition.x
......@@ -576,6 +586,16 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7934641835805795049, guid: 1728ef96ff7b1b44f943e3c988d53d15,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8072579785216606601, guid: 1728ef96ff7b1b44f943e3c988d53d15,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
......@@ -5899,7 +5919,7 @@ MonoBehaviour:
type: 3}
m_PrefabInstance: {fileID: 2030149296}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_GameObject: {fileID: 1150943600}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 072f08e72de892843a653fc08f57e92e, type: 3}
......@@ -6544,6 +6564,51 @@ Transform:
m_Children: []
m_Father: {fileID: 1255737787}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &229087079
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 229087080}
- component: {fileID: 229087081}
m_Layer: 0
m_Name: "\u4E00\u53F7\u7EBF\u8BBE\u5907\u7BA1\u7406\u5668"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &229087080
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 229087079}
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: 712360727}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &229087081
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 229087079}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 589268cee7680404b8978b339c1bef55, type: 3}
m_Name:
m_EditorClassIdentifier:
Facilitys: []
--- !u!1 &243617132
GameObject:
m_ObjectHideFlags: 0
......@@ -6994,6 +7059,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
manager: {fileID: 346303891}
AGVManager: {fileID: 1452708772}
facilityManager: {fileID: 1954986197}
--- !u!114 &346303891
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -7008,7 +7074,16 @@ MonoBehaviour:
m_EditorClassIdentifier:
productionlineID: {fileID: 0}
ProductionlineID:
faultInterface: {fileID: 0}
FaultInterface:
lineID: {fileID: 0}
LineID:
position: {x: 0, y: 0, z: 0}
IsFault: 0
Failure:
code: 0
message:
data: []
angle: 0
--- !u!114 &346303892
MonoBehaviour:
......@@ -8086,6 +8161,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
manager: {fileID: 560685328}
AGVManager: {fileID: 1863911049}
facilityManager: {fileID: 229087081}
--- !u!114 &560685328
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -8100,7 +8176,16 @@ MonoBehaviour:
m_EditorClassIdentifier:
productionlineID: {fileID: 0}
ProductionlineID:
faultInterface: {fileID: 0}
FaultInterface:
lineID: {fileID: 0}
LineID:
position: {x: 0, y: 0, z: 0}
IsFault: 0
Failure:
code: 0
message:
data: []
angle: 0
--- !u!114 &560685329
MonoBehaviour:
......@@ -9241,6 +9326,8 @@ Transform:
- {fileID: 2138045817}
- {fileID: 560685326}
- {fileID: 346303889}
- {fileID: 229087080}
- {fileID: 1954986196}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &736446346
......@@ -10589,7 +10676,7 @@ PrefabInstance:
- target: {fileID: 3618798334208590804, guid: 72c6cc24197ee2747bcb13d5cf8e28c3,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 28
value: 28.00003
objectReference: {fileID: 0}
- target: {fileID: 3618798334326697998, guid: 72c6cc24197ee2747bcb13d5cf8e28c3,
type: 3}
......@@ -11470,6 +11557,28 @@ Transform:
m_Children: []
m_Father: {fileID: 1878323842}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1150943600 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 5763252307583660088, guid: e525963e80d07df418ccdd194c29ff2a,
type: 3}
m_PrefabInstance: {fileID: 2030149296}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1150943602
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1150943600}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 15b3d3b4482fada409f705f2b5722d1d, type: 3}
m_Name:
m_EditorClassIdentifier:
Profile: {fileID: 11400000, guid: ae523ae72b7203b449b724cbf8dd190d, type: 2}
OverrideGrowColor: 0
DisHightLightTargetName:
- "\u63D0\u793A\u7BAD\u5934"
--- !u!1 &1164115638
GameObject:
m_ObjectHideFlags: 0
......@@ -12467,7 +12576,7 @@ Light:
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Intensity: 1.2
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
......@@ -20600,6 +20709,51 @@ Transform:
m_Children: []
m_Father: {fileID: 1255737787}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1954986195
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1954986196}
- component: {fileID: 1954986197}
m_Layer: 0
m_Name: "\u4E8C\u53F7\u7EBF\u8BBE\u5907\u7BA1\u7406\u5668"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1954986196
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1954986195}
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: 712360727}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1954986197
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1954986195}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 589268cee7680404b8978b339c1bef55, type: 3}
m_Name:
m_EditorClassIdentifier:
Facilitys: []
--- !u!1 &1958240475
GameObject:
m_ObjectHideFlags: 0
......@@ -21380,6 +21534,10 @@ PrefabInstance:
type: 3}
insertIndex: -1
addedObject: {fileID: 2030149303}
- targetCorrespondingSourceObject: {fileID: 5763252307583660088, guid: e525963e80d07df418ccdd194c29ff2a,
type: 3}
insertIndex: -1
addedObject: {fileID: 1150943602}
- targetCorrespondingSourceObject: {fileID: 2607406461306109499, guid: e525963e80d07df418ccdd194c29ff2a,
type: 3}
insertIndex: -1
......
This diff is collapsed.
......@@ -133,7 +133,7 @@ MonoBehaviour:
active: 1
postExposure:
m_OverrideState: 1
m_Value: 0.43
m_Value: 1
contrast:
m_OverrideState: 1
m_Value: -27.9
......@@ -145,7 +145,7 @@ MonoBehaviour:
m_Value: 0
saturation:
m_OverrideState: 1
m_Value: 36
m_Value: 49
--- !u!114 &4682841257539252193
MonoBehaviour:
m_ObjectHideFlags: 3
......
......@@ -128,8 +128,8 @@ Material:
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.5660378, g: 0.5660378, b: 0.5660378, a: 1}
- _Color: {r: 0.5660378, g: 0.5660378, b: 0.5660378, a: 1}
- _BaseColor: {r: 0.66162336, g: 0.7686464, b: 0.7924528, a: 1}
- _Color: {r: 0.6616233, g: 0.7686464, b: 0.7924528, a: 1}
- _EmissionColor: {r: 1.4017444, g: 1.6688899, b: 1.6981132, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
......@@ -5,7 +5,7 @@ EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes:
- enabled: 0
- enabled: 1
path: Assets/_Scenes/1_Main.unity
guid: a1193329f89803b4f8a14f6c0b15d2c1
- enabled: 0
......@@ -14,7 +14,7 @@ EditorBuildSettings:
- enabled: 0
path: Assets/_Scenes/1_MainScene.unity
guid: e4c39eb47535a384593b511e167b172c
- enabled: 1
- enabled: 0
path: Assets/_Scenes/CollectData.unity
guid: 7cb79544f5cf7bb41afc6ff81fa0afd7
m_configObjects:
......
......@@ -42,8 +42,8 @@ PlayerSettings:
m_SplashScreenLogos: []
m_VirtualRealitySplashScreen: {fileID: 0}
m_HolographicTrackingLossScreen: {fileID: 0}
defaultScreenWidth: 1280
defaultScreenHeight: 720
defaultScreenWidth: 1920
defaultScreenHeight: 1080
defaultScreenWidthWeb: 1280
defaultScreenHeightWeb: 1080
m_StereoRenderingPath: 0
......@@ -103,7 +103,7 @@ PlayerSettings:
xboxEnableFitness: 0
visibleInBackground: 1
allowFullscreenSwitch: 1
fullscreenMode: 3
fullscreenMode: 1
xboxSpeechDB: 0
xboxEnableHeadOrientation: 0
xboxEnableGuest: 0
......@@ -159,7 +159,7 @@ PlayerSettings:
androidSupportedAspectRatio: 1
androidMaxAspectRatio: 2.1
applicationIdentifier:
Standalone: com.sd-zeus.DigitalTwinTemplate
Standalone: com.sd-zeus.------------------------
buildNumber:
Standalone: 0
VisionOS: 0
......
No preview for this file type
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment