浏览代码

Make Crawler head and movement direction different

/goal-conditioning/new/allo-crawler
Arthur Juliani 4 年前
当前提交
45aaaf83
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 8
      Project/Assets/ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs

8
Project/Assets/ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs


//avg body vel relative to cube
sensor.AddObservation(m_OrientationCube.transform.InverseTransformDirection(avgVel));
//vel goal relative to cube
goalSensor.GetSensor().AddObservation(m_OrientationCube.transform.InverseTransformDirection(velGoal));
goalSensor.GetSensor().AddObservation(cubeForward * TargetWalkingSpeed);
sensor.AddObservation(Quaternion.FromToRotation(body.forward, cubeForward));
sensor.AddObservation(Quaternion.FromToRotation(body.forward, Vector3.forward));
goalSensor.GetSensor().AddObservation(m_OrientationCube.transform.InverseTransformPoint(m_Target.transform.position));
goalSensor.GetSensor().AddObservation(Vector3.forward);
RaycastHit hit;
float maxRaycastDist = 10;

// b. Rotation alignment with target direction.
//This reward will approach 1 if it faces the target direction perfectly and approach zero as it deviates
var lookAtTargetReward = (Vector3.Dot(cubeForward, body.forward) + 1) * .5F;
var lookAtTargetReward = (Vector3.Dot(Vector3.forward, body.forward) + 1) * .5F;
AddReward(matchSpeedReward * lookAtTargetReward);
}

正在加载...
取消
保存