Browse Source

actuations demo added

audio
Cailean Finn 8 months ago
parent
commit
3381a52f2f
  1. 81
      Assets/5_Scenes/DreconDemo.unity
  2. 37
      Assets/8_Scripts/2_General/Body.cs
  3. 6
      Assets/8_Scripts/2_General/JointDriveController.cs
  4. 0
      Assets/8_Scripts/2_General/MarathonMan004.meta
  5. 0
      Assets/8_Scripts/2_General/MarathonMan004/AgentMove-outcome.prefab
  6. 0
      Assets/8_Scripts/2_General/MarathonMan004/AgentMove-outcome.prefab.meta
  7. 0
      Assets/8_Scripts/2_General/MarathonMan004/AgentMove-source.prefab
  8. 0
      Assets/8_Scripts/2_General/MarathonMan004/AgentMove-source.prefab.meta
  9. 0
      Assets/8_Scripts/2_General/MarathonMan004/BlueJoints.mat
  10. 0
      Assets/8_Scripts/2_General/MarathonMan004/BlueJoints.mat.meta
  11. 0
      Assets/8_Scripts/2_General/MarathonMan004/BlueSurface.mat
  12. 0
      Assets/8_Scripts/2_General/MarathonMan004/BlueSurface.mat.meta
  13. 0
      Assets/8_Scripts/2_General/MarathonMan004/Idle.fbx
  14. 0
      Assets/8_Scripts/2_General/MarathonMan004/Idle.fbx.meta
  15. 0
      Assets/8_Scripts/2_General/MarathonMan004/MarathonMan004.prefab
  16. 0
      Assets/8_Scripts/2_General/MarathonMan004/MarathonMan004.prefab.meta
  17. 0
      Assets/8_Scripts/2_General/MarathonMan004/RedJoints.mat
  18. 0
      Assets/8_Scripts/2_General/MarathonMan004/RedJoints.mat.meta
  19. 0
      Assets/8_Scripts/2_General/MarathonMan004/RedSurface.mat
  20. 0
      Assets/8_Scripts/2_General/MarathonMan004/RedSurface.mat.meta
  21. 0
      Assets/8_Scripts/2_General/MarathonMan004/T-Pose.fbx
  22. 0
      Assets/8_Scripts/2_General/MarathonMan004/T-Pose.fbx.meta
  23. 0
      Assets/8_Scripts/2_General/MarathonMan004/TargetDebug.mat
  24. 0
      Assets/8_Scripts/2_General/MarathonMan004/TargetDebug.mat.meta
  25. 32
      Assets/9_Models/Humanoid/SMPLX/SMPLXcfj.prefab
  26. 3110
      Assets/9_Models/Humanoid/SMPLX/SMPLXcfjActuations.prefab
  27. 7
      Assets/9_Models/Humanoid/SMPLX/SMPLXcfjActuations.prefab.meta
  28. 2
      Assets/ML-Agents/Timers/DreconDemo_timers.json

81
Assets/5_Scenes/DreconDemo.unity

@ -1320,6 +1320,84 @@ Transform:
- {fileID: 1601195943}
m_Father: {fileID: 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
GameObject:
m_ObjectHideFlags: 0
@ -1761,7 +1839,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 882491594}
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_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -14913,3 +14991,4 @@ SceneRoots:
- {fileID: 709210745}
- {fileID: 951379159}
- {fileID: 1080375957}
- {fileID: 705277292}

37
Assets/8_Scripts/2_General/Body.cs

@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using Unity.Collections.LowLevel.Unsafe;
using UnityEngine;
using UnityEngine.Pool;
@ -10,6 +11,12 @@ public class Body : MonoBehaviour
public int m_DespawnTimer;
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")]
public Transform m_Head;
@ -25,6 +32,8 @@ public class Body : MonoBehaviour
public Transform m_Right_Arm;
public Transform m_Right_Forearm;
[Range(-1, 1)]
public float t;
private JointDriveController m_JDController;
@ -50,8 +59,14 @@ public class Body : MonoBehaviour
m_JDController.SetupBodyPart(m_Right_Arm);
m_JDController.SetupBodyPart(m_Right_Forearm);
}
m_NoiseX = Random.Range(-200, 200);
m_NoiseY = Random.Range(-200, 200);
m_NoiseZ = Random.Range(-200, 200);
StartCoroutine(DespawnTimer());
if(!m_RandomActuations)
StartCoroutine(DespawnTimer());
//StartCoroutine(DespawnTimer());
}
@ -66,4 +81,24 @@ public class Body : MonoBehaviour
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++;
}
}
}

