浏览代码

try 15k strength. reset jdcontroller to master

/active-variablespeed
HH 4 年前
当前提交
292e8743
共有 12 个文件被更改,包括 3083 次插入70 次删除
  1. 57
      Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/JointDriveController.cs
  2. 40
      Project/Assets/ML-Agents/Examples/Walker/Prefabs/Ragdoll/WalkerRagdollBase.prefab
  3. 6
      Project/Assets/ML-Agents/Examples/Walker/Scenes/WalkerDynamicVariableSpeed.unity
  4. 6
      Project/Assets/ML-Agents/Examples/Walker/Scenes/WalkerStatic.unity
  5. 8
      Project/Assets/ML-Agents/Examples/Walker/TFModels/with hh.meta
  6. 1001
      Project/Assets/ML-Agents/Examples/Walker/TFModels/with hh/WalkerDynamic.nn
  7. 11
      Project/Assets/ML-Agents/Examples/Walker/TFModels/with hh/WalkerDynamic.nn.meta
  8. 1001
      Project/Assets/ML-Agents/Examples/Walker/TFModels/with hh/WalkerDynamicVariableSpeed.nn
  9. 11
      Project/Assets/ML-Agents/Examples/Walker/TFModels/with hh/WalkerDynamicVariableSpeed.nn.meta
  10. 1001
      Project/Assets/ML-Agents/Examples/Walker/TFModels/with hh/WalkerStatic.nn
  11. 11
      Project/Assets/ML-Agents/Examples/Walker/TFModels/with hh/WalkerStatic.nn.meta

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


/// </summary>
public void SetJointTargetRotation(float x, float y, float z)
{
if (float.IsNaN(x) || float.IsNaN(y) || float.IsNaN(z))
{
joint.targetRotation = Quaternion.identity;
Debug.LogError($"Joint_NaN on {rb.name}: x:{x}, y:{y}, z:{z}, FrameCount:{Time.frameCount}");
return;
}
// else
// {
// Debug.Log($"Action on {rb.name}: x:{x}, y:{y}, z:{z}, FrameCount:{Time.frameCount}");
//
// }
// currentXNormalizedRot =
// Mathf.InverseLerp(joint.lowAngularXLimit.limit, joint.highAngularXLimit.limit, xRot);
// currentYNormalizedRot = Mathf.InverseLerp(-joint.angularYLimit.limit, joint.angularYLimit.limit, yRot);
// currentZNormalizedRot = Mathf.InverseLerp(-joint.angularZLimit.limit, joint.angularZLimit.limit, zRot);
currentXNormalizedRot =
Mathf.InverseLerp(joint.lowAngularXLimit.limit, joint.highAngularXLimit.limit, xRot);
currentYNormalizedRot = Mathf.InverseLerp(-joint.angularYLimit.limit, joint.angularYLimit.limit, yRot);
currentZNormalizedRot = Mathf.InverseLerp(-joint.angularZLimit.limit, joint.angularZLimit.limit, zRot);
// currentEularJointRotation = new Vector3(xRot, yRot, zRot);
currentEularJointRotation = new Vector3(xRot, yRot, zRot);
strength = float.IsNaN(strength)? thisJdController.maxJointForceLimit: Mathf.Clamp(strength, -1f, 1f);
// var remappedVal = Mathf.InverseLerp(1, 1, strength);
JointDrive jd = joint.slerpDrive;
jd.positionSpring = thisJdController.maxJointSpring;
jd.positionDamper = thisJdController.jointDampen;
jd.maximumForce = rawVal;
// var jd = new JointDrive
// {
// positionSpring = thisJdController.maxJointSpring,
// positionDamper = thisJdController.jointDampen,
// maximumForce = rawVal
// };
var jd = new JointDrive
{
positionSpring = thisJdController.maxJointSpring,
positionDamper = thisJdController.jointDampen,
maximumForce = rawVal
};
// public void SetJointStrength(float strength)
// {
// var rawVal = (strength + 1f) * 0.5f * thisJdController.maxJointForceLimit;
// var jd = new JointDrive
// {
// positionSpring = thisJdController.maxJointSpring,
// positionDamper = thisJdController.jointDampen,
// maximumForce = rawVal
// };
// joint.slerpDrive = jd;
// currentStrength = jd.maximumForce;
// }
}
public class JointDriveController : MonoBehaviour

public float jointDampen;
[Min(1)]
public List<BodyPart> bodyPartsList = new List<BodyPart>();
// [HideInInspector] public List<BodyPart> bodyPartsList = new List<BodyPart>();
[HideInInspector] public List<BodyPart> bodyPartsList = new List<BodyPart>();
const float k_MaxAngularVelocity = 50.0f;
/// <summary>

40
Project/Assets/ML-Agents/Examples/Walker/Prefabs/Ragdoll/WalkerRagdollBase.prefab


