浏览代码

cannot hit scenery tennis

/asymm-envs
Andrew Cohen 5 年前
当前提交
0c17dc1b
共有 4 个文件被更改,包括 15 次插入7 次删除
  1. 4
      Project/Assets/ML-Agents/Examples/Tennis/Scenes/Tennis.unity
  2. 6
      Project/Assets/ML-Agents/Examples/Tennis/Scripts/HitWall.cs
  3. 6
      Project/Assets/ML-Agents/Examples/Tennis/Scripts/TennisAgent.cs
  4. 6
      config/ppo/Tennis.yaml

4
Project/Assets/ML-Agents/Examples/Tennis/Scenes/Tennis.unity


propertyPath: m_Name
value: TennisArea (1)
objectReference: {fileID: 0}
- target: {fileID: 1541947554534326, guid: 812997c7bc2544b6f927ff684c03450f, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4172342666475122, guid: 812997c7bc2544b6f927ff684c03450f, type: 3}
propertyPath: m_LocalPosition.x
value: -60

6
Project/Assets/ML-Agents/Examples/Tennis/Scripts/HitWall.cs


void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.CompareTag("iWall"))
if (collision.gameObject.name == "Scenery")
{
Reset();
}
else if (collision.gameObject.CompareTag("iWall"))
{
if (collision.gameObject.name == "wallA")
{

6
Project/Assets/ML-Agents/Examples/Tennis/Scripts/TennisAgent.cs


Quaternion deltaRotation = Quaternion.Euler(zAxis * rotateZ);
m_AgentRb.MoveRotation(m_AgentRb.rotation * deltaRotation);
if (invertX && transform.position.x - transform.parent.transform.position.x < -m_InvertMult * 5f ||
!invertX && transform.position.x - transform.parent.transform.position.x > -m_InvertMult * 5f)
if (invertX && transform.position.x - transform.parent.transform.position.x < -m_InvertMult * 3f ||
!invertX && transform.position.x - transform.parent.transform.position.x > -m_InvertMult * 3f)
transform.position = new Vector3(-m_InvertMult * 5f + transform.parent.transform.position.x,
transform.position = new Vector3(-m_InvertMult * 3f + transform.parent.transform.position.x,
transform.position.y,
transform.position.z);
}

6
config/ppo/Tennis.yaml


behaviors:
Tennis:
trainer: ppo
batch_size: 4096
buffer_size: 40960
batch_size: 2048
buffer_size: 20480
beta: 0.02
epsilon: 0.2
hidden_units: 512

gamma: 0.995
self_play:
window: 10
play_against_latest_model_ratio: 0.0
play_against_latest_model_ratio: 0.5
save_steps: 100000
swap_steps: 2000
team_change: 200000
正在加载...
取消
保存