6
Assets/8_Scripts/2_General/JointDriveController.cs

@ -49,7 +49,7 @@ using UnityEngine;
x = (x + 1f) * 0.5f;
y = (y + 1f) * 0.5f;
z = (z + 1f) * 0.5f;
var xRot = Mathf.Lerp(joint.lowAngularXLimit.limit, joint.highAngularXLimit.limit, x);
var yRot = Mathf.Lerp(-joint.angularYLimit.limit, joint.angularYLimit.limit, y);
var zRot = Mathf.Lerp(-joint.angularZLimit.limit, joint.angularZLimit.limit, z);
@ -60,6 +60,7 @@ using UnityEngine;
currentZNormalizedRot = Mathf.InverseLerp(-joint.angularZLimit.limit, joint.angularZLimit.limit, 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);
}
@ -82,7 +83,6 @@ using UnityEngine;
[Header("Joint Drive Settings")]
[Space(10)]
public float maxJointSpring;
public float jointDampen;
public float maxJointForceLimit;
@ -148,5 +148,5 @@ using UnityEngine;
}
}
}
}
}
}

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004.meta → Assets/8_Scripts/2_General/MarathonMan004.meta

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/AgentMove-outcome.prefab → Assets/8_Scripts/2_General/MarathonMan004/AgentMove-outcome.prefab

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/AgentMove-outcome.prefab.meta → Assets/8_Scripts/2_General/MarathonMan004/AgentMove-outcome.prefab.meta

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/AgentMove-source.prefab → Assets/8_Scripts/2_General/MarathonMan004/AgentMove-source.prefab

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/AgentMove-source.prefab.meta → Assets/8_Scripts/2_General/MarathonMan004/AgentMove-source.prefab.meta

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/BlueJoints.mat → Assets/8_Scripts/2_General/MarathonMan004/BlueJoints.mat

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/BlueJoints.mat.meta → Assets/8_Scripts/2_General/MarathonMan004/BlueJoints.mat.meta

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/BlueSurface.mat → Assets/8_Scripts/2_General/MarathonMan004/BlueSurface.mat

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/BlueSurface.mat.meta → Assets/8_Scripts/2_General/MarathonMan004/BlueSurface.mat.meta

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/Idle.fbx → Assets/8_Scripts/2_General/MarathonMan004/Idle.fbx

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/Idle.fbx.meta → Assets/8_Scripts/2_General/MarathonMan004/Idle.fbx.meta

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/MarathonMan004.prefab → Assets/8_Scripts/2_General/MarathonMan004/MarathonMan004.prefab

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/MarathonMan004.prefab.meta → Assets/8_Scripts/2_General/MarathonMan004/MarathonMan004.prefab.meta

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/RedJoints.mat → Assets/8_Scripts/2_General/MarathonMan004/RedJoints.mat

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/RedJoints.mat.meta → Assets/8_Scripts/2_General/MarathonMan004/RedJoints.mat.meta

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/RedSurface.mat → Assets/8_Scripts/2_General/MarathonMan004/RedSurface.mat

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/RedSurface.mat.meta → Assets/8_Scripts/2_General/MarathonMan004/RedSurface.mat.meta

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/T-Pose.fbx → Assets/8_Scripts/2_General/MarathonMan004/T-Pose.fbx

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/T-Pose.fbx.meta → Assets/8_Scripts/2_General/MarathonMan004/T-Pose.fbx.meta

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/TargetDebug.mat → Assets/8_Scripts/2_General/MarathonMan004/TargetDebug.mat

0
Assets/3_MarathonEnvs/Agents/Characters/MarathonMan004/TargetDebug.mat.meta → Assets/8_Scripts/2_General/MarathonMan004/TargetDebug.mat.meta

32
Assets/9_Models/Humanoid/SMPLX/SMPLXcfj.prefab

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

3110
Assets/9_Models/Humanoid/SMPLX/SMPLXcfjActuations.prefab

File diff suppressed because it is too large

7
Assets/9_Models/Humanoid/SMPLX/SMPLXcfjActuations.prefab.meta

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

2
Assets/ML-Agents/Timers/DreconDemo_timers.json

@ -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"}}
Loading…
Cancel
Save