Exemple #1
0
    public override void Heuristic(float[] actionsOut)
    {
        base.Heuristic(actionsOut);
        bool featureNameReady = (featureName.Count != 0);

        var          obs        = GetObservations();
        List <float> sensorData = controller.GetSensorData();

        observation = new List <float>();
        for (int i = 0; i < sensorData.Count; i++)
        {
            observation.Add(sensorData[i]);
            if (!featureNameReady)
            {
                featureName.Add("SD" + i);
            }
        }
        //foreach (var ob in sensorData)
        //{
        //    observation.Add(ob);
        //}
        foreach (var ob in obs)
        {
            print("obs=" + ob);
            observation.Add(ob);
        }
        if (!featureNameReady)
        {
            foreach (string feat in additionalFeatureNames)
            {
                featureName.Add(feat);
            }
            featureName.Add("steer");
            featureName.Add("acceleration");
        }
        //print("Heuristic obs=" + observation.Count);
        print("ROT=" + transform.rotation);
        float xAxis = Input.GetAxis("Horizontal");
        float yAxis = Input.GetAxis("Vertical");

        actionsOut[0]          = xAxis;
        actionsOut[1]          = yAxis;
        horizontalSlider.value = xAxis;
        verticalSlider.value   = yAxis;



        //saveImitationLearningRecords(observation, xAxis, yAxis);
        saveImitationLearningRecordsToCSV(observation, featureName, xAxis, yAxis);
    }