浏览代码

normalize

/asymm-envs
Andrew Cohen 5 年前
当前提交
9005ad3e
共有 1 个文件被更改,包括 29 次插入14 次删除
  1. 43
      Project/Assets/ML-Agents/Examples/Tennis/Scripts/TennisAgent.cs

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


public override void CollectObservations(VectorSensor sensor)
{
sensor.AddObservation(m_InvertMult * (transform.position.x - myArea.transform.position.x) / -25f);
sensor.AddObservation((transform.position.y - myArea.transform.position.y) / -7f);
sensor.AddObservation(m_InvertMult * m_AgentRb.velocity.x / 20f);
sensor.AddObservation(m_AgentRb.velocity.y / 20f);
//sensor.AddObservation(m_InvertMult * (transform.position.x - myArea.transform.position.x) / -25f);
//sensor.AddObservation((transform.position.y - myArea.transform.position.y) / -7f);
//sensor.AddObservation(m_InvertMult * m_AgentRb.velocity.x / 20f);
//sensor.AddObservation(m_AgentRb.velocity.y / 20f);
//sensor.AddObservation(m_InvertMult * (ball.transform.position.x - myArea.transform.position.x) / 25f);
//sensor.AddObservation((ball.transform.position.y - myArea.transform.position.y) / 20f);
//sensor.AddObservation(m_InvertMult * m_BallRb.velocity.x / 40f);
//sensor.AddObservation(m_BallRb.velocity.y / 60f);
//sensor.AddObservation(m_InvertMult * (opponent.transform.position.x - myArea.transform.position.x) / -25f);
//sensor.AddObservation((opponent.transform.position.y - myArea.transform.position.y) / -7f);
//sensor.AddObservation(m_InvertMult * m_OpponentRb.velocity.x / 20f);
//sensor.AddObservation(m_OpponentRb.velocity.y / 20f);
sensor.AddObservation(m_InvertMult * (transform.position.x - myArea.transform.position.x));
sensor.AddObservation(transform.position.y - myArea.transform.position.y);
sensor.AddObservation(m_InvertMult * m_AgentRb.velocity.x);
sensor.AddObservation(m_AgentRb.velocity.y);
sensor.AddObservation(m_InvertMult * (ball.transform.position.x - myArea.transform.position.x) / 25f);
sensor.AddObservation((ball.transform.position.y - myArea.transform.position.y) / 20f);
sensor.AddObservation(m_InvertMult * m_BallRb.velocity.x / 40f);
sensor.AddObservation(m_BallRb.velocity.y / 60f);
sensor.AddObservation(m_InvertMult * (ball.transform.position.x - myArea.transform.position.x));
sensor.AddObservation(ball.transform.position.y - myArea.transform.position.y);
sensor.AddObservation(m_InvertMult * m_BallRb.velocity.x);
sensor.AddObservation(m_BallRb.velocity.y);
sensor.AddObservation(m_InvertMult * (opponent.transform.position.x - myArea.transform.position.x) / -25f);
sensor.AddObservation((opponent.transform.position.y - myArea.transform.position.y) / -7f);
sensor.AddObservation(m_InvertMult * m_OpponentRb.velocity.x / 20f);
sensor.AddObservation(m_OpponentRb.velocity.y / 20f);
sensor.AddObservation(m_InvertMult * (opponent.transform.position.x - myArea.transform.position.x));
sensor.AddObservation(opponent.transform.position.y - myArea.transform.position.y);
sensor.AddObservation(m_InvertMult * m_OpponentRb.velocity.x);
sensor.AddObservation(m_OpponentRb.velocity.y);
//sensor.AddObservation(m_InvertMult * gameObject.transform.rotation.z);
sensor.AddObservation((m_InvertMult * (gameObject.transform.rotation.eulerAngles.z - (1f - m_InvertMult) * 180f) - 35f) / 125f);
sensor.AddObservation(m_InvertMult * gameObject.transform.rotation.z);
//sensor.AddObservation((m_InvertMult * (gameObject.transform.rotation.eulerAngles.z - (1f - m_InvertMult) * 180f) - 35f) / 125f);
sensor.AddObservation(System.Convert.ToInt32(m_BallScript.lastFloorHit == HitWall.FloorHit.FloorHitUnset));
}

正在加载...
取消
保存