Forráskód Böngészése

测试脚环跳房子

liang 1 éve
szülő
commit
28419b8c99

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

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

+ 3 - 3
footRing_sdk_1.0/src/Interaction.cpp

@@ -122,12 +122,12 @@ int Interaction::enter_key_listen( float* acc, float* acc_x_buff,int &station_co
 	pitch_buff[9] = pitch;
 
 	//先判断俯仰角是否正常着地,这样才能判断确认键
-	if (pitch < 0.4f)
+	if (pitch < 0.6f)
 	{
 		angle_has_reset = 1;
 	}
 
-	if (acc_is_valid(acc_x_buff, 10) && *max_element(pitch_buff, pitch_buff + 10) - *min_element(pitch_buff, pitch_buff + 10) < 0.05)
+	if (acc_is_valid(acc_x_buff, 10) && *max_element(pitch_buff, pitch_buff + 10) - *min_element(pitch_buff, pitch_buff + 10) < 0.1)
 	{
 		station_count++;
 	}
@@ -137,7 +137,7 @@ int Interaction::enter_key_listen( float* acc, float* acc_x_buff,int &station_co
 	}
 
 	//x轴速度剧烈抖动,而且俯仰角大于45度,则证明是踮脚
-	if (station_count > 10 && pitch > 0.4f  && angle_has_reset == 1)
+	if (station_count > 10 && pitch > 0.6f  && angle_has_reset == 1)
 	{
 		angle_has_reset = 0;
 

+ 48 - 14
footRing_sdk_1.0/src/JumpHouse.cpp

@@ -41,12 +41,12 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
 
 	//翘脚视为不在地上
 	// 	   
-	if (left_zupt == 1 && left_att[1] * 0.0001f > 0.6f)
+	if (left_zupt == 1 && left_att[1] * 0.0001f > 0.5f)
 	{
 		std::cout << "if (left_zupt == 1 && left_att[1] * 0.0001f > 0.6f) " << left_att[1] * 0.0001f <<  endl;
 		left_zupt = 0;
 	}
-	if (right_zupt == 1 && right_att[1] * 0.0001f > 0.6f)
+	if (right_zupt == 1 && right_att[1] * 0.0001f > 0.5f)
 	{
 		std::cout << "if (right_zupt == 1 && right_att[1] * 0.0001f > 0.6f) " << right_att[1] * 0.0001f << endl;
 		right_zupt = 0;
@@ -65,7 +65,7 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
 	calGlobalPos(left_shoes_data_vector, left_step_data_vector, left_global_pos, left_heading, 0, LEFT_FOOT);
 
 	//通过加速度、以及vector已经缓存了空中的数据来定位判断命令所需的时间戳,这个时间戳是起延时判断的效果,延时是为了等合适的RSSI
-	if (left_step_data_vector.size() > 4 && left_step_data_vector.front().zupt == 1 && left_step_data_vector.back().zupt == 1)
+	if (left_step_data_vector.size() > 9 && left_step_data_vector.front().zupt == 1 && left_step_data_vector.back().zupt == 1)
 	{
 		//if (unzuptValid(max_acc_unzupt_left, min_acc_unzupt_left) && press_valid)
 		if (unzuptValid(max_acc_unzupt_left, min_acc_unzupt_left))
@@ -78,7 +78,7 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
 
 	}
 
-	if (right_step_data_vector.size() > 4 && right_step_data_vector.front().zupt == 1 && right_step_data_vector.back().zupt == 1)
+	if (right_step_data_vector.size() > 9 && right_step_data_vector.front().zupt == 1 && right_step_data_vector.back().zupt == 1)
 	{
 		//if (unzuptValid(max_acc_unzupt_right, min_acc_unzupt_right) && press_valid)
 		if (unzuptValid(max_acc_unzupt_right, min_acc_unzupt_right))
@@ -103,8 +103,7 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
 
 	//判断双脚触地的时候, rssi < 23 必须归位,不然也没办法处理
 	//看起来rssi的延迟有够烂的
-	static int count;
-	count++;
+
 	if (left_init == 1 && time_stamp - left_cmd_wait_time >= 9 && time_stamp - left_cmd_wait_time < 30)
 	{
 		if (right_init == 1)
@@ -113,19 +112,37 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
 			{
 				result[0] = MOTION_BOTH_ON_FLOOR_CLOSE;
 
-				std::cout << " MOTION_BOTH_ON_FLOOR_CLOSE " << rssi <<  ", "<< count <<  std::endl;
+				std::cout << " MOTION_BOTH_ON_FLOOR_CLOSE " << rssi <<  ", " << " 合脚"  <<std::endl;
 			}
 			else
 			{
 				result[0] = MOTION_BOTH_ON_FLOOR_OPEN;
-				std::cout << " MOTION_BOTH_ON_FLOOR_OPEN "<< rssi << ", " << count << std::endl;
+
+				std::cout << " MOTION_BOTH_ON_FLOOR_OPEN "<< rssi << ", "  << " 开脚"<<std::endl;
 			}
 
 		}
 		else
 		{
-			result[0] = MOTION_LEFT_ON_FLOOR;
-			std::cout << " MOTION_LEFT_ON_FLOOR "  <<time_stamp << ", " << count << std::endl;
+			if (abs(left_att[1] - right_att[1]) < 500)
+			{
+				if (rssi < rssi_threshold)
+				{
+					result[0] = MOTION_BOTH_ON_FLOOR_CLOSE;
+
+					std::cout << " MOTION_BOTH_ON_FLOOR_CLOSE " << rssi << ", " << " 合脚" << std::endl;
+				}
+				else
+				{
+					result[0] = MOTION_BOTH_ON_FLOOR_OPEN;
+					std::cout << " MOTION_BOTH_ON_FLOOR_OPEN " << rssi << ", " << " 开脚" << std::endl;
+				}
+			}
+			else
+			{
+				result[0] = MOTION_LEFT_ON_FLOOR;
+				std::cout << " MOTION_LEFT_ON_FLOOR " << time_stamp << ", " << " 左单脚" << std::endl;
+			}
 		
 		}
 
@@ -144,12 +161,12 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
 			{
 				result[0] = MOTION_BOTH_ON_FLOOR_CLOSE;
 
-				std::cout << " MOTION_BOTH_ON_FLOOR_CLOSE "  << " "<< rssi << ", " << count << std::endl;
+				std::cout << " MOTION_BOTH_ON_FLOOR_CLOSE "  << " "<< rssi << ", " << " 合脚" << std::endl;
 			}
 			else
 			{
 				result[0] = MOTION_BOTH_ON_FLOOR_OPEN;
-				std::cout << " MOTION_BOTH_ON_FLOOR_OPEN "  << " " << rssi << ", " << count << std::endl;
+				std::cout << " MOTION_BOTH_ON_FLOOR_OPEN "  << " " << rssi << ", "  << " 开脚"<<std::endl;
 			}
 
 			left_init = 0;
@@ -158,8 +175,25 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
 		}
 		else
 		{
-			result[0] = MOTION_RIGHT_ON_FLOOR;
-			std::cout << " MOTION_RIGHT_ON_FLOOR "  << time_stamp << ", " << count << std::endl;
+			if (abs(left_att[1] - right_att[1]) < 500)
+			{
+				if (rssi < rssi_threshold)
+				{
+					result[0] = MOTION_BOTH_ON_FLOOR_CLOSE;
+
+					std::cout << " MOTION_BOTH_ON_FLOOR_CLOSE " << rssi << ", " << " 合脚" << std::endl;
+				}
+				else
+				{
+					result[0] = MOTION_BOTH_ON_FLOOR_OPEN;
+					std::cout << " MOTION_BOTH_ON_FLOOR_OPEN " << rssi << ", " << " 开脚" << std::endl;
+				}
+			}
+			else
+			{
+				result[0] = MOTION_RIGHT_ON_FLOOR;
+				std::cout << " MOTION_RIGHT_ON_FLOOR " << time_stamp << ", " << "右单脚" << std::endl;
+			}
 			
 		}
 		right_init = 0;