瀏覽代碼

修复脚环游戏bug

liang 2 年之前
父節點
當前提交
82a6452264

+ 1 - 0
footRing_sdk_1.0/src/BuildHouse.cpp

@@ -148,6 +148,7 @@ void BuildHouse::Process(int time_stamp, int* right_pos, int* right_att, int* ri
 	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)
 {
+	result[0] = -1;
 
 	if (last_down == 0 && down == 1)
 	//if((front_down == 1 || back_down == 1))

+ 2 - 2
footRing_sdk_1.0/src/Game.cpp

@@ -94,12 +94,12 @@ void Game::GameProcess(int gameTime, int* right_pos_data, int* right_att_data, i
 	game->getResult(resultMatrix);
 
 
-	/////*½»»¥ÃüÁî¼ÆËã*/
+	//*½»»¥ÃüÁî¼ÆËã*/
 	//interaction.Process(gameTime, right_pos_data, right_att_data, right_acc_data, right_zupt, right_front_mag, right_back_mag,
 	//	left_pos_data, left_att_data, left_acc_data, left_zupt, left_front_mag, left_back_mag, jump, down, rssi);
 
 
-	/////*²½Æµ¼ÆËã*/
+	////*²½Æµ¼ÆËã*/
 	//leftFootStep.stepCal(gameTime, left_zupt, left_front_mag, left_back_mag, left_acc_data);
 
 	//rightFootStep.stepCal(gameTime, right_zupt, right_front_mag, right_back_mag, right_acc_data);

+ 16 - 12
footRing_sdk_1.0/src/JumpHouse.cpp

@@ -24,7 +24,9 @@ bool JumpHouse::unzuptValid(int* max_acc, int* min_acc)
 {
 	if ((max_acc[0] - min_acc[0] > 2048 || max_acc[1] - min_acc[1] > 2048 || max_acc[2] - min_acc[2] > 2048) && max_acc[0] > 3000)
 	{
-		std::cout << "JumpHouse::unzuptValid" << endl;
+		std::cout << "JumpHouse::unzuptValid, " << max_acc[0] << ", " << min_acc[0] << ", " << max_acc[1] << ", "
+			<< min_acc[1] << ", " << max_acc[2] << ", " << min_acc[2] << ", " <<endl;
+
 		return true;
 	}
 
@@ -39,14 +41,14 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
 
 	//翘脚视为不在地上
 	// 	   
-	if (left_zupt == 1 && left_att[1] * 0.0001f > 0.4f)
+	if (left_zupt == 1 && left_att[1] * 0.0001f > 0.6f)
 	{
-		std::cout << "if (left_zupt == 1 && left_att[1] * 0.0001f > 0.2f) " << left_att[1] * 0.0001f <<  endl;
+		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.4f)
+	if (right_zupt == 1 && right_att[1] * 0.0001f > 0.6f)
 	{
-		std::cout << "if (right_zupt == 1 && right_att[1] * 0.0001f > 0.2f) " << right_att[1] * 0.0001f << endl;
+		std::cout << "if (right_zupt == 1 && right_att[1] * 0.0001f > 0.6f) " << right_att[1] * 0.0001f << endl;
 		right_zupt = 0;
 	}
 
@@ -90,6 +92,7 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
 
 	}
 
+	//std::cout << left_acc[0] << ", " << left_acc[1] << ", " << left_acc[2] << std::endl;
 	setPolarAccUnzupt(max_acc_unzupt_left, min_acc_unzupt_left, left_acc, left_zupt);
 
 	setPolarAccUnzupt(max_acc_unzupt_right, min_acc_unzupt_right, right_acc, right_zupt);
@@ -100,7 +103,8 @@ 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)
@@ -109,19 +113,19 @@ 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 << std::endl;
+				std::cout << " MOTION_BOTH_ON_FLOOR_CLOSE " << rssi <<  ", "<< count <<  std::endl;
 			}
 			else
 			{
 				result[0] = MOTION_BOTH_ON_FLOOR_OPEN;
-				std::cout << " MOTION_BOTH_ON_FLOOR_OPEN "<< rssi << std::endl;
+				std::cout << " MOTION_BOTH_ON_FLOOR_OPEN "<< rssi << ", " << count << std::endl;
 			}
 
 		}
 		else
 		{
 			result[0] = MOTION_LEFT_ON_FLOOR;
-			std::cout << " MOTION_LEFT_ON_FLOOR "  <<time_stamp << std::endl;
+			std::cout << " MOTION_LEFT_ON_FLOOR "  <<time_stamp << ", " << count << std::endl;
 		
 		}
 
@@ -140,12 +144,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 << std::endl;
+				std::cout << " MOTION_BOTH_ON_FLOOR_CLOSE "  << " "<< rssi << ", " << count << std::endl;
 			}
 			else
 			{
 				result[0] = MOTION_BOTH_ON_FLOOR_OPEN;
-				std::cout << " MOTION_BOTH_ON_FLOOR_OPEN "  << " " << rssi << std::endl;
+				std::cout << " MOTION_BOTH_ON_FLOOR_OPEN "  << " " << rssi << ", " << count << std::endl;
 			}
 
 			left_init = 0;
@@ -155,7 +159,7 @@ 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 <<  std::endl;
+			std::cout << " MOTION_RIGHT_ON_FLOOR "  << time_stamp << ", " << count << std::endl;
 			
 		}
 		right_init = 0;

+ 1 - 1
footRing_sdk_1.0/src/Tricycle.cpp

@@ -111,7 +111,7 @@ void Tricycle::Process(int time_stamp, int* right_pos, int* right_att, int* righ
 	}
 
 
-	float game_heading_offset = (left_heading_offset + right_heading_offset) * 0.5f;
+	float game_heading_offset = -(left_heading_offset + right_heading_offset) * 0.5f;
 
 	//std::cout << "Ç°½ø¶ÈÊý £º" << game_heading_offset / PI * 180.0f<<endl;