Example #1
0
    public override void CollectObservations()
    {
        // Vector observations are our input vector
        // So first so the inptut vector is in the form <servo 0 position, servo 1 position, servo 2 position, servo 3 position, target x offset, target y offset>
        // All components of the input vector are normalized between -1 and 1

        float[] obs = new float[6];
        int     i   = 0;

        for (; i < Lamp.NumberOfServos; ++i)
        {
            obs[i] = lamp.GetServo(i).NormalizedOffset;
            AddVectorObs(lamp.GetServo(i).NormalizedOffset);
        }

        obs[i++] = currentTargetViewportPosition.x;
        obs[i]   = currentTargetViewportPosition.y;
        AddVectorObs(currentTargetViewportPosition.x);
        AddVectorObs(currentTargetViewportPosition.y);

        print("Observations: " + obs.AsString());
        /// TODO: Write Observations to file
    }