浏览代码

working. about to try com

/docs-update
Hunter-Unity 5 年前
当前提交
8a74e6f0
共有 3 个文件被更改,包括 1009 次插入26 次删除
  1. 10
      Project/Assets/ML-Agents/Examples/Walker/Prefabs/WalkerPairDynamic.prefab
  2. 968
      Project/Assets/ML-Agents/Examples/Walker/Scenes/WalkerDynamic.unity
  3. 57
      Project/Assets/ML-Agents/Examples/Walker/Scripts/WalkerAgentDynamic.cs

10
Project/Assets/ML-Agents/Examples/Walker/Prefabs/WalkerPairDynamic.prefab


m_Script: {fileID: 11500000, guid: 1b29724baddfa457da6eeab446fa49ca, type: 3}
m_Name:
m_EditorClassIdentifier:
maxJointSpring: 10000
jointDampen: 50
maxJointForceLimit: 25000
maxJointSpring: 40000
jointDampen: 3000
maxJointForceLimit: 10000
bodyPartsList: []
--- !u!114 &8913670488868299308
MonoBehaviour:

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8913670488868299297}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 35bd0d2facf4149ad86cde561dcedd64, type: 3}
m_Name:

showInverseTransformPointRelToBody: 0
showInverseTransformVectorRelToBody: 0
showInverseTransformDirRelToBody: 0
body_T: {fileID: 0}
body_T: {fileID: 8913670488009607195}
--- !u!1 &8913670488904676214
GameObject:
m_ObjectHideFlags: 0

968
Project/Assets/ML-Agents/Examples/Walker/Scenes/WalkerDynamic.unity
文件差异内容过多而无法显示
查看文件

57
Project/Assets/ML-Agents/Examples/Walker/Scripts/WalkerAgentDynamic.cs


// sensor.AddObservation(rb.angularVelocity);
// var localPosRelToHips = hips.InverseTransformPoint(rb.position);
// sensor.AddObservation(localPosRelToHips);
sensor.AddObservation(hips.InverseTransformPointUnscaled(bp.rb.position));
sensor.AddObservation(m_OrientationCube.transform.InverseTransformPointUnscaled(bp.rb.position));
// sensor.AddObservation(hips.InverseTransformPointUnscaled(bp.rb.position));
// if (bp.rb.transform != hips && bp.rb.transform != handL && bp.rb.transform != handR &&

/// </summary>
public override void CollectObservations(VectorSensor sensor)
{
m_JdController.GetCurrentJointForces();
// m_JdController.GetCurrentJointForces();
// Update pos to target
// m_WalkDir = target.position - hips.position;

{
CollectObservationBodyPart(bodyPart, sensor);
}
// Set reward for this step according to mixture of the following elements.
// a. Velocity alignment with goal direction.
// b. Rotation alignment with goal direction.
// c. Encourage head height.
// d. Discourage head movement.
m_WalkDir = target.position - m_OrientationCube.transform.position;
AddReward(
+0.03f * Vector3.Dot(m_WalkDir.normalized, m_JdController.bodyPartsDict[hips].rb.velocity)
+ 0.01f * Quaternion.Dot(m_OrientationCube.transform.rotation, hips.rotation)
+ 0.02f * (head.position.y - hips.position.y)
- 0.01f * Vector3.Distance(m_JdController.bodyPartsDict[head].rb.velocity,
m_JdController.bodyPartsDict[hips].rb.velocity)
);
}
public override void OnActionReceived(float[] vectorAction)

bpDict[forearmR].SetJointStrength(vectorAction[++i]);
}
void FixedUpdate()
{
// Set reward for this step according to mixture of the following elements.
// a. Velocity alignment with goal direction.
// b. Rotation alignment with goal direction.
// c. Encourage head height.
// d. Discourage head movement.
m_WalkDir = target.position - m_OrientationCube.transform.position;
AddReward(
+0.03f * Vector3.Dot(m_WalkDir.normalized, m_JdController.bodyPartsDict[hips].rb.velocity)
+ 0.01f * Quaternion.Dot(m_OrientationCube.transform.rotation, hips.rotation)
+ 0.02f * (head.position.y - hips.position.y)
- 0.01f * Vector3.Distance(m_JdController.bodyPartsDict[head].rb.velocity,
m_JdController.bodyPartsDict[hips].rb.velocity)
);
// m_WalkDir = target.position - m_JdController.bodyPartsDict[hips].rb.position;
// void FixedUpdate()
// {
// // Set reward for this step according to mixture of the following elements.
// // a. Velocity alignment with goal direction.
// // b. Rotation alignment with goal direction.
// // c. Encourage head height.
// // d. Discourage head movement.
// m_WalkDir = target.position - m_OrientationCube.transform.position;
// + 0.01f * Vector3.Dot(m_WalkDir.normalized, hips.forward)
// + 0.01f * Quaternion.Dot(m_OrientationCube.transform.rotation, hips.rotation)
}
//
//// m_WalkDir = target.position - m_JdController.bodyPartsDict[hips].rb.position;
//// AddReward(
//// +0.03f * Vector3.Dot(m_WalkDir.normalized, m_JdController.bodyPartsDict[hips].rb.velocity)
//// + 0.01f * Vector3.Dot(m_WalkDir.normalized, hips.forward)
//// + 0.02f * (head.position.y - hips.position.y)
//// - 0.01f * Vector3.Distance(m_JdController.bodyPartsDict[head].rb.velocity,
//// m_JdController.bodyPartsDict[hips].rb.velocity)
//// );
// }
/// <summary>
/// Loop over body parts and reset them to initial conditions.

正在加载...
取消
保存