public static Boolean UKI_DataBasicPose_checkBasicPosture(m_If i, UKI_Data_BasicPose bp) { Boolean pass = false; if (i.v == "jump" && i.value == bp.basic_pose[0]) { pass = true; } else if (i.v == "lean" && i.value == bp.basic_pose[1]) { pass = true; } else if (i.v == "spin" && i.value == bp.basic_pose[2]) { pass = true; } else if (i.v == "handL_X" && i.value == bp.basic_pose[3]) { pass = true; } else if (i.v == "handL_Y" && i.value == bp.basic_pose[4]) { pass = true; } else if (i.v == "handL_Z" && i.value == bp.basic_pose[5]) { pass = true; } else if (i.v == "handR_X" && i.value == bp.basic_pose[6]) { pass = true; } else if (i.v == "handR_Y" && i.value == bp.basic_pose[7]) { pass = true; } else if (i.v == "handR_Z" && i.value == bp.basic_pose[8]) { pass = true; } else if (i.v == "handLR_close" && i.value == bp.basic_pose[9]) { pass = true; } else if (i.v == "legL" && i.value == bp.basic_pose[10]) { pass = true; } else if (i.v == "legR" && i.value == bp.basic_pose[11]) { pass = true; } if (i.opt == "!=") { pass = !pass; } return(pass); }
public void collectData_BasicPose() { UKI_Data_BasicPose new_data = new UKI_Data_BasicPose(); new_data.id = current_id; new_data.time = current_time; new_data.basic_pose[0] = p_jump; new_data.basic_pose[1] = p_lean; new_data.basic_pose[2] = p_spin; new_data.basic_pose[3] = p_handL_X; new_data.basic_pose[4] = p_handL_Y; new_data.basic_pose[5] = p_handL_Z; new_data.basic_pose[6] = p_handR_X; new_data.basic_pose[7] = p_handR_Y; new_data.basic_pose[8] = p_handR_Z; new_data.basic_pose[9] = p_handLR_close; new_data.basic_pose[10] = p_legL; new_data.basic_pose[11] = p_legR; data_bp.Add(new_data); }
public static List <string> log_BasicPostureAnalysis = new List <string>();//for show summary //canonical = useBasePose , if not use previous public static void BasicPostureAnalysis(List <UKI_Data_BasicPose> data_bp_selected, Boolean useBasePose) { try { log_BasicPostureAnalysis = new List <string>(); //--- Collect Header "Key Postures: 0,42,82,115,173,439" --------------- string s = "Key Postures: "; int a = 0; foreach (UKI_Data_BasicPose bp in data_bp_selected) { if (a > 0) { s += ","; } s += bp.id; a++; } log_BasicPostureAnalysis.Add(s); if (useBasePose) { log_BasicPostureAnalysis.Add("Canonical: Ready Stance"); } else { log_BasicPostureAnalysis.Add("Canonical: (Previous Posture)"); } log_BasicPostureAnalysis.Add(""); //--- Colelct Data ------------------------------------------------------- if (data_bp_selected.Count > 1) { UKI_Data_BasicPose[] arr_bp = data_bp_selected.ToArray(); UKI_Data_BasicPose canonical = arr_bp[0]; for (int p_num = 1; p_num < arr_bp.Count(); p_num++) { if (!useBasePose) { canonical = arr_bp[p_num - 1]; } //previos as canonical log_BasicPostureAnalysis.Add("Pose " + p_num); List <String> summary_human = new List <String>(); //summary in human language List <String> summary_code = new List <String>(); //summary in code for (int k = 0; k < arr_bp[p_num].basic_pose.Count(); k++) { int v_canonical = canonical.basic_pose[k]; int v_current = arr_bp[p_num].basic_pose[k]; if (v_current != v_canonical) { string v_name = TheUKI.data_bp_name[k]; summary_human.Add(TheTool.string_Tab(1) + TheMapData.convert_getBasePoseDef(v_name, v_current)); summary_code.Add(TheTool.string_Tab(2) + v_name + ": " + v_canonical + " -> " + v_current); } } if (summary_human.Count == 0) { summary_human.Add(TheTool.string_Tab(1) + "Ready Stance"); } foreach (string txt in summary_human) { log_BasicPostureAnalysis.Add(txt); } foreach (string txt in summary_code) { log_BasicPostureAnalysis.Add(txt); } } } } catch (Exception ex) { TheSys.showError("BasicPostureAnalysis: " + ex.ToString()); } }