MaxStep: 5000
walkingSpeed: 15
randomizeWalkSpeedEachEpisode: 1
walkDirectionMethod: 0
worldDirToWalk: {x: 1, y: 0, z: 0}
target: {fileID: 0}
hips: {fileID: 895268871264836332}
chest: {fileID: 7933235354845945071}

armR: {fileID: 7933235355057813930}
forearmR: {fileID: 7933235353195701980}
handR: {fileID: 7933235354616748502}
orientationCube: {fileID: 7559180363928843817}
rewardManager: {fileID: 5891315090006581283}
--- !u!114 &895268871377934303
MonoBehaviour:

m_EditorClassIdentifier:
maxJointSpring: 40000
jointDampen: 5000
maxJointForceLimit: 20000
maxJointForceLimit: 15000
bodyPartsList: []
--- !u!114 &895268871377934302
MonoBehaviour:

m_Script: {fileID: 11500000, guid: 1513f8a85fedd47efba089213b7c5bde, type: 3}
m_Name:
m_EditorClassIdentifier:
updateViaScript: 0
transformToFollow: {fileID: 895268871264836332}
targetToLookAt: {fileID: 0}
heightOffset: 0

m_Anchor: {x: 0.55, y: 0, z: 0}
m_Axis: {x: 0, y: -1, z: 0}
m_AutoConfigureConnectedAnchor: 1
m_ConnectedAnchor: {x: -0.7000001, y: 0.00000023841858, z: 0}
m_ConnectedAnchor: {x: -0.7000001, y: 0.00000011920929, z: 0}
serializedVersion: 2
m_SecondaryAxis: {x: 0, y: 0, z: 1}
m_XMotion: 0

m_Anchor: {x: 0, y: 0, z: 0}
m_Axis: {x: 1, y: 0, z: 0}
m_AutoConfigureConnectedAnchor: 1
m_ConnectedAnchor: {x: -0.70000017, y: 0.00000023841858, z: 0}
m_ConnectedAnchor: {x: -0.70000017, y: 0.00000011920929, z: 0}
serializedVersion: 2
m_SecondaryAxis: {x: 0, y: 0, z: 1}
m_XMotion: 0

m_Anchor: {x: -0.5, y: 0, z: 0}
m_Axis: {x: 0, y: 1, z: 0}
m_AutoConfigureConnectedAnchor: 1
m_ConnectedAnchor: {x: 0.5, y: 0.00000023841858, z: 0}
m_ConnectedAnchor: {x: 0.5, y: 0.00000011920929, z: 0}
serializedVersion: 2
m_SecondaryAxis: {x: 0, y: 0, z: 1}
m_XMotion: 0

m_Anchor: {x: 0, y: 0.5, z: 0}
m_Axis: {x: -1, y: 0, z: 0}
m_AutoConfigureConnectedAnchor: 1
m_ConnectedAnchor: {x: -0.39999396, y: -0.29999986, z: 0}
m_ConnectedAnchor: {x: -0.39999396, y: -0.29999995, z: 0}
serializedVersion: 2
m_SecondaryAxis: {x: 0, y: 0, z: -1}
m_XMotion: 0

m_Anchor: {x: 0.5, y: 0, z: 0}
m_Axis: {x: 0, y: -1, z: 0}
m_AutoConfigureConnectedAnchor: 1
m_ConnectedAnchor: {x: -0.5, y: 0.00000023841858, z: 0}
m_ConnectedAnchor: {x: -0.5, y: 0.00000011920929, z: 0}
serializedVersion: 2
m_SecondaryAxis: {x: 0, y: 0, z: 1}
m_XMotion: 0

m_Anchor: {x: 0, y: 0.5, z: 0}
m_Axis: {x: -1, y: 0, z: 0}
m_AutoConfigureConnectedAnchor: 1
m_ConnectedAnchor: {x: 0.39999396, y: -0.29999986, z: 0}
m_ConnectedAnchor: {x: 0.39999396, y: -0.29999995, z: 0}
serializedVersion: 2
m_SecondaryAxis: {x: 0, y: 0, z: -1}
m_XMotion: 0

m_Anchor: {x: 0, y: -0.85, z: 0}
m_Axis: {x: 1, y: 0, z: 0}
m_AutoConfigureConnectedAnchor: 1
m_ConnectedAnchor: {x: 0, y: 0.51199937, z: 0}
m_ConnectedAnchor: {x: 0, y: 0.5119997, z: 0}
serializedVersion: 2
m_SecondaryAxis: {x: 0, y: 0, z: -1}
m_XMotion: 0

m_Anchor: {x: 0, y: 0, z: 0}
m_Axis: {x: 1, y: 0, z: 0}
m_AutoConfigureConnectedAnchor: 1
m_ConnectedAnchor: {x: 0.70000017, y: 0.00000023841858, z: 0}
m_ConnectedAnchor: {x: 0.70000017, y: 0.00000011920929, z: 0}
serializedVersion: 2
m_SecondaryAxis: {x: 0, y: 0, z: 1}
m_XMotion: 0

