/// <summary>
    /// Handles the procedures performed when analysing results.
    /// </summary>
    public override void HandleResultAnalysis()
    {
        // Do some analysis
        //Debug.Log("J = " + J);
        string iterationResults = iterationNumber + "," + targetOrder[iterationNumber - 1] + "," + poseListManager.GetPoseName(targetOrder[iterationNumber - 1]) + "," + doneTime.ToString();

        // Log results
        performanceDataLogger.AppendData(iterationResults);
        performanceDataLogger.SaveLog();
    }
Exemplo n.º 2
0
    /// <summary>
    /// Handles the procedures performed when analysing results.
    /// </summary>
    public override void HandleResultAnalysis()
    {
        if (!debug)
        {
            // Performance evaluation
            if (evaluatorType == EvaluatorType.Compensation)
            {
                evaluator.AddData <Vector3>(shDataBuffer, UpperBodyCompensationMotionPM.SHOULDER);
                evaluator.AddData <Vector3>(c7DataBuffer, UpperBodyCompensationMotionPM.TRUNK);
            }
            else if (evaluatorType == EvaluatorType.KinematicEnergy)
            {
                throw new System.NotImplementedException("KE method not yet implemented.");
            }
            float J = evaluator.Update();

            //Debug.Log("J = " + J);
            string iterationResults = iterationNumber + "," +
                                      J;

            // If it's able-bodied, no need to do anything
            // If it's KE-Adaptive-Synergy then perform synergy update
            if (experimentType == ExperimentType.TypeTwo && adaptiveSynergy)
            {
                // Perform update
                theta = personaliser.UpdateParameter(J, iterationNumber);
                elbowManager.SetSynergy(theta);
                // Add algorithm states data to log
                foreach (float value in personaliser.GetStates())
                {
                    iterationResults += "," + value;
                }

                iterationResults += "," + theta;
            }
            Vector3 ballPos = gridManager.GetSelectedBallPosition();
            iterationResults += "," + targetOrder[iterationNumber - 1] + "," + ballPos.x + "," + ballPos.y + "," + ballPos.z;
            //Debug.Log("Theta: " + theta);

            // Log results
            performanceDataLogger.AppendData(iterationResults);
            performanceDataLogger.SaveLog();
        }
    }