Exemple #1
0
    public override void CollectObservations()
    {
        float[] toSend              = new float[19];
        float[] acceleration        = accelerometer.GetAcceleration();
        float[] angularAcceleration = accelerometer.GetAngularAcceleration();
        float[] rotation            = accelerometer.GetRotation();
        // acceleration data
        int toSendCell = 0;

        acceleration.CopyTo(toSend, toSendCell);
        // angular acceleration data
        toSendCell += acceleration.Length;
        angularAcceleration.CopyTo(toSend, toSendCell);
        // rotation data
        toSendCell += angularAcceleration.Length;
        rotation.CopyTo(toSend, toSendCell);
        // depth data
        toSendCell        += rotation.Length;
        toSend[toSendCell] = depthSensor.GetDepth();
        // bounding box
        toSendCell += 1;
        if (dataCollection && positiveExamples)
        {
            annotations.GetBoundingBox().CopyTo(toSend, toSendCell);
        }
        // positive/negative example
        toSendCell += 4;
        if (positiveExamples)
        {
            toSend[toSendCell] = 1.0f;
        }
        else
        {
            toSend[toSendCell] = 0.0f;
        }
        // relative position data
        if (sendRelativeData)
        {
            toSend[toSendCell + 1] = pos.x;
            toSend[toSendCell + 2] = pos.y;
            toSend[toSendCell + 3] = pos.z;
            toSend[toSendCell + 4] = angle;
        }
        AddVectorObs(toSend);
    }