public void Initialize_Modules(Capture_module capture, Compare_module compare, Animation_module animate,Interaction_module interact, Recorded_animation_module animate_trial)
    {
        _scenario_state = Capture_scene_state.INITIALISATION;

        _capture = capture;
        _compare = compare;
        _animate = animate;
        _interact = interact;

        _animate_trial = animate_trial;
        //Initialise 3D environment

        //Initialise 3D animation

        //Initialise capture module
        _capture.Initialise_capture(_device);
        //Initialise comparison module
        _compare.Initialise_comparison();
        _compare.DrawPlots = false;
        //Initialise database module

        //Initialise GUI module
        //TEMP

        Animation_data temp = new Animation_data();
        temp.Initialize_from_file("test_recorded_data/HB_Underarm_reference");
        _animate_trial.SetRecordedAnimation(temp);

        Animation_data temp_2 = new Animation_data();
        temp_2.Initialize_from_file("test_recorded_data/HB_Underarm_reference_copy");
        _animate_trial.SetReferenceAnimation(temp_2);

        Wait_user();
    }
    public void Initialize_Modules(Capture_module capture, Compare_module compare, Animation_module animate,Interaction_module interact, GUI_module user_interface, Recorded_animation_module animate_trial)
    {
        _coach_scenario_state = Coach_scenario_state.INITIALISATION;

        _capture = capture;
        _compare = compare;
        _animate = animate;
        _interact = interact;
        _user_interface = user_interface;
        _animate_trial = animate_trial;
        //Initialise 3D environment

        //Initialise 3D animation

        //Initialise capture module
        _capture.Initialise_capture(_device);
        //Initialise comparison module

        //Initialise database module

        //Initialise GUI module
        //TEMP
        _coach_scenario_state = Coach_scenario_state.START_SCREEN;
        Animation_data temp = new Animation_data();
        temp.Initialize_from_file("test_recorded_data/HB_Underarm_reference");
        _animate_trial.SetRecordedAnimation(temp);

        Animation_data temp_2 = new Animation_data();
        temp_2.Initialize_from_file("test_recorded_data/HB_Underarm_reference_copy");
        _animate_trial.SetReferenceAnimation(temp_2);

        _user_interface.SetLoginMenuVisibility(true);
    }
    public void Initialize_Modules(Capture_module capture, Compare_module compare, Animation_module animate,Interaction_module interact, GUI_module user_interface, Recorded_animation_module animate_trial)
    {
        _test_state = Test_state.INITIALISATION;

        _capture = capture;
        _compare = compare;
        _animate = animate;
        _interact = interact;
        _user_interface = user_interface;
        _animate_trial = animate_trial;
        //Initialise 3D environment

        //Initialise 3D animation

        //Initialise capture module
        _capture.Initialise_capture(_device);
        //Initialise comparison module

        //Initialise database module

        //Initialise GUI module
        //TEMP
        Animation_data temp = new Animation_data();
        temp.Initialize_from_file("test_recorded_data/HB_Underarm_reference");
        _animate_trial.SetRecordedAnimation(temp);
    }
 IEnumerator Start_recording_debug(float time)
 {
     Debug.Log("Start recording for " + time + " sec");
     _capture.Start_capture();
     yield return new WaitForSeconds(time);
     print("Stop recording");
     latestAnimation = _capture.Stop_capture();
     //_animate_trial.SetRecordedAnim(latestAnimation);
     _animate_trial.GetRecordedAnimationPlayer().SetAnimationData(latestAnimation);
     _animate_trial.PlayAnimation();
 }
 /// <summary>
 /// Start the comparison process for the animation recorded data
 /// using as the reference the specified activity.
 /// </summary>
 /// <param name="recorded_motion">The recorded Animation_data.</param>
 /// <param name="action_name">The activity to compare with.</param>
 public void Compute_comparison(Animation_data recorded_motion, Properties.Activity action_name)
 {
     ActionName = action_name;
     Compute_comparison(recorded_motion);
 }
 /// <summary>
 /// Start the comparison process for the animation recorded data
 /// using the pre-setted or the default activity.
 /// </summary>
 /// <param name="recorded_motion">The recorded Animation_data.</param>
 public void Compute_comparison(Animation_data recorded_motion)
 {
     IHumanoid[] rm;
     Properties.From_animation_data(ref recorded_motion, out rm);
     Compute_comparison(rm);
 }
    IEnumerator Start_recording_debug(float time)
    {
        _avatar_controller.New_record();
        Debug.Log("Start recording for " + _skill_duration + " sec");
        _avatar_controller.Start_recording();
        _capture.Start_capture();
        _user_interface.SetRecordVisibility(true);
        yield return new WaitForSeconds(time);
        print("Stop recording");
        latestAnimation = _capture.Stop_capture();
        List<Quaternion[]> anim_data_from_controller = _avatar_controller.Stop_recording();
        Debug.Log("Received " + anim_data_from_controller.Count + " frames");
        _animate_trial.GetRecordedAnimationPlayer().SetAnimationDataFromController(anim_data_from_controller);
        _capture.Activate_visualization(false);
        _user_interface.SetRecordVisibility(false);

        _compare.Compute_comparison(latestAnimation.Filename);
        //yield return new WaitForSeconds(time);
        //_animate_trial.SetRecordedAnim(latestAnimation);
        //_animate_trial.GetRecordedAnimationPlayer().SetAnimationData(latestAnimation);
        _animate_trial.AvatarVisibilityState(true);
        _animate_trial.PlayAnimation();

        //TODO

        while (!_compare.DoneComparison)
        {
            //wait end of the comparison
            Debug.Log("Wait end of comparison process");
            yield return new WaitForSeconds(0.5f);
        }
        //yield return new WaitForSeconds(1.5f);
        _user_interface.SetComparisonVisibility(true, _compare.OverallScore, _compare.SemanticFeedback.ToString(), _compare.Tips);
        yield return new WaitForSeconds(_skill_duration * 2);
    }
    IEnumerator Start_recording(float time)
    {
        Debug.Log("Start recording for "+_skill_duration+" sec");
        _compare.DoneComparison = false;

        _countdown.text = "Trial "+_current_trials+"/"+_number_of_trials;
        _user_interface.SetRecordVisibility(true);
        yield return new WaitForSeconds(_time_between_scene);

        _countdown.text = "Get Ready";

        yield return new WaitForSeconds(3);
        _countdown.text = "3";

        _countdown.text = "Get Ready";
        yield return new WaitForSeconds(2);
        _countdown.text = "3";
        yield return new WaitForSeconds(1);
        _countdown.text = "2";
        yield return new WaitForSeconds(1);
        _countdown.text = "1";
        yield return new WaitForSeconds(1);
        _capture.Start_capture();
        _avatar_controller.Start_recording();
        _countdown.text = "Recording";
        yield return new WaitForSeconds(time);
        latestAnimation = _capture.Stop_capture();
        List<Quaternion[]> anim_data = _avatar_controller.Stop_recording();
        print("Stop recording");
        _capture.Activate_visualization(false);
        _user_interface.SetRecordVisibility(false);

        _compare.Compute_comparison(latestAnimation.Filename);
        //yield return new WaitForSeconds(time);
        //_animate_trial.SetRecordedAnim(latestAnimation);
        while(!_compare.DoneComparison){
            //wait end of the comparison
            Debug.Log("Wait end of comparison process");
            yield return new WaitForSeconds(0.5f);
        }
        if ((_compare.AreRelated == false) && (_invalid_trial == true))
        {
            _user_interface.SetInvalidTrialVisibility(true);
            yield return new WaitForSeconds(_time_between_scene);
            _user_interface.SetInvalidTrialVisibility(false);
            //StartCoroutine(Start_recording(time));
            Perform_next_trial();
        }else{
        if (_compare.OverallScore > _skills_list[_current_skill]._score)
        {
            _skills_list[_current_skill]._score = _compare.OverallScore;
        }

        _user_interface.SetComparisonVisibility(true, _compare.OverallScore, _compare.SemanticFeedback.ToString(), _compare.Tips, _compare.AreRelated);
        _animate.Look_at_comparison_avatar();
           //_animate_trial.GetRecordedAnimationPlayer().SetAnimationData(latestAnimation);
            _animate_trial.GetRecordedAnimationPlayer().SetAnimationDataFromController(anim_data);
            _animate_trial.AvatarVisibilityState(true);
            _animate_trial.PlayAnimation();
            /*
            _animate_trial.AvatarVisibilityState(true);
            _animate_trial.PlayAnimation();
        */
            _user_interface.SetComparisonVisibility(true, _compare.OverallScore);
            yield return new WaitForSeconds(_skill_duration * 2);

            _user_interface.SetComparisonVisibility(false);
            _animate_trial.AvatarVisibilityState(false);

            Perform_next_trial();
        }
    }
    public void Initialize_Modules(Capture_module capture, Compare_module compare, Animation_module animate, Interaction_module interact, GUI_module_play_and_learn user_interface, Recorded_animation_module animate_trial)
    {
        _play_scenario_state = Play_scenario_state.START_SCREEN;

        _capture = capture;
        _compare = compare;
        _animate = animate;
        _interact = interact;
        _user_interface = user_interface;
        _animate_trial = animate_trial;
        //Initialise 3D environment

        //Initialise 3D animation

        //Initialise capture module
        _capture.Initialise_capture(_device);
        //Initialise comparison module
        _compare.Initialise_comparison();
        _compare.DrawPlots = false;
        //Initialise database module

        //Initialise GUI module
        //TEMP
        _play_scenario_state = Play_scenario_state.MAIN_MENU;
        Animation_data temp = new Animation_data();
        temp.Initialize_from_file("test_recorded_data/HB_Underarm_reference");
        _animate_trial.SetRecordedAnimation(temp);

        Animation_data temp_2 = new Animation_data();
        temp_2.Initialize_from_file("test_recorded_data/HB_Underarm_reference_copy");
        _animate_trial.SetReferenceAnimation(temp_2);

        /*_user_interface.SetLoginMenuVisibility (true);*/
        _user_interface.SetChildMainMenuVisibility(true);
        _user_interface.SetChildLeftPanelVisibility(true);
    }
