Commit 11196f28 authored by yzy's avatar yzy

更新

parent 00b58ec0
......@@ -17,17 +17,40 @@ public class AGVDemoV2 : MonoBehaviour
public ReportErrorsUI ReportErrorsUI;
public List<string> IsHasError;
public Animator animator;
private void Start()
{
IsHasError = new List<string>();
StartCoroutine(UpdatePosition());
StartCoroutine(UpdateErrorReporting());
// 递归查找名字为"机械臂"的子物体
Transform mechanicalArm = FindChildRecursive(AGVManager._getOrCreateAGV(AGVName).transform, "机械臂");
if (mechanicalArm != null)
{
animator = mechanicalArm.gameObject.GetComponent<Animator>();
}
else
{
Debug.Log("未找到名为'机械臂'的子物体");
}
}
private void Update()
{
// 根据需要设置playbackValue
AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0);
if (stateInfo.IsName("Base Layer.Run"))
{ //获取 Base Layer 动画节点下的名为 Run 的 State
animator.SetFloat("Playback", manager.position.z * 10/7); //设置 Blend 参数
}
}
private void UpdatePosition1()
{
AGVManager.AddMoveMsg(AGVName, manager.position, manager.angle);
AGVManager.AddMoveMsg(AGVName, new Vector3(manager.position.x,manager.position.y,0), manager.angle);
}
......@@ -89,4 +112,33 @@ public class AGVDemoV2 : MonoBehaviour
IsHasError.Remove(faultDataName);
}
}
/// <summary>
/// 查找子物体
/// </summary>
/// <param name="parent"></param>
/// <param name="childName"></param>
/// <returns></returns>
Transform FindChildRecursive(Transform parent, string childName)
{
// 遍历当前父物体的所有直接子物体
foreach (Transform child in parent)
{
// 如果找到名字匹配的子物体,返回该子物体
if (child.name == childName)
{
return child;
}
// 如果当前子物体本身还有子物体,则递归查找
Transform result = FindChildRecursive(child, childName);
if (result != null)
{
return result; // 如果在递归中找到目标物体,则返回
}
}
// 如果未找到,返回 null
return null;
}
}
......@@ -62,7 +62,7 @@ public class LoginManager : MonoBehaviour
{
RobotPositionData robotPositionData = (RobotPositionData)data;
position = new Vector3(robotPositionData.data.x, robotPositionData.data.y, robotPositionData.data.h);
angle = robotPositionData.data.angle * Mathf.Rad2Deg;
angle = -robotPositionData.data.angle * Mathf.Rad2Deg;
}
if (data.GetType().Equals(typeof(FaultEventData)))
......
......@@ -36,10 +36,10 @@ public class SensorDataManger : MonoBehaviour
void Start()
{
//编辑模式下使用,创建UI
//foreach (GameObject item in model1)
//{
// Create3dUI(item, _parent1);
//}
foreach (GameObject item in model1)
{
Create3dUI(item, _parent1);
}
//foreach (GameObject item in model2)
//{
......
This diff is collapsed.
This diff is collapsed.
fileFormatVersion: 2
guid: 44a2c14b43cb85944ba9187ff48feb25
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: a93d447385a84bb418a8d24975f6044e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!206 &-6210626056520547650
BlendTree:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Blend Tree
m_Childs:
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: 6c807dacf11ceec4e9aea66ad833d970, type: 2}
m_Threshold: 0
m_Position: {x: 0, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: Playback
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: a93d447385a84bb418a8d24975f6044e, type: 2}
m_Threshold: 1
m_Position: {x: 0, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: Playback
m_Mirror: 0
m_BlendParameter: Playback
m_BlendParameterY: Playback
m_MinThreshold: 0
m_MaxThreshold: 1
m_UseAutomaticThresholds: 1
m_NormalizedBlendValues: 0
m_BlendType: 0
--- !u!1102 &-296687887683303993
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Run
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: -6210626056520547650}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: "\u673A\u68B0\u81C2"
serializedVersion: 5
m_AnimatorParameters:
- m_Name: Playback
m_Type: 1
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: 2847669413238466397}
m_Mask: {fileID: 0}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!1107 &2847669413238466397
AnimatorStateMachine:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Base Layer
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: -296687887683303993}
m_Position: {x: 300, y: 120, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: -296687887683303993}
fileFormatVersion: 2
guid: b08872cc4286b044aaad51256ade5915
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 6c807dacf11ceec4e9aea66ad833d970
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:
......@@ -269,7 +269,7 @@ Transform:
- {fileID: 7406346047259710576}
- {fileID: 2936072568499754857}
- {fileID: 8612567583645825522}
- {fileID: 366409035860503496}
- {fileID: 5304500271951643563}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &620108419804543638
......@@ -1965,6 +1965,38 @@ MeshRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!1 &6941065035398678831
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5304500271951643563}
m_Layer: 0
m_Name: "\u673A\u68B0\u81C2"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5304500271951643563
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6941065035398678831}
serializedVersion: 2
m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 13.5698185, y: 5.850888, z: 4.711001}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 366409035860503496}
m_Father: {fileID: 9073857072825387431}
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0}
--- !u!1 &6982561176980490540
GameObject:
m_ObjectHideFlags: 0
......@@ -2598,32 +2630,32 @@ PrefabInstance:
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 9073857072825387431}
m_TransformParent: {fileID: 5304500271951643563}
m_Modifications:
- target: {fileID: -8679921383154817045, guid: 2926ca0cd0e49bc4fb33248b0258e5fb,
type: 3}
propertyPath: m_LocalPosition.x
value: 13.5698185
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 2926ca0cd0e49bc4fb33248b0258e5fb,
type: 3}
propertyPath: m_LocalPosition.y
value: 5.850887
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 2926ca0cd0e49bc4fb33248b0258e5fb,
type: 3}
propertyPath: m_LocalPosition.z
value: 4.711
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 2926ca0cd0e49bc4fb33248b0258e5fb,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 2926ca0cd0e49bc4fb33248b0258e5fb,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 2926ca0cd0e49bc4fb33248b0258e5fb,
type: 3}
......@@ -2653,7 +2685,7 @@ PrefabInstance:
- target: {fileID: 919132149155446097, guid: 2926ca0cd0e49bc4fb33248b0258e5fb,
type: 3}
propertyPath: m_Name
value: "\u673A\u68B0\u81C2\u652F\u67B6"
value: "\u673A\u68B0\u81C2"
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
......
......@@ -191,7 +191,7 @@ Transform:
m_GameObject: {fileID: 751308104399680690}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0, y: 0.319, z: -0.242}
m_LocalPosition: {x: -0, y: 0.319, z: 0.399}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
......@@ -307,7 +307,7 @@ Transform:
m_GameObject: {fileID: 1501631403894516518}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0, y: 0.319, z: -0.242}
m_LocalPosition: {x: -0, y: 0.319, z: 0.399}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
......@@ -435,7 +435,7 @@ Transform:
m_GameObject: {fileID: 1965839620980476416}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0, y: 0.158, z: -0.27}
m_LocalPosition: {x: 0, y: 0.158, z: 0.371}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
......@@ -680,6 +680,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 4819334625844746506}
- component: {fileID: 8454028405836851946}
m_Layer: 0
m_Name: "\u673A\u68B0\u81C2"
m_TagString: Untagged
......@@ -696,7 +697,7 @@ Transform:
m_GameObject: {fileID: 3166591749672883522}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.003, y: 0.662, z: -0.2}
m_LocalPosition: {x: 0.003, y: 0.662, z: 0.441}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
......@@ -704,6 +705,27 @@ Transform:
- {fileID: 5191093196653855318}
m_Father: {fileID: 5676559366613536494}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!95 &8454028405836851946
Animator:
serializedVersion: 5
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3166591749672883522}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: b08872cc4286b044aaad51256ade5915, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_StabilizeFeet: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0
--- !u!1 &3189119573151215578
GameObject:
m_ObjectHideFlags: 0
......
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