瀏覽代碼

优化猜拳的落地以及添加步数

liang 1 年之前
父節點
當前提交
0737d5becb
共有 2 個文件被更改,包括 23 次插入1 次删除
  1. 1 1
      shoes_sdk_3.0/include/pub.h
  2. 22 0
      shoes_sdk_3.0/src/FingerGuessing.cpp

+ 1 - 1
shoes_sdk_3.0/include/pub.h

@@ -44,7 +44,7 @@ using namespace std;
 
 #define PRESS_MIN 41000
 
-#define GAME_VERSION "0.5.63"
+#define GAME_VERSION "0.5.64"
 
 enum CMD_MOTION
 {

+ 22 - 0
shoes_sdk_3.0/src/FingerGuessing.cpp

@@ -191,6 +191,24 @@ void FingerGuessing::Process(int time_stamp, int* right_pos, int* right_att, int
 	int* left_pos, int* left_att, int* left_acc, int left_zupt, int left_front_press, int left_back_press,
 	int jump, int down, int rssi)
 {
+
+	//由于刚触地的时候,会偶尔丢掉触地信号的关键帧,现在在线补充一下
+	
+	int online_zupt = extract_motion.online_detect_touch_floor( right_front_press,  left_front_press, right_back_press,  left_back_press);
+
+	if (online_zupt & 0x01)
+	{
+		std::cout << "test :: left_zupt" << endl;
+		left_zupt = 1;
+	}
+	if (online_zupt & 0x02)
+	{
+		std::cout << "test :: right_zupt" << endl;
+		right_zupt = 1;
+	}
+
+
+
 	//缓存一步内的空中数据
 	setData(right_shoes_data_vector, time_stamp, right_pos[0] * 0.001f, right_pos[1] * 0.001f, right_pos[2] * 0.001f,
 		right_att[0] * 0.0001f, right_att[1] * 0.0001f, right_att[2] * 0.0001f, right_zupt, rssi);
@@ -217,6 +235,8 @@ void FingerGuessing::Process(int time_stamp, int* right_pos, int* right_att, int
 			//根据过往记录的位置点来,来优化
 			//ProcessResult(left_global_pos, left_step_data_vector, left_global_pos_vector, LEFT_FOOT);
 
+			addMotionCount(STEP_COUNT);
+
 			left_cmd_step_data_vector = left_step_data_vector;
 
 			float dy = left_step_data_vector.back().pos_y - left_step_data_vector.front().pos_y;
@@ -243,6 +263,8 @@ void FingerGuessing::Process(int time_stamp, int* right_pos, int* right_att, int
 			//根据过往记录的位置点来,来优化
 			//ProcessResult(right_global_pos, right_step_data_vector, right_global_pos_vector, RIGHT_FOOT);
 
+			addMotionCount(STEP_COUNT);
+
 			right_cmd_step_data_vector = right_step_data_vector;
 
 			float dy = right_step_data_vector.back().pos_y - right_step_data_vector.front().pos_y;