Skip to content

Commit ccca2fb

Browse files
authored
Add Dynamic Walker. Improved Ragdoll Stability/Performance (#4037)
* about to implement orientation cube * oCube spawining works. ready to train * working. about to try com * ready for training * add random rot on episode start * feet now alternate but runs backwards * still running with right leg in front * increased joint strength to 40k * removed texture example * reduced maxAngVel, enabled enhanced determinism, cont spec * rebuilt walker ragdoll to scale 1 * rebuilt ragdoll ready * update walker pair prefab * fixed bp heirarchy * added trained model, renamed scene, usecollisioncallbacks * updated dynamic platforms * added dynamic walker tf file. max speed 5 * DynamicWalker working. has working nn file * collect local rotations * added new dynamic nn file * hip facing reward * Create WalkerDynamic.yaml * fix hip rotation * about to clean up code * added dirIndicator and orentCubeGizmo * clean up * cleanup * updated WalkerStatic scene with new ragdoll * cleanup * updated walker dynamic demo file. cleanup * iterate through list not dict to collect observations * increase gravity to 1.5 * try 100M steps on walkerdynamic * 100M steps * add dir vector obsv * 2e7 steps * testing new nn models * testing bigger batch size * try 8x mem for cloud * 8x batch size for cloud test * epoch 10 * hyptest * cp * increase timescale for cloudtraining * cp * try new cluster * cp * 200k buff cloud * cleanup & put direction indicator in separate script * update configs * about to implement orientation cube * oCube spawining works. ready to train * working. about to try com * ready for training * add random rot on episode start * feet now alternate but runs backwards * still running with right leg in front * increased joint strength to 40k * removed texture example * reduced maxAngVel, enabled enhanced determinism, cont spec * rebuilt walker ragdoll to scale 1 * rebuilt ragdoll ready * update walker pair prefab * fixed bp heirarchy * added trained model, renamed scene, usecollisioncallbacks * updated dynamic platforms * added dynamic walker tf file. max speed 5 * DynamicWalker working. has working nn file * collect local rotations * added new dynamic nn file * hip facing reward * Create WalkerDynamic.yaml * fix hip rotation * about to clean up code * added dirIndicator and orentCubeGizmo * clean up * cleanup * updated WalkerStatic scene with new ragdoll * cleanup * updated walker dynamic demo file. cleanup * iterate through list not dict to collect observations * increase gravity to 1.5 * try 100M steps on walkerdynamic * 100M steps * add dir vector obsv * 2e7 steps * testing new nn models * testing bigger batch size * try 8x mem for cloud * 8x batch size for cloud test * epoch 10 * hyptest * cp * increase timescale for cloudtraining * cp * try new cluster * cp * 200k buff cloud * cleanup & put direction indicator in separate script * update configs * update configs to new class format * added final nn files * more cleanup * new walker image for docs * Update walker docs * remove old gitignore item * cleanup * Delete trainer_config.yaml * Update CHANGELOG.md * remove code comment * changed property to float * rename variable * remove header * rename function * added code comment and consolidated similar properties * removed unused asset * make maxAngularVelocity a constant * cleeanup remove tab * cleanup - remove unneeded header attr * added code comments * auto-format doc to remove unwanted tabs * add new trained model. increase max step for dynamic * add code comments. update oCube system. cleanup * move orientation cube to shared prefabs * refactored reward function variables * removed header * add SAC configs * added new dynamic walker nn file * remove old config * add new config * fix project ver
1 parent 8b54e2e commit ccca2fb

39 files changed

+10475
-4158
lines changed

Project/Assets/ExpertWalkerDyn.demo

1010 KB
Binary file not shown.

Project/Assets/ML-Agents/Examples/Walker/Demos/ExpertWalker.demo.meta renamed to Project/Assets/ExpertWalkerDyn.demo.meta

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 297 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,297 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!1 &2591864625898824423
4+
GameObject:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
serializedVersion: 6
10+
m_Component:
11+
- component: {fileID: 2591864625898824440}
12+
- component: {fileID: 2591864625898824442}
13+
- component: {fileID: 2591864625898824441}
14+
m_Layer: 0
15+
m_Name: Cube
16+
m_TagString: Untagged
17+
m_Icon: {fileID: 0}
18+
m_NavMeshLayer: 0
19+
m_StaticEditorFlags: 0
20+
m_IsActive: 0
21+
--- !u!4 &2591864625898824440
22+
Transform:
23+
m_ObjectHideFlags: 0
24+
m_CorrespondingSourceObject: {fileID: 0}
25+
m_PrefabInstance: {fileID: 0}
26+
m_PrefabAsset: {fileID: 0}
27+
m_GameObject: {fileID: 2591864625898824423}
28+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
29+
m_LocalPosition: {x: 0, y: 0, z: 0}
30+
m_LocalScale: {x: 1, y: 1, z: 1}
31+
m_Children:
32+
- {fileID: 2591864627374185741}
33+
m_Father: {fileID: 2591864627249999504}
34+
m_RootOrder: 0
35+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
36+
--- !u!33 &2591864625898824442
37+
MeshFilter:
38+
m_ObjectHideFlags: 0
39+
m_CorrespondingSourceObject: {fileID: 0}
40+
m_PrefabInstance: {fileID: 0}
41+
m_PrefabAsset: {fileID: 0}
42+
m_GameObject: {fileID: 2591864625898824423}
43+
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
44+
--- !u!23 &2591864625898824441
45+
MeshRenderer:
46+
m_ObjectHideFlags: 0
47+
m_CorrespondingSourceObject: {fileID: 0}
48+
m_PrefabInstance: {fileID: 0}
49+
m_PrefabAsset: {fileID: 0}
50+
m_GameObject: {fileID: 2591864625898824423}
51+
m_Enabled: 1
52+
m_CastShadows: 1
53+
m_ReceiveShadows: 1
54+
m_DynamicOccludee: 1
55+
m_MotionVectors: 1
56+
m_LightProbeUsage: 1
57+
m_ReflectionProbeUsage: 1
58+
m_RenderingLayerMask: 1
59+
m_RendererPriority: 0
60+
m_Materials:
61+
- {fileID: 2100000, guid: 5c59bd36def9a4684be49a21cf201a2d, type: 2}
62+
m_StaticBatchInfo:
63+
firstSubMesh: 0
64+
subMeshCount: 0
65+
m_StaticBatchRoot: {fileID: 0}
66+
m_ProbeAnchor: {fileID: 0}
67+
m_LightProbeVolumeOverride: {fileID: 0}
68+
m_ScaleInLightmap: 1
69+
m_PreserveUVs: 0
70+
m_IgnoreNormalsForChartDetection: 0
71+
m_ImportantGI: 0
72+
m_StitchLightmapSeams: 0
73+
m_SelectedEditorRenderState: 3
74+
m_MinimumChartSize: 4
75+
m_AutoUVMaxDistance: 0.5
76+
m_AutoUVMaxAngle: 89
77+
m_LightmapParameters: {fileID: 0}
78+
m_SortingLayerID: 0
79+
m_SortingLayer: 0
80+
m_SortingOrder: 0
81+
--- !u!1 &2591864627249999519
82+
GameObject:
83+
m_ObjectHideFlags: 0
84+
m_CorrespondingSourceObject: {fileID: 0}
85+
m_PrefabInstance: {fileID: 0}
86+
m_PrefabAsset: {fileID: 0}
87+
serializedVersion: 6
88+
m_Component:
89+
- component: {fileID: 2591864627249999504}
90+
m_Layer: 0
91+
m_Name: OrientationCube
92+
m_TagString: Untagged
93+
m_Icon: {fileID: 0}
94+
m_NavMeshLayer: 0
95+
m_StaticEditorFlags: 0
96+
m_IsActive: 1
97+
--- !u!4 &2591864627249999504
98+
Transform:
99+
m_ObjectHideFlags: 0
100+
m_CorrespondingSourceObject: {fileID: 0}
101+
m_PrefabInstance: {fileID: 0}
102+
m_PrefabAsset: {fileID: 0}
103+
m_GameObject: {fileID: 2591864627249999519}
104+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
105+
m_LocalPosition: {x: -498.349, y: -0.45, z: -250.09256}
106+
m_LocalScale: {x: 1, y: 1, z: 1}
107+
m_Children:
108+
- {fileID: 2591864625898824440}
109+
m_Father: {fileID: 0}
110+
m_RootOrder: 0
111+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
112+
--- !u!1 &2591864627374185740
113+
GameObject:
114+
m_ObjectHideFlags: 0
115+
m_CorrespondingSourceObject: {fileID: 0}
116+
m_PrefabInstance: {fileID: 0}
117+
m_PrefabAsset: {fileID: 0}
118+
serializedVersion: 6
119+
m_Component:
120+
- component: {fileID: 2591864627374185741}
121+
m_Layer: 0
122+
m_Name: Arrow
123+
m_TagString: Untagged
124+
m_Icon: {fileID: 0}
125+
m_NavMeshLayer: 0
126+
m_StaticEditorFlags: 0
127+
m_IsActive: 1
128+
--- !u!4 &2591864627374185741
129+
Transform:
130+
m_ObjectHideFlags: 0
131+
m_CorrespondingSourceObject: {fileID: 0}
132+
m_PrefabInstance: {fileID: 0}
133+
m_PrefabAsset: {fileID: 0}
134+
m_GameObject: {fileID: 2591864627374185740}
135+
m_LocalRotation: {x: -0, y: -0.7071066, z: -0, w: 0.707107}
136+
m_LocalPosition: {x: 0, y: 0.119, z: 0}
137+
m_LocalScale: {x: 0.7764428, y: 0.7764428, z: 0.7764428}
138+
m_Children:
139+
- {fileID: 3256674261123397973}
140+
- {fileID: 3257148088533667597}
141+
m_Father: {fileID: 2591864625898824440}
142+
m_RootOrder: 0
143+
m_LocalEulerAnglesHint: {x: 0, y: -90.00001, z: 0}
144+
--- !u!1 &3258603775602446353
145+
GameObject:
146+
m_ObjectHideFlags: 0
147+
m_CorrespondingSourceObject: {fileID: 0}
148+
m_PrefabInstance: {fileID: 0}
149+
m_PrefabAsset: {fileID: 0}
150+
serializedVersion: 6
151+
m_Component:
152+
- component: {fileID: 3256674261123397973}
153+
- component: {fileID: 3263562959519547143}
154+
- component: {fileID: 3273629389920486807}
155+
m_Layer: 0
156+
m_Name: symbol_tri
157+
m_TagString: Untagged
158+
m_Icon: {fileID: 0}
159+
m_NavMeshLayer: 0
160+
m_StaticEditorFlags: 0
161+
m_IsActive: 1
162+
--- !u!4 &3256674261123397973
163+
Transform:
164+
m_ObjectHideFlags: 0
165+
m_CorrespondingSourceObject: {fileID: 0}
166+
m_PrefabInstance: {fileID: 0}
167+
m_PrefabAsset: {fileID: 0}
168+
m_GameObject: {fileID: 3258603775602446353}
169+
m_LocalRotation: {x: -0.5000024, y: -0.49999765, z: 0.4999684, w: -0.5000316}
170+
m_LocalPosition: {x: 0.22598267, y: 0.5, z: 0}
171+
m_LocalScale: {x: 0.39859864, y: 0.4054339, z: 0.25}
172+
m_Children: []
173+
m_Father: {fileID: 2591864627374185741}
174+
m_RootOrder: 0
175+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
176+
--- !u!33 &3263562959519547143
177+
MeshFilter:
178+
m_ObjectHideFlags: 0
179+
m_CorrespondingSourceObject: {fileID: 0}
180+
m_PrefabInstance: {fileID: 0}
181+
m_PrefabAsset: {fileID: 0}
182+
m_GameObject: {fileID: 3258603775602446353}
183+
m_Mesh: {fileID: 4300000, guid: 09e2da39770c24cc9a71e5dbf05a1e85, type: 3}
184+
--- !u!23 &3273629389920486807
185+
MeshRenderer:
186+
m_ObjectHideFlags: 0
187+
m_CorrespondingSourceObject: {fileID: 0}
188+
m_PrefabInstance: {fileID: 0}
189+
m_PrefabAsset: {fileID: 0}
190+
m_GameObject: {fileID: 3258603775602446353}
191+
m_Enabled: 1
192+
m_CastShadows: 1
193+
m_ReceiveShadows: 1
194+
m_DynamicOccludee: 1
195+
m_MotionVectors: 1
196+
m_LightProbeUsage: 1
197+
m_ReflectionProbeUsage: 1
198+
m_RenderingLayerMask: 1
199+
m_RendererPriority: 0
200+
m_Materials:
201+
- {fileID: 2100000, guid: 69fefdd39d2b34b169e921910bed9c0d, type: 2}
202+
m_StaticBatchInfo:
203+
firstSubMesh: 0
204+
subMeshCount: 0
205+
m_StaticBatchRoot: {fileID: 0}
206+
m_ProbeAnchor: {fileID: 0}
207+
m_LightProbeVolumeOverride: {fileID: 0}
208+
m_ScaleInLightmap: 1
209+
m_PreserveUVs: 0
210+
m_IgnoreNormalsForChartDetection: 0
211+
m_ImportantGI: 0
212+
m_StitchLightmapSeams: 0
213+
m_SelectedEditorRenderState: 3
214+
m_MinimumChartSize: 4
215+
m_AutoUVMaxDistance: 0.5
216+
m_AutoUVMaxAngle: 89
217+
m_LightmapParameters: {fileID: 0}
218+
m_SortingLayerID: 0
219+
m_SortingLayer: 0
220+
m_SortingOrder: 0
221+
--- !u!1 &3259145720179606813
222+
GameObject:
223+
m_ObjectHideFlags: 0
224+
m_CorrespondingSourceObject: {fileID: 0}
225+
m_PrefabInstance: {fileID: 0}
226+
m_PrefabAsset: {fileID: 0}
227+
serializedVersion: 6
228+
m_Component:
229+
- component: {fileID: 3257148088533667597}
230+
- component: {fileID: 3263743565359806181}
231+
- component: {fileID: 3272323263339836425}
232+
m_Layer: 0
233+
m_Name: Symbol_Triangle
234+
m_TagString: Untagged
235+
m_Icon: {fileID: 0}
236+
m_NavMeshLayer: 0
237+
m_StaticEditorFlags: 0
238+
m_IsActive: 1
239+
--- !u!4 &3257148088533667597
240+
Transform:
241+
m_ObjectHideFlags: 0
242+
m_CorrespondingSourceObject: {fileID: 0}
243+
m_PrefabInstance: {fileID: 0}
244+
m_PrefabAsset: {fileID: 0}
245+
m_GameObject: {fileID: 3259145720179606813}
246+
m_LocalRotation: {x: -0.5000024, y: -0.49999765, z: 0.4999684, w: -0.5000316}
247+
m_LocalPosition: {x: -0.20300293, y: 0.5, z: 0}
248+
m_LocalScale: {x: 0.31112, y: 0.4054339, z: 0.085725}
249+
m_Children: []
250+
m_Father: {fileID: 2591864627374185741}
251+
m_RootOrder: 1
252+
m_LocalEulerAnglesHint: {x: 90.00001, y: 0, z: 270.007}
253+
--- !u!33 &3263743565359806181
254+
MeshFilter:
255+
m_ObjectHideFlags: 0
256+
m_CorrespondingSourceObject: {fileID: 0}
257+
m_PrefabInstance: {fileID: 0}
258+
m_PrefabAsset: {fileID: 0}
259+
m_GameObject: {fileID: 3259145720179606813}
260+
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
261+
--- !u!23 &3272323263339836425
262+
MeshRenderer:
263+
m_ObjectHideFlags: 0
264+
m_CorrespondingSourceObject: {fileID: 0}
265+
m_PrefabInstance: {fileID: 0}
266+
m_PrefabAsset: {fileID: 0}
267+
m_GameObject: {fileID: 3259145720179606813}
268+
m_Enabled: 1
269+
m_CastShadows: 1
270+
m_ReceiveShadows: 1
271+
m_DynamicOccludee: 1
272+
m_MotionVectors: 1
273+
m_LightProbeUsage: 1
274+
m_ReflectionProbeUsage: 1
275+
m_RenderingLayerMask: 1
276+
m_RendererPriority: 0
277+
m_Materials:
278+
- {fileID: 2100000, guid: 69fefdd39d2b34b169e921910bed9c0d, type: 2}
279+
m_StaticBatchInfo:
280+
firstSubMesh: 0
281+
subMeshCount: 0
282+
m_StaticBatchRoot: {fileID: 0}
283+
m_ProbeAnchor: {fileID: 0}
284+
m_LightProbeVolumeOverride: {fileID: 0}
285+
m_ScaleInLightmap: 1
286+
m_PreserveUVs: 1
287+
m_IgnoreNormalsForChartDetection: 0
288+
m_ImportantGI: 0
289+
m_StitchLightmapSeams: 0
290+
m_SelectedEditorRenderState: 3
291+
m_MinimumChartSize: 4
292+
m_AutoUVMaxDistance: 0.5
293+
m_AutoUVMaxAngle: 89
294+
m_LightmapParameters: {fileID: 0}
295+
m_SortingLayerID: 0
296+
m_SortingLayer: 0
297+
m_SortingOrder: 0

Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/OrientationCube.prefab.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
namespace Unity.MLAgentsExamples
6+
{
7+
public class DirectionIndicator : MonoBehaviour
8+
{
9+
public Transform transformToFollow; //ex: hips or body
10+
public Transform targetToLookAt; //target in the scene the indicator will point to
11+
public float heightOffset;
12+
private float m_StartingYPos;
13+
14+
void OnEnable()
15+
{
16+
m_StartingYPos = transform.position.y;
17+
}
18+
19+
void Update()
20+
{
21+
transform.position = new Vector3(transformToFollow.position.x, m_StartingYPos + heightOffset, transformToFollow.position.z);
22+
Vector3 walkDir = targetToLookAt.position - transform.position;
23+
walkDir.y = 0; //flatten dir on the y
24+
transform.rotation = Quaternion.LookRotation(walkDir);
25+
}
26+
}
27+
}

Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/DirectionIndicator.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/JointDriveController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public class JointDriveController : MonoBehaviour
109109
[HideInInspector] public Dictionary<Transform, BodyPart> bodyPartsDict = new Dictionary<Transform, BodyPart>();
110110

111111
[HideInInspector] public List<BodyPart> bodyPartsList = new List<BodyPart>();
112+
const float k_MaxAngularVelocity = 50.0f;
112113

113114
/// <summary>
114115
/// Create BodyPart object and add it to dictionary.
@@ -122,7 +123,7 @@ public void SetupBodyPart(Transform t)
122123
startingPos = t.position,
123124
startingRot = t.rotation
124125
};
125-
bp.rb.maxAngularVelocity = 100;
126+
bp.rb.maxAngularVelocity = k_MaxAngularVelocity;
126127

127128
// Add & setup the ground contact script
128129
bp.groundContact = t.GetComponent<GroundContact>();

0 commit comments

Comments
 (0)