actuations demo added

This commit is contained in:
2024-04-15 10:43:55 +01:00
parent 63e2ce1871
commit 3381a52f2f
28 changed files with 3254 additions and 21 deletions

View File

@@ -1320,6 +1320,84 @@ Transform:
- {fileID: 1601195943} - {fileID: 1601195943}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &705277292
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 725708368551456178, guid: 59e55294465c533428f9c418e3b29a89,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.40447474
objectReference: {fileID: 0}
- target: {fileID: 725708368551456178, guid: 59e55294465c533428f9c418e3b29a89,
type: 3}
propertyPath: m_LocalPosition.y
value: 0.6
objectReference: {fileID: 0}
- target: {fileID: 725708368551456178, guid: 59e55294465c533428f9c418e3b29a89,
type: 3}
propertyPath: m_LocalPosition.z
value: -1.5552711
objectReference: {fileID: 0}
- target: {fileID: 725708368551456178, guid: 59e55294465c533428f9c418e3b29a89,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 725708368551456178, guid: 59e55294465c533428f9c418e3b29a89,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 725708368551456178, guid: 59e55294465c533428f9c418e3b29a89,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 725708368551456178, guid: 59e55294465c533428f9c418e3b29a89,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 725708368551456178, guid: 59e55294465c533428f9c418e3b29a89,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 725708368551456178, guid: 59e55294465c533428f9c418e3b29a89,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 725708368551456178, guid: 59e55294465c533428f9c418e3b29a89,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1770780657798152667, guid: 59e55294465c533428f9c418e3b29a89,
type: 3}
propertyPath: m_Name
value: SMPLXcfjActuations
objectReference: {fileID: 0}
- target: {fileID: 2589419581028157696, guid: 59e55294465c533428f9c418e3b29a89,
type: 3}
propertyPath: m_UseGravity
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2589419581028157696, guid: 59e55294465c533428f9c418e3b29a89,
type: 3}
propertyPath: m_IsKinematic
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 59e55294465c533428f9c418e3b29a89, type: 3}
--- !u!1 &709210744 --- !u!1 &709210744
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1761,7 +1839,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 882491594} m_GameObject: {fileID: 882491594}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0.52918464, y: -0.000000026320045, z: 0.000000016414912, w: 0.8485067} m_LocalRotation: {x: 0.52918464, y: 0.000000026320038, z: -0.000000016414909, w: 0.8485067}
m_LocalPosition: {x: 18.113062, y: 9.285504, z: -0.5535152} m_LocalPosition: {x: 18.113062, y: 9.285504, z: -0.5535152}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
@@ -14913,3 +14991,4 @@ SceneRoots:
- {fileID: 709210745} - {fileID: 709210745}
- {fileID: 951379159} - {fileID: 951379159}
- {fileID: 1080375957} - {fileID: 1080375957}
- {fileID: 705277292}

View File

@@ -1,5 +1,6 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Unity.Collections.LowLevel.Unsafe;
using UnityEngine; using UnityEngine;
using UnityEngine.Pool; using UnityEngine.Pool;
@@ -10,6 +11,12 @@ public class Body : MonoBehaviour
public int m_DespawnTimer; public int m_DespawnTimer;
public bool m_JDActive; public bool m_JDActive;
public bool m_RandomActuations;
private float m_Noise;
private float m_NoiseX;
private float m_NoiseY;
private float m_NoiseZ;
[Header("Body Parts")] [Header("Body Parts")]
public Transform m_Head; public Transform m_Head;
@@ -25,6 +32,8 @@ public class Body : MonoBehaviour
public Transform m_Right_Arm; public Transform m_Right_Arm;
public Transform m_Right_Forearm; public Transform m_Right_Forearm;
[Range(-1, 1)]
public float t;
private JointDriveController m_JDController; private JointDriveController m_JDController;
@@ -51,7 +60,13 @@ public class Body : MonoBehaviour
m_JDController.SetupBodyPart(m_Right_Forearm); m_JDController.SetupBodyPart(m_Right_Forearm);
} }
StartCoroutine(DespawnTimer()); m_NoiseX = Random.Range(-200, 200);
m_NoiseY = Random.Range(-200, 200);
m_NoiseZ = Random.Range(-200, 200);
if(!m_RandomActuations)
StartCoroutine(DespawnTimer());
//StartCoroutine(DespawnTimer());
} }
@@ -66,4 +81,24 @@ public class Body : MonoBehaviour
m_Pool.Release(this); m_Pool.Release(this);
} }
private void FixedUpdate(){
if(m_RandomActuations)
RandomActutations();
}
public void RandomActutations(){
var bpDict = m_JDController.bodyPartsDict;
m_Noise += Time.fixedDeltaTime * 2;
var counter = 0;
foreach (var bodyPart in bpDict.Values){
m_NoiseX = Random.Range(-2, 2);
m_NoiseY = Random.Range(-2, 2);
m_NoiseZ = Random.Range(-2, 2);
bodyPart.SetJointTargetRotation(m_NoiseX, m_NoiseY, m_NoiseZ);
//bodyPart.SetJointStrength(1);
counter++;
}
}
} }

