コード例 #1
0
    public override void CollectObservations(VectorSensor sensor)
    {
        //base.CollectObservations(sensor);
        print("CollectObservations");
        //List<float> sensorData = controller.GetSensorData();
        //foreach (float d in sensorData) {
        //sensor.AddObservation(d);
        //print(d);
        //}

        //sensor.AddObservation(rigidbody.velocity);
        //print("rigidbody.velocity=" + rigidbody.velocity);
        bool addtionalFeatureNameReady = (additionalFeatureNames.Count != 0);
        // direction
        Quaternion rot = transform.rotation;

        sensor.AddObservation(rot.y);
        sensor.AddObservation(rot.w);

        // the distance
        float distToDest    = Vector3.Distance(transform.position, destination);
        float progressRatio = distToDest / overallDist;

        sensor.AddObservation(progressRatio);

        // path available
        if (pathInference.pathReady)
        {
            sensor.AddObservation(1.0f);
        }
        else
        {
            sensor.AddObservation(0.0f);
        }


        if (!addtionalFeatureNameReady)
        {
            additionalFeatureNames.Add("RotY");
            additionalFeatureNames.Add("RotW");
            additionalFeatureNames.Add("DistRatio");
            additionalFeatureNames.Add("PathAvailable");
        }


        print("ob size=" + sensor.ObservationSize());
        //print("count=" + ());
    }