Ejemplo n.º 1
0
    // Collect all non-Raycast observations
    public override void CollectObservations(MLAgents.Sensors.VectorSensor sensor)
    {
        // Check item carrying (1 int = 1 value)
        sensor.AddObservation(item);

        // Whether the penguin has eaten a fish (1 bool = 1 value)
        sensor.AddObservation(isFull);

        // Distance to the bin (1 float = 1 value)
        sensor.AddObservation(Vector3.Distance(bin.transform.position, transform.position));

        // Direction to bin (1 Vector3 = 3 values)
        sensor.AddObservation((bin.transform.position - transform.position).normalized);

        // Distance to the baby (1 float = 1 value)
        sensor.AddObservation(Vector3.Distance(baby.transform.position, transform.position));

        // Direction to baby (1 Vector3 = 3 values)
        sensor.AddObservation((baby.transform.position - transform.position).normalized);

        // Direction penguin is facing (1 Vector3 = 3 values)
        sensor.AddObservation(transform.forward);

        // 1 +  1 + 1 + 3 + 1 + 3 + 3 = 13 total values
    }
Ejemplo n.º 2
0
 //주변의 환경정보를 수집
 public override void CollectObservations(MLAgents.Sensors.VectorSensor sensor)
 {
     //Brain 전달할 관측 데이터
     sensor.AddObservation(targetTr.localPosition); //3
     sensor.AddObservation(tr.localPosition);       //3
     sensor.AddObservation(mummyRb.velocity.x);     //1
     sensor.AddObservation(mummyRb.velocity.z);     //1
 }
Ejemplo n.º 3
0
    public override void CollectObservations(MLAgents.Sensors.VectorSensor sensor)
    {
        // Target and Agent positions
        sensor.AddObservation(Target.localPosition);
        sensor.AddObservation(this.transform.localPosition);

        // Agent velocity
        sensor.AddObservation(rBody.velocity.x);
        sensor.AddObservation(rBody.velocity.z);
    }
Ejemplo n.º 4
0
    //관측정보를 수집하고 브레인에 전달하는 역할
    public override void CollectObservations(MLAgents.Sensors.VectorSensor sensor)
    {
        //#1. 관측정보
        //에이전트의 위치와 바닥(중앙)의 위치간의 거리 : 떨어질수록 - 패널티
        Vector3 dist1 = planeTr.localPosition - mummyTr.localPosition;
        float   norX1 = Mathf.Clamp(dist1.x, -1f, +1f);
        float   norZ1 = Mathf.Clamp(dist1.z, -1f, +1f);

        //#2. 관측정보
        Vector3 dist2 = targetTr.localPosition - mummyTr.localPosition;
        float   norX2 = Mathf.Clamp(dist2.x, -1f, +1f);
        float   norZ2 = Mathf.Clamp(dist2.z, -1f, +1f);

        sensor.AddObservation(norX1);
        sensor.AddObservation(norZ1);
        sensor.AddObservation(norX2);
        sensor.AddObservation(norZ2);
    }
Ejemplo n.º 5
0
 public override void CollectObservations(MLAgents.Sensors.VectorSensor sensor)
 {
 }