示例#10
0
 /// <summary>
 /// Converts an Animation_data object to an array of Vcl.Utilities.IHumanoid.
 /// </summary>
 /// <param name="data">The animation data.</param>
 /// <param name="hums">The Vcl.Utilities.IHumanoid array.</param>
 public static void From_animation_data(ref Animation_data data, out IHumanoid[] hums)
 {
     hums = new IHumanoid[data.getLenght()];
     for (int i = 0; i < data.getLenght(); i++)
     {
         hums[i] = From_HBP(data.name, data.GetFrame(i), i);
         hums[i].SetInfo("frameNumber", i.ToString());
         hums[i].SetInfo("timestamp", (i * 30).ToString());
     }
 }
示例#11
0
 /// <summary>
 /// Put the data of the array of Vcl.Utilities.IHumanoid to the Animation_data data and returns it using
 /// the variable new_data.
 /// </summary>
 /// <param name="hums">The array of IHumanoids</param>
 /// <param name="data">The input animation data.</param>
 /// <param name="new_data">The output animation data.</param>
 public static void To_animation_data(ref IHumanoid[] hums, ref Animation_data data, out Animation_data new_data)
 {
     new_data = data;
     new_data.Reset();
     new_data.name = hums[0].Name;
     foreach (var hum in hums)
         new_data.AddFrame(new Kinect2.IO.SkeletonFrame(
             int.Parse(hum.GetInfo("frameNumber")),
             new Kinect2.IO.Skeleton[] { To_HBP(hum) },
             new float[] {0, 0, 0, 0},
             long.Parse(hum.GetInfo("timestamp"))
         ));
 }
 public void SetAnimationDataRef(Animation_data anim)
 {
     _anim = anim;
     motionCounter = 0;
 }
 void Start()
 {
     recordedMotion = new Animation_data();
 }
 public void SetReferenceAnimation(Animation_data reference_motion)
 {
     _reference_animation_player.SetAnimationData(reference_motion);
 }
 public void SetRecordedAnimation(Animation_data recorded_motion)
 {
     _recorded_animation_player.SetAnimationData(recorded_motion);
 }
 public void SetRecordedAnim(Animation_data recorded_motion)
 {
     Debug.Log("2 Anim lenght: " + recorded_motion.getLenght());
     _recorded_animation_player.SetAnimationDataRef(recorded_motion);
 }