View File

@@ -60,6 +60,7 @@ using UnityEngine;
currentZNormalizedRot = Mathf.InverseLerp(-joint.angularZLimit.limit, joint.angularZLimit.limit, zRot); currentZNormalizedRot = Mathf.InverseLerp(-joint.angularZLimit.limit, joint.angularZLimit.limit, zRot);
joint.targetRotation = Quaternion.Euler(xRot, yRot, zRot); joint.targetRotation = Quaternion.Euler(xRot, yRot, zRot);
//Debug.Log($"y{y}, limit{-joint.angularYLimit.limit}, target{joint.targetRotation}");
currentEularJointRotation = new Vector3(xRot, yRot, zRot); currentEularJointRotation = new Vector3(xRot, yRot, zRot);
} }
@@ -82,7 +83,6 @@ using UnityEngine;
[Header("Joint Drive Settings")] [Header("Joint Drive Settings")]
[Space(10)] [Space(10)]
public float maxJointSpring; public float maxJointSpring;
public float jointDampen; public float jointDampen;
public float maxJointForceLimit; public float maxJointForceLimit;
@@ -148,5 +148,5 @@ using UnityEngine;
} }
} }
} }
} }
} }

View File

@@ -365,6 +365,7 @@ MonoBehaviour:
m_Pelvis: {fileID: 4895783841800412640} m_Pelvis: {fileID: 4895783841800412640}
m_DespawnTimer: 45 m_DespawnTimer: 45
m_JDActive: 0 m_JDActive: 0
m_RandomActuations: 0
m_Head: {fileID: 3084171519954960708} m_Head: {fileID: 3084171519954960708}
m_Spine: {fileID: 9008230995607606429} m_Spine: {fileID: 9008230995607606429}
m_Left_Thigh: {fileID: 6147050757370940292} m_Left_Thigh: {fileID: 6147050757370940292}
@@ -377,6 +378,7 @@ MonoBehaviour:
m_Left_Forearm: {fileID: 7447345369338858421} m_Left_Forearm: {fileID: 7447345369338858421}
m_Right_Arm: {fileID: 3430350035868801998} m_Right_Arm: {fileID: 3430350035868801998}
m_Right_Forearm: {fileID: 1751176754825644261} m_Right_Forearm: {fileID: 1751176754825644261}
t: 0
--- !u!114 &4008916333058776879 --- !u!114 &4008916333058776879
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -390,7 +392,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
maxJointSpring: 0 maxJointSpring: 0
jointDampen: 40000 jointDampen: 400000
maxJointForceLimit: 3.402823e+38 maxJointForceLimit: 3.402823e+38
bodyPartsList: [] bodyPartsList: []
--- !u!1 &2317700900345097672 --- !u!1 &2317700900345097672
@@ -492,7 +494,7 @@ ConfigurableJoint:
m_AutoConfigureConnectedAnchor: 1 m_AutoConfigureConnectedAnchor: 1
m_ConnectedAnchor: {x: 0, y: 0, z: 0} m_ConnectedAnchor: {x: 0, y: 0, z: 0}
serializedVersion: 3 serializedVersion: 3
m_SecondaryAxis: {x: 0, y: 0, z: 0} m_SecondaryAxis: {x: 0, y: 0, z: -1}
m_XMotion: 0 m_XMotion: 0
m_YMotion: 0 m_YMotion: 0
m_ZMotion: 0 m_ZMotion: 0
@@ -510,11 +512,11 @@ ConfigurableJoint:
spring: 0 spring: 0
damper: 0 damper: 0
m_LowAngularXLimit: m_LowAngularXLimit:
limit: -90 limit: -150
bounciness: 0 bounciness: 0
contactDistance: 0 contactDistance: 0
m_HighAngularXLimit: m_HighAngularXLimit:
limit: 90 limit: 0
bounciness: 0 bounciness: 0
contactDistance: 0 contactDistance: 0
m_AngularYZLimitSpring: m_AngularYZLimitSpring:
@@ -760,11 +762,11 @@ ConfigurableJoint:
spring: 0 spring: 0
damper: 0 damper: 0
m_LowAngularXLimit: m_LowAngularXLimit:
limit: -25 limit: -76
bounciness: 0 bounciness: 0
contactDistance: 0 contactDistance: 0
m_HighAngularXLimit: m_HighAngularXLimit:
limit: 55 limit: 70
bounciness: 0 bounciness: 0
contactDistance: 0 contactDistance: 0
m_AngularYZLimitSpring: m_AngularYZLimitSpring:
@@ -1292,7 +1294,7 @@ ConfigurableJoint:
m_AutoConfigureConnectedAnchor: 1 m_AutoConfigureConnectedAnchor: 1
m_ConnectedAnchor: {x: -0.0025533193, y: -0.00015649231, z: -0.00022946484} m_ConnectedAnchor: {x: -0.0025533193, y: -0.00015649231, z: -0.00022946484}
serializedVersion: 3 serializedVersion: 3
m_SecondaryAxis: {x: 0, y: 0, z: 0} m_SecondaryAxis: {x: 0, y: 0, z: 1}
m_XMotion: 0 m_XMotion: 0
m_YMotion: 0 m_YMotion: 0
m_ZMotion: 0 m_ZMotion: 0
@@ -1310,11 +1312,11 @@ ConfigurableJoint:
spring: 0 spring: 0
damper: 0 damper: 0
m_LowAngularXLimit: m_LowAngularXLimit:
limit: -90 limit: 0
bounciness: 0 bounciness: 0
contactDistance: 0 contactDistance: 0
m_HighAngularXLimit: m_HighAngularXLimit:
limit: 90 limit: 150
bounciness: 0 bounciness: 0
contactDistance: 0 contactDistance: 0
m_AngularYZLimitSpring: m_AngularYZLimitSpring:
@@ -2205,11 +2207,11 @@ ConfigurableJoint:
m_ConnectedBody: {fileID: 4975426484968991098} m_ConnectedBody: {fileID: 4975426484968991098}
m_ConnectedArticulationBody: {fileID: 0} m_ConnectedArticulationBody: {fileID: 0}
m_Anchor: {x: 0, y: 0, z: 0} m_Anchor: {x: 0, y: 0, z: 0}
m_Axis: {x: 0, y: 0, z: 1} m_Axis: {x: 0, y: 1, z: 0}
m_AutoConfigureConnectedAnchor: 1 m_AutoConfigureConnectedAnchor: 1
m_ConnectedAnchor: {x: 0, y: 0, z: 0} m_ConnectedAnchor: {x: 0, y: 0, z: 0}
serializedVersion: 3 serializedVersion: 3
m_SecondaryAxis: {x: 0, y: 1, z: 0} m_SecondaryAxis: {x: 0, y: 0, z: 1}
m_XMotion: 0 m_XMotion: 0
m_YMotion: 0 m_YMotion: 0
m_ZMotion: 0 m_ZMotion: 0
@@ -2414,11 +2416,11 @@ ConfigurableJoint:
spring: 0 spring: 0
damper: 0 damper: 0
m_LowAngularXLimit: m_LowAngularXLimit:
limit: -25 limit: -76
bounciness: 0 bounciness: 0
contactDistance: 0 contactDistance: 0
m_HighAngularXLimit: m_HighAngularXLimit:
limit: 55 limit: 70
bounciness: 0 bounciness: 0
contactDistance: 0 contactDistance: 0
m_AngularYZLimitSpring: m_AngularYZLimitSpring:
@@ -2815,11 +2817,11 @@ ConfigurableJoint:
spring: 0 spring: 0
damper: 0 damper: 0
m_LowAngularXLimit: m_LowAngularXLimit:
limit: -31.522825 limit: -21.477825
bounciness: 0 bounciness: 0
contactDistance: 0 contactDistance: 0
m_HighAngularXLimit: m_HighAngularXLimit:
limit: 27.674957 limit: 23.161743
bounciness: 0 bounciness: 0
contactDistance: 0 contactDistance: 0
m_AngularYZLimitSpring: m_AngularYZLimitSpring:

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -1 +1 @@
{"count":1,"self":169.173824,"total":175.70866619999998,"children":{"InitializeActuators":{"count":1,"self":0.0017232999999999999,"total":0.0017232999999999999,"children":null},"InitializeSensors":{"count":1,"self":0.0015046,"total":0.0015046,"children":null},"AgentSendState":{"count":9952,"self":0.0856932,"total":2.6710059999999998,"children":{"CollectObservations":{"count":4976,"self":2.546122,"total":2.546122,"children":null},"WriteActionMask":{"count":4976,"self":0.0101377,"total":0.0101377,"children":null},"RequestDecision":{"count":4976,"self":0.0290531,"total":0.0290531,"children":null}}},"DecideAction":{"count":9952,"self":2.6619052,"total":2.6619051,"children":null},"AgentAct":{"count":9952,"self":1.1982021,"total":1.1982021,"children":null}},"gauges":{"DReCon-v0.CumulativeReward":{"count":2,"max":485.7487,"min":60.126297,"runningAverage":272.9375,"value":485.7487,"weightedAverage":166.531891}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1712925795","unity_version":"2022.3.5f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.5f1\\Editor\\Unity.exe -projectpath C:\\Users\\caile\\Desktop\\drecon-unity -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-cail -hubSessionId 3fbdf177-9b94-4cc1-adfd-c08277a8eede -accessToken odeT9cSeLBQY3FrA1yA0599oEegUBhCWJkhIJG2gUmk005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"DreconDemo","end_time_seconds":"1712925970"}} {"count":1,"self":343.2649728,"total":356.2922359,"children":{"InitializeActuators":{"count":1,"self":0.0015141999999999998,"total":0.0015141999999999998,"children":null},"InitializeSensors":{"count":1,"self":0.0015138999999999999,"total":0.0015138999999999999,"children":null},"AgentSendState":{"count":20695,"self":0.150388,"total":3.4469627,"children":{"CollectObservations":{"count":10348,"self":3.2364884,"total":3.2364884999999997,"children":null},"WriteActionMask":{"count":10348,"self":0.010846,"total":0.010846,"children":null},"RequestDecision":{"count":10348,"self":0.0492402,"total":0.0492402,"children":null}}},"DecideAction":{"count":20695,"self":7.0784232,"total":7.0784232,"children":null},"AgentAct":{"count":20695,"self":2.494808,"total":2.494808,"children":null}},"gauges":{"DReCon-v0.CumulativeReward":{"count":2,"max":583.8104,"min":56.8946228,"runningAverage":320.352539,"value":583.8104,"weightedAverage":188.623566}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1712939083","unity_version":"2022.3.5f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.5f1\\Editor\\Unity.exe -projectpath C:\\Users\\caile\\Desktop\\drecon-unity -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-cail -hubSessionId 3fbdf177-9b94-4cc1-adfd-c08277a8eede -accessToken odeT9cSeLBQY3FrA1yA0599oEegUBhCWJkhIJG2gUmk005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"DreconDemo","end_time_seconds":"1712939440"}}