Browse Source

后踩也视为触地,时间戳暂时定为1.032倍数大小

liang 2 years ago
parent
commit
eb256add65
2 changed files with 16 additions and 9 deletions
  1. 5 0
      motion/detect_zero_vel.c
  2. 11 9
      motion/trajAlgorithm/footPDR.c

+ 5 - 0
motion/detect_zero_vel.c

@@ -342,6 +342,11 @@ void detect_zero_vel(int16_t front[3], int16_t back[3], int16_t acc[3],
 	{
 		front_up_trend = 1;
 	}
+	//认为后脚跟触地也归为触地
+	if (back_mag_window[WINDOW_SIZE - 1] - back_min_val > MAG_THRESHHOLD * 4)
+	{
+		front_up_trend = 1;
+	}
 
 	//front_down_trend 为 1时候, 意味着前脚掌压力下降
 	int front_down_trend = isLongTimeDownTrend(front_mag_window, WINDOW_SIZE, MAG_THRESHHOLD, &front_max_val);

+ 11 - 9
motion/trajAlgorithm/footPDR.c

@@ -698,15 +698,17 @@ unsigned char footPDR(uint32_t num, float *gyr, float *acc, uint16_t front_press
 {
 	unsigned char movement_e = 0;
 	
-	dt = 0.00258f;
-//	dt = (float)(num - last_timestamp) * 0.000001133f;
-//	
-//	if(num  < last_timestamp || dt > 0.006f)
-//	{
-//		//dt =(float)(4294967295 - last_timestamp + num) * 0.000001f;
-//		dt = 0.00272f;
-//	}
-//	
+	//dt = 0.00258f;
+	//Ö±½Ó³ËÒÔ0.000001fÊÇ·ñÓзçÏÕ£¿
+	dt = (float)(num - last_timestamp) * 0.001032f;
+	dt *= 0.001f;
+	
+	if(num  < last_timestamp)
+	{
+		//dt =(float)(4294967295 - last_timestamp + num) * 0.000001f;
+		dt = 0.0026f;
+	}
+	
 	
 	last_timestamp = num;