/// <summary> /// Starts the reading the buffer of the console output. /// </summary> /// <returns>An enumerator.</returns> IEnumerator StartConsole() { _buffer = new List<string>(); while(!comparexe.HasExited) { yield return new WaitForSeconds(1); lock (_buffer) { while(_buffer.Count > 0) { var line = _buffer[0]; if (string.IsNullOrEmpty(line)) { } if (line.Contains("uid=")) UserID = ulong.Parse(line.Substring(4)); else if (line.Contains("act=")) ActionName = Properties.ActivityFromString(line.Substring(4).ToString()); else if (line.Contains("sfb=")) SemanticFeedback = line.Substring(4); else if (line.Contains("tip=")) Tips = line.Substring(4).Split(new string[] { ":|:" }, System.StringSplitOptions.RemoveEmptyEntries); else if (line.Contains("rel=")) AreRelated = bool.Parse(line.Substring(4)); else if (line.Contains("ovs=")) OverallScore = float.Parse(line.Substring(4), ni) * 100f; else if (line.Contains("pss=")) PositionScore = float.Parse(line.Substring(4), ni) * 100f; else if (line.Contains("rts=")) RotationScore = float.Parse(line.Substring(4), ni) * 100f; else if (line.Contains("lvs=")) LinearVelocityScore = float.Parse(line.Substring(4), ni) * 100f; else if (line.Contains("avs=")) AngularVelocityScore = float.Parse(line.Substring(4), ni) * 100f; else if (line.Contains("plt=")) { var pf = line.Substring(4).Split(new string[] { ":|:" }, System.StringSplitOptions.RemoveEmptyEntries); PlotFiles = pf.Where((str, i) => i % 2 == 1).ToArray(); AvailablePlots = pf.Where ((str, i) => i % 2 == 0).ToArray(); } else if (line.Contains("tjs=")) { var ts = line.Substring(4).Split(new string[] { ":|:" }, System.StringSplitOptions.RemoveEmptyEntries); Trajectories = new SeriesVariable<Vec3f>[ts.Length]; for (int i = 0; i < ts.Length; i++) Trajectories[i] = SeriesVariable<Vec3f>.FromString(ts[i]); } else if (line.Contains("Start")) { CurrentState = State.START; DoneComparison = false; _is_comparing = true; _start_time = UnityEngine.Time.time; Debug.Log("Compare started."); } else if (line.Contains("Compare done!")) { Debug.Log(string.Format("Compare done! Elapsed time: {0}", Time)); CurrentState = State.DRAW_PLOTS; _is_comparing = false; _start_time = -1; DoneComparison = true; } else if (line.Contains("Done!")) { if (!AreRelated) { var tip_1 = Tips[0]; Tips = new string[] { tip_1 }; } CurrentState = State.DONE; yield break; } else if (line.Contains(":|:")) { var plots = new List<string>(); plots.AddRange (PlotFiles); plots.AddRange (line.Substring(4).Split(new string[] { ":|:" }, System.StringSplitOptions.RemoveEmptyEntries)); PlotFiles = plots.ToArray(); } else Debug.Log(line); _buffer.RemoveAt(0); } } } yield break; }
/// <summary> /// Initialises the comparison module using the specified reference and weights database paths as well as the specified activity. /// </summary> /// <param name="reference_database_filename">The reference database file path.</param> /// <param name="weights_database_filename">The weights database file path.</param> /// <param name="action_name">The comparison activity.</param> public void Initialise_comparison(string reference_database_filename, string weights_database_filename, Properties.Activity action_name) { Initialise_comparison(reference_database_filename, weights_database_filename); ActionName = action_name; }
/// <summary> /// Initialises the comparison module using the default settings for the specified activity. /// </summary> /// <param name="action_name">The comparison activity.</param> public void Initialise_comparison(Properties.Activity action) { Initialise_comparison(); ActionName = action; }
/// <summary> /// Start the comparison process for the recorded Vcl.Utilities.IHumanoids /// using as the reference the specified activity. /// </summary> /// <param name="recorded_motion">The recorded Vcl.Utilities.IHumanoids.</param> /// <param name="action_name">The activity to compare with.</param> public void Compute_comparison(HumanoidStream recorded_motion, Properties.Activity action_name) { ActionName = action_name; Compute_comparison(recorded_motion); }
/// <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 recorded motion of the file in the parameter /// using as the reference the specified activity. /// </summary> /// <param name="recorded_motion_filename">The file path of the recorded motion.</param> /// <param name="action_name">The activity to compare with.</param> public void Compute_comparison(string recorded_motion_filename, Properties.Activity action_name) { ActionName = action_name; Compute_comparison(recorded_motion_filename); }