m_Anchor: {x: 0, y: -0.3, z: 0}
m_Axis: {x: 1, y: 0, z: 0}
m_AutoConfigureConnectedAnchor: 1
m_ConnectedAnchor: {x: 0, y: 0.383, z: 0}
m_ConnectedAnchor: {x: 0, y: 0.3829999, z: 0}
serializedVersion: 2
m_SecondaryAxis: {x: 0, y: 0, z: -1}
m_XMotion: 0

m_Anchor: {x: 0, y: -0.5, z: 0}
m_Axis: {x: 1, y: 0, z: 0}
m_AutoConfigureConnectedAnchor: 1
m_ConnectedAnchor: {x: 0, y: 0.30500054, z: 0}
m_ConnectedAnchor: {x: 0, y: 0.30500042, z: 0}
serializedVersion: 2
m_SecondaryAxis: {x: 0, y: 0, z: -1}
m_XMotion: 0

m_Anchor: {x: -0.55, y: 0, z: 0}
m_Axis: {x: 0, y: 1, z: 0}
m_AutoConfigureConnectedAnchor: 1
m_ConnectedAnchor: {x: 0.7000001, y: 0.00000023841858, z: 0}
m_ConnectedAnchor: {x: 0.7000001, y: 0.00000011920929, z: 0}
serializedVersion: 2
m_SecondaryAxis: {x: 0, y: 0, z: 1}
m_XMotion: 0

type: 3}
m_PrefabInstance: {fileID: 7597605653427724053}
m_PrefabAsset: {fileID: 0}
--- !u!114 &7559180363928843817 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 114705911240010044, guid: 72f745913c5a34df5aaadd5c1f0024cb,
type: 3}
m_PrefabInstance: {fileID: 7597605653427724053}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 771e78c5e980e440e8cd19716b55075f, type: 3}
m_Name:
m_EditorClassIdentifier:

6
Project/Assets/ML-Agents/Examples/Walker/Scenes/WalkerDynamicVariableSpeed.unity


propertyPath: m_Name
value: DynamicPlatforms_10
objectReference: {fileID: 0}
- target: {fileID: 7175173927432230575, guid: 4ee4867f326424260aa2753712f3d643,
type: 3}
propertyPath: m_Model
value:
objectReference: {fileID: 11400000, guid: 46a49bf7975bf4108b48c00fa9babac1,
type: 3}
- target: {fileID: 7964409123409882683, guid: 4ee4867f326424260aa2753712f3d643,
type: 3}
propertyPath: m_ConnectedAnchor.y

6
Project/Assets/ML-Agents/Examples/Walker/Scenes/WalkerStatic.unity


propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8228205183255162979, guid: c319a0a1c387d420a92f520b38ef875b,
type: 3}
propertyPath: m_Model
value:
objectReference: {fileID: 11400000, guid: 0db52f1a95b6e47979379f732882a9a7,
type: 3}
- target: {fileID: 8228205183255163001, guid: c319a0a1c387d420a92f520b38ef875b,
type: 3}
propertyPath: m_Name

8
Project/Assets/ML-Agents/Examples/Walker/TFModels/with hh.meta


fileFormatVersion: 2
guid: ee9fbb0156ff64d169b17780a398702a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

1001
Project/Assets/ML-Agents/Examples/Walker/TFModels/with hh/WalkerDynamic.nn
文件差异内容过多而无法显示
查看文件

11
Project/Assets/ML-Agents/Examples/Walker/TFModels/with hh/WalkerDynamic.nn.meta


fileFormatVersion: 2
guid: 9b7cc1e571a8d4644a5e59c0efe5767e
ScriptedImporter:
fileIDToRecycleName:
11400000: main obj
11400002: model data
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 19ed1486aa27d4903b34839f37b8f69f, type: 3}

1001
Project/Assets/ML-Agents/Examples/Walker/TFModels/with hh/WalkerDynamicVariableSpeed.nn
文件差异内容过多而无法显示
查看文件

11
Project/Assets/ML-Agents/Examples/Walker/TFModels/with hh/WalkerDynamicVariableSpeed.nn.meta


fileFormatVersion: 2
guid: 46a49bf7975bf4108b48c00fa9babac1
ScriptedImporter:
fileIDToRecycleName:
11400000: main obj
11400002: model data
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 19ed1486aa27d4903b34839f37b8f69f, type: 3}

1001
Project/Assets/ML-Agents/Examples/Walker/TFModels/with hh/WalkerStatic.nn
文件差异内容过多而无法显示
查看文件

11
Project/Assets/ML-Agents/Examples/Walker/TFModels/with hh/WalkerStatic.nn.meta


fileFormatVersion: 2
guid: 0db52f1a95b6e47979379f732882a9a7
ScriptedImporter:
fileIDToRecycleName:
11400000: main obj
11400002: model data
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 19ed1486aa27d4903b34839f37b8f69f, type: 3}
正在加载...
取消
保存