/// <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();
    }
Ejemplo 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();
        }
    }
Ejemplo n.º 3
0
    private void FixedUpdate()
    {
        //
        // Tasks performed determinalistically throughout the experiment
        // E.g. data gathering.
        //
        switch (experimentState)
        {
        case ExperimentState.PerformingTask:
            //
            // Gather data while experiment is in progress
            //
            string logData = guideManager.CurrentAngle.ToString();
            logData += "," + taskTime.ToString();
            // Read from all user sensors
            foreach (ISensor sensor in AvatarSystem.GetActiveSensors())
            {
                float[] sensorData = sensor.GetAllRawData();
                foreach (float element in sensorData)
                {
                    logData += "," + element.ToString();
                }
            }
            // Read from all experiment sensors
            foreach (ISensor sensor in ExperimentSystem.GetActiveSensors())
            {
                float[] sensorData = sensor.GetAllProcessedData();
                foreach (float element in sensorData)
                {
                    logData += "," + element.ToString();
                }
            }

            //
            // Update data and append
            //
            taskTime += Time.fixedDeltaTime;


            //
            // Log current data
            //
            motionLogger.AppendData(logData);

            //
            // Save log and reset flags when successfully compeleted task
            //
            if (IsTaskDone())
            {
                //
                // Perform data management, such as appending data to lists for analysis
                //

                //
                // Save logger for current experiment and change to data analysis
                //
                //ExperimentSystem.GetActiveLogger(1).CloseLog();

                //
                // Clear data management buffers
                //
                experimentState = ExperimentState.AnalizingResults;
                break;
            }

            break;

        default:
            break;
        }
    }