kidd3166 1 year ago
parent
commit
45e0343093
33 changed files with 732 additions and 1175 deletions
  1. 13 6
      android/app/build.gradle
  2. BIN
      android/app/footring.jks
  3. 1 1
      android/app/src/debug/AndroidManifest.xml
  4. 9 9
      android/app/src/main/AndroidManifest.xml
  5. 2 2
      android/app/src/main/kotlin/xie/hiyd/com/GameService.kt
  6. 1 1
      android/app/src/main/res/values/strings.xml
  7. 1 0
      android/app/src/main/res/xml/network_security_config.xml
  8. 1 1
      android/app/src/profile/AndroidManifest.xml
  9. 3 3
      ios/Runner/Info.plist
  10. 4 3
      lib/config.dart
  11. 46 45
      lib/pages/game/game_guide.dart
  12. 31 31
      lib/pages/login/index.dart
  13. 2 1
      lib/pages/my/user_info_page.dart
  14. 0 3
      lib/pages/run/run_page.dart
  15. 21 20
      lib/pages/run/run_share_simple.dart
  16. 2 2
      lib/pages/run/run_start.dart
  17. 25 2
      plugin/shoes_sdk/ios/Classes/include/FingerGuessing.h
  18. 15 12
      plugin/shoes_sdk/ios/Classes/include/JumpHouse.h
  19. 2 0
      plugin/shoes_sdk/ios/Classes/include/TestGame.h
  20. 32 32
      plugin/shoes_sdk/ios/Classes/include/pub.h
  21. 77 118
      plugin/shoes_sdk/ios/Classes/src/Aerobics.cpp
  22. 5 225
      plugin/shoes_sdk/ios/Classes/src/BuildHouse.cpp
  23. 2 32
      plugin/shoes_sdk/ios/Classes/src/CutCake.cpp
  24. 168 121
      plugin/shoes_sdk/ios/Classes/src/FingerGuessing.cpp
  25. 7 47
      plugin/shoes_sdk/ios/Classes/src/FootStep.cpp
  26. 9 9
      plugin/shoes_sdk/ios/Classes/src/Game.cpp
  27. 8 30
      plugin/shoes_sdk/ios/Classes/src/H5_Game.cpp
  28. 9 9
      plugin/shoes_sdk/ios/Classes/src/Interaction.cpp
  29. 139 218
      plugin/shoes_sdk/ios/Classes/src/JumpHouse.cpp
  30. 47 140
      plugin/shoes_sdk/ios/Classes/src/Kongfu.cpp
  31. 24 32
      plugin/shoes_sdk/ios/Classes/src/RunGame.cpp
  32. 12 6
      plugin/shoes_sdk/ios/Classes/src/TestGame.cpp
  33. 14 14
      plugin/shoes_sdk/ios/Classes/src/online_motion.cpp

+ 13 - 6
android/app/build.gradle

@@ -39,7 +39,7 @@ android {
     }
     }
 
 
     defaultConfig {
     defaultConfig {
-        applicationId "xie.hiyd.com"
+        applicationId "com.hiyd.footring"
         minSdkVersion 21
         minSdkVersion 21
         targetSdkVersion 31
         targetSdkVersion 31
         versionCode flutterVersionCode.toInteger()
         versionCode flutterVersionCode.toInteger()
@@ -68,15 +68,15 @@ android {
 
 
     signingConfigs {
     signingConfigs {
         debug {
         debug {
-            storeFile file("ojia.keystore")
+            storeFile file("footring.jks")
             storePassword "111111"
             storePassword "111111"
-            keyAlias "ojia"
+            keyAlias "footring"
             keyPassword "111111"
             keyPassword "111111"
         }
         }
         release {
         release {
-            storeFile file("ojia.keystore")
+            storeFile file("footring.jks")
             storePassword "111111"
             storePassword "111111"
-            keyAlias "ojia"
+            keyAlias "footring"
             keyPassword "111111"
             keyPassword "111111"
         }
         }
     }
     }
@@ -89,6 +89,13 @@ android {
             // Signing with the debug keys for now, so `flutter run --release` works.
             // Signing with the debug keys for now, so `flutter run --release` works.
             signingConfig signingConfigs.release
             signingConfig signingConfigs.release
         }
         }
+        debug {
+            minifyEnabled false
+            zipAlignEnabled false
+            shrinkResources false
+            // Signing with the debug keys for now, so `flutter run --release` works.
+            signingConfig signingConfigs.debug
+        }
     }
     }
 
 
     android.applicationVariants.all { variant ->
     android.applicationVariants.all { variant ->
@@ -129,7 +136,7 @@ android {
             }
             }
 
 
         variant.outputs.all {
         variant.outputs.all {
-            outputFileName = "qudong_${variant.versionName}_${variant.versionCode}.apk"
+            outputFileName = "footring_${variant.versionName}_${variant.versionCode}.apk"
         }
         }
     }
     }
 
 

BIN
android/app/footring.jks


+ 1 - 1
android/app/src/debug/AndroidManifest.xml

@@ -1,5 +1,5 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="xie.hiyd.com">
+    package="com.hiyd.footring">
     <!-- Flutter needs it to communicate with the running application
     <!-- Flutter needs it to communicate with the running application
          to allow setting breakpoints, to provide hot reload, etc.
          to allow setting breakpoints, to provide hot reload, etc.
     -->
     -->

+ 9 - 9
android/app/src/main/AndroidManifest.xml

@@ -1,6 +1,6 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     xmlns:tools="http://schemas.android.com/tools"
-    package="xie.hiyd.com">
+    package="com.hiyd.footring">
     <!-- io.flutter.app.FlutterApplication is an android.app.Application that
     <!-- io.flutter.app.FlutterApplication is an android.app.Application that
          calls FlutterMain.startInitialization(this); in its onCreate method.
          calls FlutterMain.startInitialization(this); in its onCreate method.
          In most cases you can leave this as-is, but you if you want to provide
          In most cases you can leave this as-is, but you if you want to provide
@@ -35,12 +35,12 @@
     <uses-permission android:name="oppo.permission.OPPO_COMPONENT_SAFE"/>
     <uses-permission android:name="oppo.permission.OPPO_COMPONENT_SAFE"/>
     <uses-permission android:name="com.huawei.permission.external_app_settings.USE_COMPONENT"/>
     <uses-permission android:name="com.huawei.permission.external_app_settings.USE_COMPONENT"/>
 
 
-    <uses-permission android:name="xie.hiyd.com.permission.MIPUSH_RECEIVE"/>
-    <permission android:name="xie.hiyd.com.permission.MIPUSH_RECEIVE"
+    <uses-permission android:name="com.hiyd.footring.permission.MIPUSH_RECEIVE"/>
+    <permission android:name="com.hiyd.footring.permission.MIPUSH_RECEIVE"
         android:protectionLevel="signature" tools:replace="android:protectionLevel"/>
         android:protectionLevel="signature" tools:replace="android:protectionLevel"/>
 
 
     <application
     <application
-        android:name=".XieApplication"
+        android:name="xie.hiyd.com.XieApplication"
         android:label="@string/app_name"
         android:label="@string/app_name"
         android:largeHeap="true"
         android:largeHeap="true"
         android:networkSecurityConfig="@xml/network_security_config"
         android:networkSecurityConfig="@xml/network_security_config"
@@ -49,7 +49,7 @@
         android:allowBackup="false"
         android:allowBackup="false"
         tools:replace="android:allowBackup">
         tools:replace="android:allowBackup">
         <activity
         <activity
-            android:name=".MainActivity"
+            android:name="xie.hiyd.com.MainActivity"
             android:launchMode="singleTop"
             android:launchMode="singleTop"
             android:theme="@style/LaunchTheme"
             android:theme="@style/LaunchTheme"
             android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
             android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
@@ -72,16 +72,16 @@
                 <action android:name="android.intent.action.VIEW"/>
                 <action android:name="android.intent.action.VIEW"/>
                 <category android:name="android.intent.category.DEFAULT"/>
                 <category android:name="android.intent.category.DEFAULT"/>
                 <category android:name="android.intent.category.BROWSABLE"/>
                 <category android:name="android.intent.category.BROWSABLE"/>
-                <data android:scheme="qudong"
+                <data android:scheme="qufootring"
                     android:host="home"/>
                     android:host="home"/>
             </intent-filter>
             </intent-filter>
         </activity>
         </activity>
-        <service android:name=".GameService" />
+        <service android:name="xie.hiyd.com.GameService" />
         <!-- Don't delete the meta-data below.
         <!-- Don't delete the meta-data below.
              This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
              This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
         <provider
         <provider
             android:name="androidx.core.content.FileProvider"
             android:name="androidx.core.content.FileProvider"
-            android:authorities="xie.hiyd.com.fileProvider"
+            android:authorities="com.hiyd.footring.fileProvider"
             android:exported="false"
             android:exported="false"
             android:grantUriPermissions="true">
             android:grantUriPermissions="true">
             <meta-data
             <meta-data
@@ -93,7 +93,7 @@
             android:value="2" />
             android:value="2" />
         <meta-data
         <meta-data
             android:name="com.amap.api.v2.apikey"
             android:name="com.amap.api.v2.apikey"
-            android:value="f606b2f01de83ce2f9984680fa0f1897"/>
+            android:value="1574fbae6a13523ea745b61be524d05c"/>
 
 
         <!-- 高德定位需要的服务 -->
         <!-- 高德定位需要的服务 -->
         <service android:name="com.amap.api.location.APSService"
         <service android:name="com.amap.api.location.APSService"

+ 2 - 2
android/app/src/main/kotlin/xie/hiyd/com/GameService.kt

@@ -36,8 +36,8 @@ class GameService : Service() {
                 startForeground(
                 startForeground(
                     it,
                     it,
                     NotificationCompat.Builder(this, CHANNEL_ID)
                     NotificationCompat.Builder(this, CHANNEL_ID)
-                        .setSmallIcon(R.mipmap.ic_launcher)
-                        .setContentTitle("${getString(R.string.app_name)} - 运动中")
+                        .setSmallIcon(com.hiyd.footring.R.mipmap.ic_launcher)
+                        .setContentTitle("${getString(com.hiyd.footring.R.string.app_name)} - 运动中")
                         .setPriority(NotificationCompat.PRIORITY_HIGH)
                         .setPriority(NotificationCompat.PRIORITY_HIGH)
                         .build()
                         .build()
                 )
                 )

+ 1 - 1
android/app/src/main/res/values/strings.xml

@@ -1,3 +1,3 @@
 <resources>
 <resources>
-    <string name="app_name">趣动</string>
+    <string name="app_name">趣动</string>
 </resources>
 </resources>

+ 1 - 0
android/app/src/main/res/xml/network_security_config.xml

@@ -14,5 +14,6 @@
         <domain includeSubdomains="true">hiyd.com</domain>
         <domain includeSubdomains="true">hiyd.com</domain>
         <domain includeSubdomains="true">yy.com</domain>
         <domain includeSubdomains="true">yy.com</domain>
         <domain includeSubdomains="true">share2dlink.com</domain>
         <domain includeSubdomains="true">share2dlink.com</domain>
+        <domain includeSubdomains="true">47.113.95.226</domain>
     </domain-config>
     </domain-config>
 </network-security-config>
 </network-security-config>

+ 1 - 1
android/app/src/profile/AndroidManifest.xml

@@ -1,5 +1,5 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="xie.hiyd.com">
+    package="com.hiyd.footring">
     <!-- Flutter needs it to communicate with the running application
     <!-- Flutter needs it to communicate with the running application
          to allow setting breakpoints, to provide hot reload, etc.
          to allow setting breakpoints, to provide hot reload, etc.
     -->
     -->

+ 3 - 3
ios/Runner/Info.plist

@@ -4,7 +4,7 @@
 <dict>
 <dict>
 	<key>BGTaskSchedulerPermittedIdentifiers</key>
 	<key>BGTaskSchedulerPermittedIdentifiers</key>
 	<array>
 	<array>
-		<string>xie.hiyd.com</string>
+		<string>com.hiyd.footring</string>
 	</array>
 	</array>
 	<key>CFBundleExecutable</key>
 	<key>CFBundleExecutable</key>
 	<string>$(EXECUTABLE_NAME)</string>
 	<string>$(EXECUTABLE_NAME)</string>
@@ -17,7 +17,7 @@
 		<string>zh_CN</string>
 		<string>zh_CN</string>
 	</array>
 	</array>
 	<key>CFBundleName</key>
 	<key>CFBundleName</key>
-	<string>趣动</string>
+	<string>趣动</string>
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
 	<key>CFBundleShortVersionString</key>
@@ -175,7 +175,7 @@
 	<key>UIViewControllerBasedStatusBarAppearance</key>
 	<key>UIViewControllerBasedStatusBarAppearance</key>
 	<false/>
 	<false/>
 	<key>amap_key</key>
 	<key>amap_key</key>
-	<string>4a8518eb97acf5d1998385907e24696a</string>
+	<string>949af229200e6a4d636aee0d9ea85415</string>
 	<key>io.flutter.embedded_views_preview</key>
 	<key>io.flutter.embedded_views_preview</key>
 	<string>YES</string>
 	<string>YES</string>
 </dict>
 </dict>

+ 4 - 3
lib/config.dart

@@ -1,7 +1,8 @@
 class Config {
 class Config {
-  static final ENV_DEV = Config("https://test-shoes-api.funfet.com");
-  static final ENV_TEST = Config("https://shoes-api.funfet.com");
-  static final ENV_RELEASE = Config("https://shoes-api.funfet.com", debug: false);
+
+  static final ENV_DEV = Config("http://47.113.95.226");
+  static final ENV_TEST = Config("http://47.113.95.226");
+  static final ENV_RELEASE = Config("http://47.113.95.226", debug: false);
   static Config config = ENV_TEST;
   static Config config = ENV_TEST;
 
 
   String baseUrl;
   String baseUrl;

+ 46 - 45
lib/pages/game/game_guide.dart

@@ -24,150 +24,150 @@ Map<int, List<Map<String, dynamic>>> guideActionMap = {
     {
     {
       "name": "开始",
       "name": "开始",
       "motion": [],
       "motion": [],
-      "video": "http://static.ouj.com/video/b0e0ac59-e150-38d6-bd24-5bc1d83b0ece.mp4",
+      "video": "http://47.113.95.226/res/video/b0e0ac59-e150-38d6-bd24-5bc1d83b0ece.mp4",
     },
     },
     {
     {
       "name": "右踏步",
       "name": "右踏步",
       "motion": [4],
       "motion": [4],
-      "video": "http://static.ouj.com/video/9ef77bac-2a6f-3aaa-8e8c-b0e7b7916624.mp4",
+      "video": "http://47.113.95.226/res/video/9ef77bac-2a6f-3aaa-8e8c-b0e7b7916624.mp4",
     },
     },
     {
     {
       "name": "左踏步",
       "name": "左踏步",
       "motion": [3],
       "motion": [3],
-      "video": "http://static.ouj.com/video/9b4706aa-3809-309e-84a4-040c498a2e15.mp4",
+      "video": "http://47.113.95.226/res/video/9b4706aa-3809-309e-84a4-040c498a2e15.mp4",
     },
     },
     {
     {
       "name": "右踮脚",
       "name": "右踮脚",
       "motion": [5],
       "motion": [5],
-      "video": "http://static.ouj.com/video/64fab916-00ac-33fa-b8d0-cebf4c077f26.mp4",
+      "video": "http://47.113.95.226/res/video/64fab916-00ac-33fa-b8d0-cebf4c077f26.mp4",
     },
     },
     {
     {
       "name": "左踮脚",
       "name": "左踮脚",
       "motion": [6],
       "motion": [6],
-      "video": "http://static.ouj.com/video/f1f49cfc-3fc5-37eb-a8ac-d8a1eee0bc11.mp4",
+      "video": "http://47.113.95.226/res/video/f1f49cfc-3fc5-37eb-a8ac-d8a1eee0bc11.mp4",
     },
     },
   ],
   ],
   3: [
   3: [
     {
     {
       "name": "开始",
       "name": "开始",
       "motion": [],
       "motion": [],
-      "video": "http://static.ouj.com/video/962d2d03-2a47-3418-bc1d-7b92afa29009.mp4",
+      "video": "http://47.113.95.226/res/video/962d2d03-2a47-3418-bc1d-7b92afa29009.mp4",
     },
     },
     {
     {
       "name": "原地跑",
       "name": "原地跑",
       "motion": [1],
       "motion": [1],
       "motion_type": 1,
       "motion_type": 1,
-      "video": "http://static.ouj.com/video/0c067c1d-a8ac-3e1b-9b5a-dda32abbdb1d.mp4",
+      "video": "http://47.113.95.226/res/video/0c067c1d-a8ac-3e1b-9b5a-dda32abbdb1d.mp4",
     },
     },
     {
     {
       "name": "左换道",
       "name": "左换道",
       "motion": [4],
       "motion": [4],
-      "video": "http://static.ouj.com/video/ee846e82-3829-3bf4-93ba-caf810aedb2b.mp4",
+      "video": "http://47.113.95.226/res/video/ee846e82-3829-3bf4-93ba-caf810aedb2b.mp4",
     },
     },
     {
     {
       "name": "右换道",
       "name": "右换道",
       "motion": [5],
       "motion": [5],
-      "video": "http://static.ouj.com/video/4ab6498e-a3fc-3870-af06-8aeba3f97453.mp4",
+      "video": "http://47.113.95.226/res/video/4ab6498e-a3fc-3870-af06-8aeba3f97453.mp4",
     },
     },
     {
     {
       "name": "跳跃",
       "name": "跳跃",
       "motion": [2],
       "motion": [2],
-      "video": "http://static.ouj.com/video/299eb3d1-8d73-3ca1-80c2-8469ffc770fa.mp4",
+      "video": "http://47.113.95.226/res/video/299eb3d1-8d73-3ca1-80c2-8469ffc770fa.mp4",
     },
     },
     {
     {
       "name": "下蹲",
       "name": "下蹲",
       "motion": [3],
       "motion": [3],
-      "video": "http://static.ouj.com/video/47155e50-a14a-329e-8b33-b9d5d101f184.mp4",
+      "video": "http://47.113.95.226/res/video/47155e50-a14a-329e-8b33-b9d5d101f184.mp4",
     },
     },
   ],
   ],
   1: [
   1: [
     {
     {
       "name": "开始",
       "name": "开始",
       "motion": [],
       "motion": [],
-      "video": "http://static.ouj.com/video/18d5f02d-b397-3c1d-8604-ffa84005ed09.mp4",
+      "video": "http://47.113.95.226/res/video/18d5f02d-b397-3c1d-8604-ffa84005ed09.mp4",
     },
     },
     {
     {
       "name": "原地踩",
       "name": "原地踩",
       "motion": [12],
       "motion": [12],
-      "video": "http://static.ouj.com/video/ee05b628-63e6-30d1-9595-b1efbf71ebd8.mp4",
-      "icon": "http://static.ouj.com/shoes/game/136e85575f574865a544a87c2ae24d9c.png",
+      "video": "http://47.113.95.226/res/video/ee05b628-63e6-30d1-9595-b1efbf71ebd8.mp4",
+      "icon": "http://47.113.95.226/res/shoes/game/136e85575f574865a544a87c2ae24d9c.png",
     },
     },
     {
     {
       "name": "左上踩",
       "name": "左上踩",
       "motion": [8],
       "motion": [8],
-      "video": "http://static.ouj.com/video/4f4424f6-3819-3f70-b1db-3cb68f0b0261.mp4",
-      "icon": "http://static.ouj.com/shoes/game/4e55b8819c9f4b2dbbad64db3cf20605.png",
+      "video": "http://47.113.95.226/res/video/4f4424f6-3819-3f70-b1db-3cb68f0b0261.mp4",
+      "icon": "http://47.113.95.226/res/shoes/game/4e55b8819c9f4b2dbbad64db3cf20605.png",
     },
     },
     {
     {
       "name": "左下踩",
       "name": "左下踩",
       "motion": [9],
       "motion": [9],
-      "video": "http://static.ouj.com/video/f574233d-7580-35cb-81c5-0d29e716a83e.mp4",
-      "icon": "http://static.ouj.com/shoes/game/b332785b77244bc59ea67b9b76ae11b3.png",
+      "video": "http://47.113.95.226/res/video/f574233d-7580-35cb-81c5-0d29e716a83e.mp4",
+      "icon": "http://47.113.95.226/res/shoes/game/b332785b77244bc59ea67b9b76ae11b3.png",
     },
     },
     {
     {
       "name": "右上踩",
       "name": "右上踩",
       "motion": [10],
       "motion": [10],
-      "video": "http://static.ouj.com/video/c05c97fc-218b-32ae-a595-4aa4dcd5b713.mp4",
-      "icon": "http://static.ouj.com/shoes/game/a181082b58cf49aca6a73a02d7196d3e.png",
+      "video": "http://47.113.95.226/res/video/c05c97fc-218b-32ae-a595-4aa4dcd5b713.mp4",
+      "icon": "http://47.113.95.226/res/shoes/game/a181082b58cf49aca6a73a02d7196d3e.png",
     },
     },
     {
     {
       "name": "右下踩",
       "name": "右下踩",
       "motion": [11],
       "motion": [11],
-      "video": "http://static.ouj.com/video/617a5dfc-f3cc-3d06-896d-4907f4b1123b.mp4",
-      "icon": "http://static.ouj.com/shoes/game/5d210d906bef4fc68b51dbb648449229.png",
+      "video": "http://47.113.95.226/res/video/617a5dfc-f3cc-3d06-896d-4907f4b1123b.mp4",
+      "icon": "http://47.113.95.226/res/shoes/game/5d210d906bef4fc68b51dbb648449229.png",
     },
     },
   ],
   ],
   10: [
   10: [
     {
     {
       "name": "开始",
       "name": "开始",
       "motion": [],
       "motion": [],
-      "video": "http://static.ouj.com/video/26b2a19e-8c13-31e9-9eeb-186f346114cf.mp4",
+      "video": "http://47.113.95.226/res/video/26b2a19e-8c13-31e9-9eeb-186f346114cf.mp4",
     },
     },
     {
     {
       "name": "左右踩",
       "name": "左右踩",
       "motion": [4, 5],
       "motion": [4, 5],
-      "video": "http://static.ouj.com/video/ad852e3a-37a7-3bf1-8055-009bfd25afea.mp4",
+      "video": "http://47.113.95.226/res/video/ad852e3a-37a7-3bf1-8055-009bfd25afea.mp4",
     },
     },
     {
     {
       "name": "跳跃",
       "name": "跳跃",
       "motion": [2],
       "motion": [2],
-      "video": "http://static.ouj.com/video/02fdb193-18bc-3a59-8871-57d92b935306.mp4",
+      "video": "http://47.113.95.226/res/video/02fdb193-18bc-3a59-8871-57d92b935306.mp4",
     },
     },
     {
     {
       "name": "下蹲",
       "name": "下蹲",
       "motion": [3],
       "motion": [3],
-      "video": "http://static.ouj.com/video/cf2a28dc-56b6-37dd-8523-8b133a43709f.mp4",
+      "video": "http://47.113.95.226/res/video/cf2a28dc-56b6-37dd-8523-8b133a43709f.mp4",
     },
     },
   ],
   ],
   9: [
   9: [
     {
     {
       "name": "开始",
       "name": "开始",
       "motion": [],
       "motion": [],
-      "video": "http://static.ouj.com/video/ce0096d5-6d43-3dbd-9b39-51921a3a5ba8.mp4",
+      "video": "http://47.113.95.226/res/video/ce0096d5-6d43-3dbd-9b39-51921a3a5ba8.mp4",
     },
     },
     {
     {
       "name": "原地跑",
       "name": "原地跑",
       "motion": [1],
       "motion": [1],
       "motion_type": 1,
       "motion_type": 1,
-      "video": "http://static.ouj.com/video/fa1ae69f-b753-31dc-b7db-d694370ccdbe.mp4",
+      "video": "http://47.113.95.226/res/video/fa1ae69f-b753-31dc-b7db-d694370ccdbe.mp4",
     },
     },
     {
     {
       "name": "跳跃",
       "name": "跳跃",
       "motion": [2],
       "motion": [2],
-      "video": "http://static.ouj.com/video/52e9b690-6a08-3ca4-9b1d-cad322ab0561.mp4",
+      "video": "http://47.113.95.226/res/video/52e9b690-6a08-3ca4-9b1d-cad322ab0561.mp4",
     },
     },
   ],
   ],
   // 2: [
   // 2: [
   //   {
   //   {
-  //     "name": "原地跑",
+  //     "name": "原锟斤拷锟斤拷",
   //     "motion": [1]
   //     "motion": [1]
   //   },
   //   },
   //   {
   //   {
-  //     "name": "向左转",
+  //     "name": "锟斤拷锟斤拷转",
   //     "motion": [-1]
   //     "motion": [-1]
   //   },
   //   },
   //   {
   //   {
-  //     "name": "向右转",
+  //     "name": "锟斤拷锟斤拷转",
   //     "motion": [-2]
   //     "motion": [-2]
   //   },
   //   },
   //   {
   //   {
@@ -179,57 +179,58 @@ Map<int, List<Map<String, dynamic>>> guideActionMap = {
     {
     {
       "name": "开始",
       "name": "开始",
       "motion": [],
       "motion": [],
-      "video": "http://static.ouj.com/video/05084300-0ddb-384a-9d7d-d5b3679f1114.mp4",
+      "video": "http://47.113.95.226/res/video/05084300-0ddb-384a-9d7d-d5b3679f1114.mp4",
     },
     },
     {
     {
       "name": "石头",
       "name": "石头",
       "motion": [15],
       "motion": [15],
-      "video": "http://static.ouj.com/video/05a7b15c-d94b-340d-a503-2fe39f03381d.mp4",
+      "video": "http://47.113.95.226/res/video/05a7b15c-d94b-340d-a503-2fe39f03381d.mp4",
     },
     },
     {
     {
       "name": "剪刀",
       "name": "剪刀",
       "motion": [16],
       "motion": [16],
-      "video": "http://static.ouj.com/video/aa864f5d-cd35-3727-a6eb-6b63012fdcc1.mp4",
+      "video": "http://47.113.95.226/res/video/aa864f5d-cd35-3727-a6eb-6b63012fdcc1.mp4",
     },
     },
     {
     {
       "name": "布",
       "name": "布",
       "motion": [17],
       "motion": [17],
-      "video": "http://static.ouj.com/video/7f5fc141-bc96-3ba1-a453-b8686d3565cf.mp4",
+      "video": "http://47.113.95.226/res/video/7f5fc141-bc96-3ba1-a453-b8686d3565cf.mp4",
     },
     },
   ],
   ],
   33: [
   33: [
     {
     {
       "name": "开始",
       "name": "开始",
       "motion": [],
       "motion": [],
-      "video": "http://static.ouj.com/video/3155330b-1bc7-3cfe-af21-8efbfc1da7c9.mp4",
+      "video": "http://47.113.95.226/res/video/3155330b-1bc7-3cfe-af21-8efbfc1da7c9.mp4",
     },
     },
     {
     {
       "name": "高抬腿",
       "name": "高抬腿",
       "motion": [19, 21],
       "motion": [19, 21],
-      "video": "http://static.ouj.com/video/ca4819b4-e66b-3a62-84a1-28e3b9a8cc37.mp4",
-      "icon": "http://static.ouj.com/shoes/game/02d3a2fb8f0045f9ae608a163a30a83f.png",
+      "video": "http://47.113.95.226/res/video/ca4819b4-e66b-3a62-84a1-28e3b9a8cc37.mp4",
+      "icon": "http://47.113.95.226/res/shoes/game/02d3a2fb8f0045f9ae608a163a30a83f.png",
     },
     },
     {
     {
       "name": "前踢脚",
       "name": "前踢脚",
       "motion": [22, 23],
       "motion": [22, 23],
-      "video": "http://static.ouj.com/video/73c99824-0ee2-3d70-8695-fc4e8eaf9f5d.mp4",
-      "icon": "http://static.ouj.com/shoes/game/03a39e4a51334fde8cd7ccfa14ad3ac3.png",
+      "video": "http://47.113.95.226/res/video/73c99824-0ee2-3d70-8695-fc4e8eaf9f5d.mp4",
+      "icon": "http://47.113.95.226/res/shoes/game/03a39e4a51334fde8cd7ccfa14ad3ac3.png",
     },
     },
     {
     {
       "name": "侧踢脚",
       "name": "侧踢脚",
       "motion": [18, 20],
       "motion": [18, 20],
-      "video": "http://static.ouj.com/video/be2841b0-7a08-3e18-8fd6-d4b0d623985f.mp4",
-      "icon": "http://static.ouj.com/shoes/game/6cdb79103367417ba7fad82585900327.png",
+      "video": "http://47.113.95.226/res/video/be2841b0-7a08-3e18-8fd6-d4b0d623985f.mp4",
+      "icon": "http://47.113.95.226/res/shoes/game/6cdb79103367417ba7fad82585900327.png",
     },
     },
     {
     {
       "name": "下蹲",
       "name": "下蹲",
       "motion": [3],
       "motion": [3],
-      "video": "http://static.ouj.com/video/85a16233-e70b-37ee-a584-10be044bba8c.mp4",
-      "icon": "http://static.ouj.com/shoes/game/20d94a43b2cd4404b23bdda556d75ea2.png",
+      "video": "http://47.113.95.226/res/video/85a16233-e70b-37ee-a584-10be044bba8c.mp4",
+      "icon": "http://47.113.95.226/res/shoes/game/20d94a43b2cd4404b23bdda556d75ea2.png",
     },
     },
   ],
   ],
 };
 };
 
 
+
 class GameGuide extends StatefulWidget {
 class GameGuide extends StatefulWidget {
   final GameInfoData game;
   final GameInfoData game;
   final bool base;
   final bool base;

+ 31 - 31
lib/pages/login/index.dart

@@ -298,37 +298,37 @@ class _LoginState extends State<Login> with TencentMixin, InjectLoginApi, Wechat
                 crossAxisAlignment: CrossAxisAlignment.start,
                 crossAxisAlignment: CrossAxisAlignment.start,
                 mainAxisAlignment: MainAxisAlignment.spaceBetween,
                 mainAxisAlignment: MainAxisAlignment.spaceBetween,
                 children: <Widget>[
                 children: <Widget>[
-                  if(Platform.isAndroid || (Platform.isIOS && _canWeixin))
-                  Expanded(
-                    child: InkWell(
-                      child: Container(
-                        height: 50.0,
-                        child: Image.asset("lib/assets/img/login_weixin.png"),
-                      ),
-                      onTap: () async {
-                        if (!_license) {
-                          ToastUtil.show(agree);
-                          return;
-                        }
-                        wechatLogin();
-                        UmengCommonSdk.onEvent("app_login_wechat", {});
-                      },
-                    ),
-                  ),
-                  if(Platform.isAndroid || (Platform.isIOS && _canQQ))
-                  Expanded(
-                    child: InkWell(
-                      child: Container(height: 50.0, child: Image.asset("lib/assets/img/login_qq.png")),
-                      onTap: () async {
-                        if (!_license) {
-                          ToastUtil.show(agree);
-                          return;
-                        }
-                        tencentLogin();
-                        UmengCommonSdk.onEvent("app_login_tencent", {});
-                      },
-                    ),
-                  ),
+                  // if(Platform.isAndroid || (Platform.isIOS && _canWeixin))
+                  // Expanded(
+                  //   child: InkWell(
+                  //     child: Container(
+                  //       height: 50.0,
+                  //       child: Image.asset("lib/assets/img/login_weixin.png"),
+                  //     ),
+                  //     onTap: () async {
+                  //       if (!_license) {
+                  //         ToastUtil.show(agree);
+                  //         return;
+                  //       }
+                  //       wechatLogin();
+                  //       UmengCommonSdk.onEvent("app_login_wechat", {});
+                  //     },
+                  //   ),
+                  // ),
+                  // if(Platform.isAndroid || (Platform.isIOS && _canQQ))
+                  // Expanded(
+                  //   child: InkWell(
+                  //     child: Container(height: 50.0, child: Image.asset("lib/assets/img/login_qq.png")),
+                  //     onTap: () async {
+                  //       if (!_license) {
+                  //         ToastUtil.show(agree);
+                  //         return;
+                  //       }
+                  //       tencentLogin();
+                  //       UmengCommonSdk.onEvent("app_login_tencent", {});
+                  //     },
+                  //   ),
+                  // ),
                   Expanded(
                   Expanded(
                     child: InkWell(
                     child: InkWell(
                       child: Container(height: 50.0, child: Image.asset("lib/assets/img/login_phone.png")),
                       child: Container(height: 50.0, child: Image.asset("lib/assets/img/login_phone.png")),

+ 2 - 1
lib/pages/my/user_info_page.dart

@@ -15,6 +15,7 @@ import 'package:sport/pages/login/login_widget.dart';
 import 'package:sport/pages/my/weight_page.dart';
 import 'package:sport/pages/my/weight_page.dart';
 import 'package:sport/pages/run/location.dart';
 import 'package:sport/pages/run/location.dart';
 import 'package:sport/pages/run/run_page.dart';
 import 'package:sport/pages/run/run_page.dart';
+import 'package:sport/pages/run/run_start.dart';
 import 'package:sport/pages/social/user_friend_add_page.dart';
 import 'package:sport/pages/social/user_friend_add_page.dart';
 import 'package:sport/provider/login_info_model.dart';
 import 'package:sport/provider/login_info_model.dart';
 import 'package:sport/provider/user_model.dart';
 import 'package:sport/provider/user_model.dart';
@@ -587,7 +588,7 @@ class _PageState extends State<UserInfoPage> with InjectLoginApi,InjectApi {
     Completer c = Completer();
     Completer c = Completer();
     var steam = _locationPlugin.onLocationChanged().listen((Map<String, Object> result) {
     var steam = _locationPlugin.onLocationChanged().listen((Map<String, Object> result) {
       if(!c.isCompleted)
       if(!c.isCompleted)
-        c.complete(result);
+      c.complete(result);
     });
     });
     ///将定位参数设置给定位插件
     ///将定位参数设置给定位插件
     _locationPlugin.setLocationOption(locationOption);
     _locationPlugin.setLocationOption(locationOption);

+ 0 - 3
lib/pages/run/run_page.dart

@@ -40,9 +40,6 @@ import 'package:sport/widgets/dialog/blank_dialog.dart';
 import 'package:sport/widgets/dialog/request_dialog.dart';
 import 'package:sport/widgets/dialog/request_dialog.dart';
 import 'package:sport/widgets/image.dart';
 import 'package:sport/widgets/image.dart';
 
 
-const KEY_ANDROID = "f606b2f01de83ce2f9984680fa0f1897";
-const KEY_IOS = "4a8518eb97acf5d1998385907e24696a";
-
 String formatNum(double num, int position) {
 String formatNum(double num, int position) {
   if (num == null) return "0";
   if (num == null) return "0";
   if (position == 0) {
   if (position == 0) {

+ 21 - 20
lib/pages/run/run_share_simple.dart

@@ -158,27 +158,28 @@ setState(() {
   @override
   @override
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
     List<String> images = [
     List<String> images = [
-      "http://static.ouj.com/shoes/share/2a5a923a279f40e6b748738567201122.jpg",
-      "http://static.ouj.com/shoes/share/8b114b50bb304c47b24e208a6178834b.jpg",
-      "http://static.ouj.com/shoes/share/e29353f9d5d44e5d84470b847e97edda.jpg",
-      "http://static.ouj.com/shoes/share/43333533ac544f258c6b956ebae3d113.jpg",
-      "http://static.ouj.com/shoes/share/17517327f9484bf5a424af6b0575ed97.jpg",
-      "http://static.ouj.com/shoes/share/134f84afaac341a2b7ad78e685f5f7c8.jpg",
-      "http://static.ouj.com/shoes/share/7e29848e3b454d138761f42dd4aebd2e.jpg",
-      "http://static.ouj.com/shoes/share/e0c8a740684249a2a01de2d38f764976.jpg",
-      "http://static.ouj.com/shoes/share/160d3d44c3e94d7b8b7a3877795d3382.jpg",
-      "http://static.ouj.com/shoes/share/77ca189000874d659fb7dd74fcbb5c31.jpg",
-      "http://static.ouj.com/shoes/share/ac9ea19959144ec49fa9c71920a0c2eb.jpg",
-      "http://static.ouj.com/shoes/share/43737b5a01244a54a9d9fca33f6dd4fc.jpg",
-      "http://static.ouj.com/shoes/share/64eefb9e07d0459f863e1cefe5bc3f6e.jpg",
-      "http://static.ouj.com/shoes/share/2fabe655df5b4506b21e863f55ab7fcc.jpg",
-      "http://static.ouj.com/shoes/share/0977c4f9600e4246a53ed74b4be54c1c.jpg",
-      "http://static.ouj.com/shoes/share/f08b46054b96456e975b2bff7e0164d2.jpg",
-      "http://static.ouj.com/shoes/share/069b6df74d6e4637a296ebc6280931b0.jpg",
-      "http://static.ouj.com/shoes/share/188ab172885044dead5a03941538e197.jpg",
-      "http://static.ouj.com/shoes/share/cf67cc513cb547dc954849cc3f32b59f.jpg",
-      "http://static.ouj.com/shoes/share/54c8e8d58a3442c9ad08618cb683a796.jpg"
+      "http://47.113.95.226/res/shoes/share/2a5a923a279f40e6b748738567201122.jpg",
+      "http://47.113.95.226/res/shoes/share/8b114b50bb304c47b24e208a6178834b.jpg",
+      "http://47.113.95.226/res/shoes/share/e29353f9d5d44e5d84470b847e97edda.jpg",
+      "http://47.113.95.226/res/shoes/share/43333533ac544f258c6b956ebae3d113.jpg",
+      "http://47.113.95.226/res/shoes/share/17517327f9484bf5a424af6b0575ed97.jpg",
+      "http://47.113.95.226/res/shoes/share/134f84afaac341a2b7ad78e685f5f7c8.jpg",
+      "http://47.113.95.226/res/shoes/share/7e29848e3b454d138761f42dd4aebd2e.jpg",
+      "http://47.113.95.226/res/shoes/share/e0c8a740684249a2a01de2d38f764976.jpg",
+      "http://47.113.95.226/res/shoes/share/160d3d44c3e94d7b8b7a3877795d3382.jpg",
+      "http://47.113.95.226/res/shoes/share/77ca189000874d659fb7dd74fcbb5c31.jpg",
+      "http://47.113.95.226/res/shoes/share/ac9ea19959144ec49fa9c71920a0c2eb.jpg",
+      "http://47.113.95.226/res/shoes/share/43737b5a01244a54a9d9fca33f6dd4fc.jpg",
+      "http://47.113.95.226/res/shoes/share/64eefb9e07d0459f863e1cefe5bc3f6e.jpg",
+      "http://47.113.95.226/res/shoes/share/2fabe655df5b4506b21e863f55ab7fcc.jpg",
+      "http://47.113.95.226/res/shoes/share/0977c4f9600e4246a53ed74b4be54c1c.jpg",
+      "http://47.113.95.226/res/shoes/share/f08b46054b96456e975b2bff7e0164d2.jpg",
+      "http://47.113.95.226/res/shoes/share/069b6df74d6e4637a296ebc6280931b0.jpg",
+      "http://47.113.95.226/res/shoes/share/188ab172885044dead5a03941538e197.jpg",
+      "http://47.113.95.226/res/shoes/share/cf67cc513cb547dc954849cc3f32b59f.jpg",
+      "http://47.113.95.226/res/shoes/share/54c8e8d58a3442c9ad08618cb683a796.jpg"
     ];
     ];
+
     return Column(
     return Column(
       mainAxisSize: MainAxisSize.min,
       mainAxisSize: MainAxisSize.min,
       children: [
       children: [

+ 2 - 2
lib/pages/run/run_start.dart

@@ -47,8 +47,8 @@ import 'package:umeng_common_sdk/umeng_common_sdk.dart';
 
 
 import 'location.dart';
 import 'location.dart';
 
 
-const KEY_ANDROID = "f606b2f01de83ce2f9984680fa0f1897";
-const KEY_IOS = "4a8518eb97acf5d1998385907e24696a";
+const KEY_ANDROID = "1574fbae6a13523ea745b61be524d05c";
+const KEY_IOS = "949af229200e6a4d636aee0d9ea85415";
 const AMapPrivacyStatement amapPrivacyStatement = AMapPrivacyStatement(hasContains: true, hasShow: true, hasAgree: true);
 const AMapPrivacyStatement amapPrivacyStatement = AMapPrivacyStatement(hasContains: true, hasShow: true, hasAgree: true);
 
 
 class RunStartPage extends StatefulWidget {
 class RunStartPage extends StatefulWidget {

+ 25 - 2
plugin/shoes_sdk/ios/Classes/include/FingerGuessing.h

@@ -3,6 +3,12 @@
 
 
 #define RSSI_LEN 5
 #define RSSI_LEN 5
 
 
+struct motion_rssi {
+
+	int rssi;
+	int motion;
+};
+
 
 
 class FingerGuessing : public PublicSDKMotion
 class FingerGuessing : public PublicSDKMotion
 {
 {
@@ -15,11 +21,25 @@ public:
 	int ProcessDualStepVector(deque<shoes_data_cell>& left_cmd_step_data_vector, deque<shoes_data_cell> &right_cmd_step_data_vector,
 	int ProcessDualStepVector(deque<shoes_data_cell>& left_cmd_step_data_vector, deque<shoes_data_cell> &right_cmd_step_data_vector,
 		float* left_cmd_global_pos, float* right_cmd_global_pos , int rssi);
 		float* left_cmd_global_pos, float* right_cmd_global_pos , int rssi);
 
 
+	bool unzuptValid(int* max_acc, int* min_acc);
+
 	virtual void Process(int time_stamp, int* right_pos, int* right_att, int* right_acc, int right_zupt, int right_front_press, int right_back_press,
 	virtual void Process(int time_stamp, int* right_pos, int* right_att, int* right_acc, int right_zupt, int right_front_press, int right_back_press,
 		int* left_pos, int* left_att, int* left_acc, int left_zupt, int left_front_press, int left_back_press,
 		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 jump, int down, int rssi);
 
 
 private:
 private:
+	
+	deque<int> rssi_vec;
+	deque<int> pitch_vec;
+	deque<int> roll_vec;
+	deque<int> left_acc_vec;
+	deque<int> right_acc_vec;
+
+	int pitch_reference_val = 0;
+	int roll_reference_val = 0;
+
+	int has_init = 0;
+
 
 
 	deque<shoes_data_cell> left_shoes_data_vector;
 	deque<shoes_data_cell> left_shoes_data_vector;
 	deque<shoes_data_cell> right_shoes_data_vector;
 	deque<shoes_data_cell> right_shoes_data_vector;
@@ -40,7 +60,6 @@ private:
 	float left_step_pos[3];
 	float left_step_pos[3];
 	float right_step_pos[3];
 	float right_step_pos[3];
 
 
-
 	float left_heading;
 	float left_heading;
 	float right_heading;
 	float right_heading;
 
 
@@ -57,7 +76,11 @@ private:
 	int left_init;
 	int left_init;
 	int right_init;
 	int right_init;
 
 
+	int left_zupt_extension_time = 0;
+	int right_zupt_extension_time = 0;
+
+
+	const int rssi_threshold = 30;
 
 
-	const int rssi_threshold = 25;
 
 
 };
 };

+ 15 - 12
plugin/shoes_sdk/ios/Classes/include/JumpHouse.h

@@ -12,6 +12,17 @@ class JumpHouse : public PublicSDKMotion
 		bool unzuptValid(int* max_acc, int* min_acc);
 		bool unzuptValid(int* max_acc, int* min_acc);
 	private:
 	private:
 
 
+		deque<int> rssi_vec;
+		deque<int> pitch_vec;
+		deque<int> roll_vec;
+		deque<int> left_acc_vec;
+		deque<int> right_acc_vec;
+
+		int pitch_reference_val = 0;
+		int roll_reference_val = 0;
+
+		int has_init = 0;
+
 		deque<shoes_data_cell> left_shoes_data_vector;
 		deque<shoes_data_cell> left_shoes_data_vector;
 		deque<shoes_data_cell> right_shoes_data_vector;
 		deque<shoes_data_cell> right_shoes_data_vector;
 
 
@@ -21,20 +32,10 @@ class JumpHouse : public PublicSDKMotion
 		int left_acc_buff[3][3];
 		int left_acc_buff[3][3];
 		int right_acc_buff[3][3];
 		int right_acc_buff[3][3];
 
 
-		deque<int> left_back_press_vector;
-		deque<int> right_back_press_vector;
-
-		deque<int> left_front_press_vector;
-		deque<int> right_front_press_vector;
-
-		int left_press_valid = 0;
-		int right_press_valid = 0;
+		deque<int> left_acc_x_vector;
+		deque<int> right_acc_x_vector;
 
 
-		int left_back_press_offset;
-		int right_back_press_offset;
 
 
-		int left_back_press_detect_time;
-		int right_back_press_detect_time;
 
 
 		float left_heading;
 		float left_heading;
 		float right_heading;
 		float right_heading;
@@ -45,6 +46,8 @@ class JumpHouse : public PublicSDKMotion
 		int left_init;
 		int left_init;
 		int right_init;
 		int right_init;
 
 
+		int left_zupt_extension_time = 0;
+		int right_zupt_extension_time = 0;
 
 
 
 
 		const int rssi_threshold = 25;
 		const int rssi_threshold = 25;

+ 2 - 0
plugin/shoes_sdk/ios/Classes/include/TestGame.h

@@ -19,4 +19,6 @@ private:
 	 int jump_valid_time;
 	 int jump_valid_time;
 	 int jump_calm_down;
 	 int jump_calm_down;
 
 
+	 int last_jump;
+
 };
 };

+ 32 - 32
plugin/shoes_sdk/ios/Classes/include/pub.h

@@ -44,45 +44,45 @@ using namespace std;
 
 
 #define PRESS_MIN 41000
 #define PRESS_MIN 41000
 
 
-#define GAME_VERSION "0.5.64"
+#define GAME_VERSION "0.6.10"
 
 
 enum CMD_MOTION
 enum CMD_MOTION
 {
 {
     MOTION_STOP = 0,
     MOTION_STOP = 0,
-    MOTION_RUN, // 
-    MOTION_JUMP, // 
-    MOTION_DOWN, // 
-    MOTION_LEFT, // 滑左
-    MOTION_RIGHT, // 滑右
-    MOTION_FRONT, // 
-    MOTION_BACK, // 滑后
-    MOTION_LEFT_UP, // 点击-左上
-    MOTION_LEFT_DOWN, // 点击-左下
-    MOTION_RIGHT_UP, // 点击-右上
-    MOTION_RIGHT_DOWN, // 点击-右下
-    MOTION_STEP, // 点击-原地踩
-    MOTION_JUMP_OC, // 开合跳
-    MOTION_JUMP_VERTICAL, // 垂直跳
+    MOTION_RUN, // 锟斤拷
+    MOTION_JUMP, // 锟斤拷
+    MOTION_DOWN, // 锟斤拷
+    MOTION_LEFT, // 锟斤拷锟斤拷
+    MOTION_RIGHT, // 锟斤拷锟斤拷
+    MOTION_FRONT, // 锟斤拷
+    MOTION_BACK, // 锟斤拷锟斤拷
+    MOTION_LEFT_UP, // 锟斤拷锟�-锟斤拷锟斤拷
+    MOTION_LEFT_DOWN, // 锟斤拷锟�-锟斤拷锟斤拷
+    MOTION_RIGHT_UP, // 锟斤拷锟�-锟斤拷锟斤拷
+    MOTION_RIGHT_DOWN, // 锟斤拷锟�-锟斤拷锟斤拷
+    MOTION_STEP, // 锟斤拷锟�-原锟截诧拷
+    MOTION_JUMP_OC, // 锟斤拷锟斤拷锟斤拷
+    MOTION_JUMP_VERTICAL, // 锟斤拷直锟斤拷
     MOTION_ROCK, //石头
     MOTION_ROCK, //石头
-    MOTION_SCISSORS, //剪刀
-    MOTION_PAPER, //
+    MOTION_SCISSORS, //锟斤拷锟斤拷
+    MOTION_PAPER, //锟斤拷
 
 
-    MOTION_STRETCH_LEFT, //左伸腿
-    MOTION_LIFT_LEFT, //左抬腿
+    MOTION_STRETCH_LEFT, //锟斤拷锟斤拷锟斤拷
+    MOTION_LIFT_LEFT, //锟斤拷抬锟斤拷
 
 
-    MOTION_STRETCH_RIGHT, //右伸腿
-    MOTION_LIFT_RIGHT, //右抬腿
+    MOTION_STRETCH_RIGHT, //锟斤拷锟斤拷锟斤拷
+    MOTION_LIFT_RIGHT, //锟斤拷抬锟斤拷
 
 
     MOTION_STRETCH_FRONT_LEFT,
     MOTION_STRETCH_FRONT_LEFT,
     MOTION_STRETCH_FRONT_RIGHT,
     MOTION_STRETCH_FRONT_RIGHT,
 
 
-    MOTION_DOWN_FRONT, //踮脚蹲
+    MOTION_DOWN_FRONT, //锟节脚讹拷
 
 
-    MOTION_LEFT_ON_FLOOR,//左踩地
-    MOTION_RIGHT_ON_FLOOR, //右踩地
+    MOTION_LEFT_ON_FLOOR,//锟斤拷鹊锟�
+    MOTION_RIGHT_ON_FLOOR, //锟揭踩碉拷
 
 
-    MOTION_BOTH_ON_FLOOR_CLOSE, //合脚踩地
-    MOTION_BOTH_ON_FLOOR_OPEN, //岔开脚踩地
+    MOTION_BOTH_ON_FLOOR_CLOSE, //锟较脚踩碉拷
+    MOTION_BOTH_ON_FLOOR_OPEN, //锟斤拷锟脚踩碉拷
 
 
     NUMBERS_OF_MOTION,
     NUMBERS_OF_MOTION,
 
 
@@ -109,12 +109,12 @@ enum MOTION_COUNT_TYPE {
 enum CMD_INTERATION
 enum CMD_INTERATION
 {
 {
    NONE_INTERATION = 0,
    NONE_INTERATION = 0,
-   FRONT_LEFT,//左上键
-   FRONT_RIGHT,//右上键
-   BACK_LEFT,//左下键
-   BACK_RIGHT,//右下键
-   ENTER_KEY,//确认键
-   CANCLE_KEY,//取消键
+   FRONT_LEFT,//锟斤拷锟较硷拷
+   FRONT_RIGHT,//锟斤拷锟较硷拷
+   BACK_LEFT,//锟斤拷锟铰硷拷
+   BACK_RIGHT,//锟斤拷锟铰硷拷
+   ENTER_KEY,//确锟较硷拷
+   CANCLE_KEY,//取锟斤拷锟斤拷
 };
 };
 
 
 struct posData
 struct posData

+ 77 - 118
plugin/shoes_sdk/ios/Classes/src/Aerobics.cpp

@@ -1,5 +1,5 @@
 #include "Aerobics.h"
 #include "Aerobics.h"
-//踢馆大
+//锟竭馆达拷
 
 
 Aerobics::Aerobics()
 Aerobics::Aerobics()
 {
 {
@@ -56,15 +56,6 @@ void Aerobics::Process(int time_stamp, int* right_pos, int* right_att, int* righ
 	calGlobalPos(left_shoes_data_vector, left_step_data_vector, left_global_pos, left_shoes_data_vector[0].heading, -10.0f / 180 * PI, LEFT_FOOT);
 	calGlobalPos(left_shoes_data_vector, left_step_data_vector, left_global_pos, left_shoes_data_vector[0].heading, -10.0f / 180 * PI, LEFT_FOOT);
 
 
 
 
-	// 额外处理蹲
-	/*if (extract_motion.online_detect_down(right_front_press, left_front_press, right_back_press, left_back_press,
-		right_acc, left_acc) & 0x01)*/
-
-	down = 0;
-
-	down = extract_motion.online_detect_down(right_front_press, left_front_press, right_back_press, left_back_press,
-		right_acc, left_acc);
-
 	if (left_shoes_data_vector.size() == 1 && left_shoes_data_vector.back().zupt)
 	if (left_shoes_data_vector.size() == 1 && left_shoes_data_vector.back().zupt)
 	{
 	{
 		memset(left_global_pos, 0, 3 * sizeof(float));
 		memset(left_global_pos, 0, 3 * sizeof(float));
@@ -75,16 +66,18 @@ void Aerobics::Process(int time_stamp, int* right_pos, int* right_att, int* righ
 		memset(right_global_pos, 0, 3 * sizeof(float));
 		memset(right_global_pos, 0, 3 * sizeof(float));
 	}
 	}
 
 
+	//static int time_count;
+	//std::cout << time_count++ << std::endl;
+	//锟斤拷锟矫碉拷锟脚的匡拷锟斤拷锟斤拷锟斤拷状态锟斤拷使锟斤拷锟斤拷锟斤拷锟节匡拷锟斤拷只锟叫讹拷一锟轿o拷锟斤拷锟斤拷锟节达拷锟截诧拷锟杰达拷锟斤拷锟斤拷锟斤拷锟筋。
 
 
-	//设置单脚的空中命令状态,使得命令在空中只判断一次,区别于触地才能触发的命令。
-
-	//如果触发了抬脚命令,那么触地的时候,将不会触发下端,用一个禁止下蹲倒计来计时
+	//锟斤拷锟斤拷锟斤拷锟斤拷锟教э拷锟斤拷锟斤拷睿�拷锟矫达拷锟斤拷氐锟绞憋拷颍�锟斤拷锟斤拷岽ワ拷锟斤拷露耍锟斤拷锟揭伙拷锟斤拷锟街癸拷露椎锟斤拷锟斤拷锟斤拷锟绞�
 	/*if ((left_step_data_vector.size() > 1 && left_step_data_vector.front().zupt == 1 && left_step_data_vector.back().zupt == 1 && lift_left_status == 0)
 	/*if ((left_step_data_vector.size() > 1 && left_step_data_vector.front().zupt == 1 && left_step_data_vector.back().zupt == 1 && lift_left_status == 0)
 		||(right_step_data_vector.size() > 1 && right_step_data_vector.front().zupt == 1 && right_step_data_vector.back().zupt == 1 && lift_right_status == 0))
 		||(right_step_data_vector.size() > 1 && right_step_data_vector.front().zupt == 1 && right_step_data_vector.back().zupt == 1 && lift_right_status == 0))
 	{
 	{
 		ResetDenyDownTime(time_stamp);
 		ResetDenyDownTime(time_stamp);
 	}*/
 	}*/
 
 
+
 	if (left_zupt)
 	if (left_zupt)
 	{
 	{
 		stretch_left_status = 1;
 		stretch_left_status = 1;
@@ -103,6 +96,21 @@ void Aerobics::Process(int time_stamp, int* right_pos, int* right_att, int* righ
 		lift_right_status = 1;
 		lift_right_status = 1;
 	}
 	}
 
 
+	if (last_down == 0 && down != 0)
+	{
+		addMotionCount(DOWN_COUNT);
+
+		std::cout << "normal down motion" << endl;
+		result[0] = MOTION_DOWN;
+
+		stretch_front_right_status = 0;
+		lift_right_status = 0;
+
+		stretch_front_left_status = 0;
+		lift_left_status = 0;
+
+	}
+
 	if (left_step_data_vector.size() > 1 && left_step_data_vector.front().zupt == 1 && left_step_data_vector.back().zupt == 0)
 	if (left_step_data_vector.size() > 1 && left_step_data_vector.front().zupt == 1 && left_step_data_vector.back().zupt == 0)
 	{
 	{
 		setResult(left_step_data_vector, LEFT_FOOT);
 		setResult(left_step_data_vector, LEFT_FOOT);
@@ -117,8 +125,8 @@ void Aerobics::Process(int time_stamp, int* right_pos, int* right_att, int* righ
 
 
 
 
 
 
-	//会有多个蹲命令触发
-	//在这个游戏单独处理蹲
+	//锟斤拷锟叫讹拷锟斤拷锟斤拷锟斤拷畲ワ拷锟�
+	//锟斤拷锟斤拷锟斤拷锟较凤拷锟斤拷锟斤拷锟斤拷锟斤拷
 	left_acc_deque.push_back(sqrt(left_acc[0] * left_acc[0] + left_acc[1] * left_acc[1]));
 	left_acc_deque.push_back(sqrt(left_acc[0] * left_acc[0] + left_acc[1] * left_acc[1]));
 	right_acc_deque.push_back(sqrt(right_acc[0] * right_acc[0] + right_acc[1] * right_acc[1]));
 	right_acc_deque.push_back(sqrt(right_acc[0] * right_acc[0] + right_acc[1] * right_acc[1]));
 
 
@@ -146,63 +154,9 @@ void Aerobics::Process(int time_stamp, int* right_pos, int* right_att, int* righ
 	//std::cout << "time_stamp : " << time_stamp << endl;
 	//std::cout << "time_stamp : " << time_stamp << endl;
 	//if (last_down == 0 && down == 1 && isValidDown(time_stamp))
 	//if (last_down == 0 && down == 1 && isValidDown(time_stamp))
 	//if (last_down == 0 && down != 0 && wait_down == 0 && deny_down_time == 0)
 	//if (last_down == 0 && down != 0 && wait_down == 0 && deny_down_time == 0)
-	if (last_down == 0 && down != 0 && deny_down_time == 0)
-	{
-		/*if (down & 0x04)
-		{
-			addMotionCount(DOWN_COUNT);
-
-			std::cout << "normal down motion" << endl;
-			result[0] = MOTION_DOWN;
-			wait_down = 0;
-			deny_down_time = 20;
-		}
-		else*/
-		if(wait_down == 0 && deny_down_time == 0)
-		{
-			wait_down = 10;
-			deny_down_time = 20;
-		}
-
-		
-	}
-
-	if (wait_down == 1 && acc_valid == 1)
-	//if (wait_down == 1 )
-	//if(down)
-	{
-		addMotionCount(DOWN_COUNT);
-
-		std::cout << "normal down motion" << endl;
-		result[0] = MOTION_DOWN;
-
-		deny_down_time = 20;
-	}
-
-	if (wait_down > 0)
-	{
-		wait_down--;
-	}
 
 
-	if (deny_down_time > 0 && down == 0)
-	{
-		deny_down_time--;
-	}
-	
-	//判断踮脚蹲
-	if (left_att[1] * 0.0001f > 0.1f && right_att[1] * 0.0001f > 0.1f && down == 1)
-	{
-		special_down = 1;
-
-	}
-	else
-	{
-		special_down = 0;
-	}
 
 
 
 
-	last_special_down = special_down;
-
 	last_down = down;
 	last_down = down;
 
 
 	if (left_step_data_vector.size() > 1 && left_step_data_vector.front().zupt == 1 && left_step_data_vector.back().zupt == 1 &&
 	if (left_step_data_vector.size() > 1 && left_step_data_vector.front().zupt == 1 && left_step_data_vector.back().zupt == 1 &&
@@ -223,10 +177,10 @@ void Aerobics::Process(int time_stamp, int* right_pos, int* right_att, int* righ
 
 
 void Aerobics::setResult(deque<shoes_data_cell>& step_data_vector,int LEFT_OR_RIGHT)
 void Aerobics::setResult(deque<shoes_data_cell>& step_data_vector,int LEFT_OR_RIGHT)
 {
 {
-	// 描绘空中轨迹
-	//其实可以实时检测到轨迹是否符合触发命令的,但是为了方便代码简单,就在触地的瞬间来触发命令检测流程算了
-	//1、先检测到Z轴的轨迹向量是否大于10cm, 大于就会触发判断命令了
-	//2、 同时在同一个循环里,判断最大的平面(X,Y)的点在哪里
+	// 锟斤拷锟斤拷锟叫轨迹
+	//锟斤拷实锟斤拷锟斤拷实时锟斤拷獾斤拷旒o拷欠锟斤拷锟较达拷锟斤拷锟斤拷锟斤拷模锟斤拷锟斤拷锟轿�拷朔锟斤拷锟斤拷锟斤拷虻ィ锟斤拷锟斤拷诖锟斤拷氐锟剿诧拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟�
+	//1锟斤拷锟饺硷拷獾絑锟斤拷墓旒o拷锟斤拷锟斤拷欠锟斤拷锟斤拷10cm, 锟斤拷锟节就会触锟斤拷锟叫讹拷锟斤拷锟斤拷锟斤拷
+	//2锟斤拷 同时锟斤拷同一锟斤拷循锟斤拷锟斤,锟叫讹拷锟斤拷锟斤拷平锟芥(X,Y锟斤拷锟侥碉拷锟斤拷锟斤拷锟斤拷
 
 
 	float high = step_data_vector.back().pos_z;
 	float high = step_data_vector.back().pos_z;
 
 
@@ -237,65 +191,70 @@ void Aerobics::setResult(deque<shoes_data_cell>& step_data_vector,int LEFT_OR_RI
 
 
 	float roll  = step_data_vector.back().roll;
 	float roll  = step_data_vector.back().roll;
 
 
-	//暂时先将抬脚的高度阈值为0.1m, 伸脚的距离设置为0.2m
-	if (high > high_thresh && plane_length > 0.2)
-	{
-		if (LEFT_OR_RIGHT == LEFT_FOOT && stretch_left_status == 1 && roll > -2.9f && roll < 0.0f)
-		{
-			std::cout << "MOTION_STRETCH_LEFT" << endl;
-			result[0] = MOTION_STRETCH_LEFT;
-			stretch_left_status = 0;
-			lift_left_status = 0;
-		}
-		else if(LEFT_OR_RIGHT == RIGHT_FOOT && stretch_right_status == 1 && roll > 0.0f && roll < 2.9f)
-		{
-			std::cout << "MOTION_STRETCH_RIGHT" << endl;
-			result[0] = MOTION_STRETCH_RIGHT;
-			stretch_right_status = 0;
-			lift_right_status = 0;
-		}
+	//锟斤拷时锟饺斤拷抬锟脚的高讹拷锟斤拷值为0.1m, 锟斤拷诺木锟斤拷锟斤拷锟斤拷锟轿�0.2m
 
 
-		if (LEFT_OR_RIGHT == LEFT_FOOT && stretch_front_left_status == 1
-			&& step_data_vector.back().pos_y > 0.2f)
-		{
-			std::cout << "MOTION_STRETCH_FRONT_LEFT" << endl;
-			result[0] = MOTION_STRETCH_FRONT_LEFT;
-			stretch_front_left_status = 0;
-			lift_left_status = 0;
-		}
-		else if (LEFT_OR_RIGHT == RIGHT_FOOT && stretch_front_right_status == 1 
-			&& step_data_vector.back().pos_y > 0.2f)
-		{
-			std::cout << "MOTION_STRETCH_FRONT_RIGHT" << endl;
-			result[0] = MOTION_STRETCH_FRONT_RIGHT;
-			stretch_front_right_status = 0;
-			lift_right_status = 0;
-		}
+		//if (LEFT_OR_RIGHT == LEFT_FOOT && stretch_left_status == 1 && roll > -2.9f && roll < 0.0f)
+	if (LEFT_OR_RIGHT == LEFT_FOOT && stretch_left_status == 1 && roll > 1.8f &&  pitch > -0.4f)
+	{
+		std::cout << "MOTION_STRETCH_LEFT : " << "锟斤拷锟斤拷锟�"<< endl;
+		result[0] = MOTION_STRETCH_LEFT;
+		stretch_left_status = 0;
+		lift_left_status = 0;
+		stretch_front_left_status = 0;
+	}
+	else if(LEFT_OR_RIGHT == RIGHT_FOOT && stretch_right_status == 1 && roll > 1.8f && pitch > -0.4f)
+	{
+		std::cout << "MOTION_STRETCH_RIGHT: " << "锟揭诧拷锟斤拷" << endl;
+		result[0] = MOTION_STRETCH_RIGHT;
+		stretch_right_status = 0;
+		lift_right_status = 0;
+		stretch_front_right_status = 0;
+	}
 
 
+	else if (LEFT_OR_RIGHT == LEFT_FOOT && stretch_front_left_status == 1
+		&& pitch < -0.4f)
+	{
+		std::cout << "MOTION_STRETCH_FRONT_LEFT: " << "锟斤拷前锟斤拷" << endl;
+		result[0] = MOTION_STRETCH_FRONT_LEFT;
+		stretch_front_left_status = 0;
+		lift_left_status = 0;
 	}
 	}
-	else if (high > high_thresh && plane_length < 0.2f)
+	else if (LEFT_OR_RIGHT == RIGHT_FOOT && stretch_front_right_status == 1 
+		&& pitch < -0.4f)
+	{
+		std::cout << "MOTION_STRETCH_FRONT_RIGHT" << "锟斤拷前锟斤拷" << endl;
+		result[0] = MOTION_STRETCH_FRONT_RIGHT;
+		stretch_front_right_status = 0;
+		lift_right_status = 0;
+	}
+
+	else if (fabs(high) > high_thresh && plane_length < 0.2f && pitch > 0.3f)
 	{
 	{
 		if (LEFT_OR_RIGHT == LEFT_FOOT && lift_left_status == 1)
 		if (LEFT_OR_RIGHT == LEFT_FOOT && lift_left_status == 1)
 		{
 		{
-			std::cout << "MOTION_LIFT_LEFT" << endl;
+			std::cout << "MOTION_LIFT_LEFT " << "锟斤拷抬锟斤拷" << endl;
 			result[0] = MOTION_LIFT_LEFT;
 			result[0] = MOTION_LIFT_LEFT;
 			lift_left_status = 0;
 			lift_left_status = 0;
 		}
 		}
 		else if (LEFT_OR_RIGHT == RIGHT_FOOT && lift_right_status == 1)
 		else if (LEFT_OR_RIGHT == RIGHT_FOOT && lift_right_status == 1)
 		{
 		{
-			std::cout << "MOTION_LIFT_RIGHT" << endl;
+			std::cout << "MOTION_LIFT_RIGHT " << "锟斤拷抬锟斤拷" << endl;
 			result[0] = MOTION_LIFT_RIGHT;
 			result[0] = MOTION_LIFT_RIGHT;
 			lift_right_status = 0;
 			lift_right_status = 0;
 		}
 		}
 	}
 	}
 
 
-	/*if (plane_length > 0.2)
-	{
-		std::cout << "test : plane_length > 0.2" << endl;
-	}
-
-	if (high > high_thresh)
-	{
-		std::cout << "high > high_thresh" << endl;
-	}*/
+//	if (plane_length > 0.2)
+//	{
+//		if (LEFT_OR_RIGHT == RIGHT_FOOT)
+//		{
+//			std::cout << "step_data_vector.back().pos_y : " << step_data_vector.back().pos_y << std::endl;
+//		}
+//		std::cout << "test : plane_length > 0.2" << endl;
+//	}
+//
+//	if (high > high_thresh)
+//	{
+//		std::cout << "high > high_thresh" << endl;
+//	}
 }
 }

+ 5 - 225
plugin/shoes_sdk/ios/Classes/src/BuildHouse.cpp

@@ -45,7 +45,7 @@ bool isValidAcc(deque<dualAccData>& dual_acc, int start_index,  int thresh_hold)
 
 
 void detect_cancave_curve_top(deque<int>& dual_press_back, int& max_index, int& right_size_index, int& left_size_index)
 void detect_cancave_curve_top(deque<int>& dual_press_back, int& max_index, int& right_size_index, int& left_size_index)
 {
 {
-	//1、寻找最小值
+	//1锟斤拷寻锟斤拷锟斤拷小值
 	int k = dual_press_back.size() - 1;
 	int k = dual_press_back.size() - 1;
 
 
 	right_size_index = k;
 	right_size_index = k;
@@ -148,241 +148,21 @@ 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* 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 jump, int down, int rssi)
 {
 {
+	result[0] = -1;
 
 
-	int sdk_down = 0;
-	int front_down = 0;
-
-	result[0] = 0;
-
-	//加速度窗口
-	dual_acc.push_back({ left_acc[2], right_acc[2] });
-
-	//滑动窗口补充
-	left_press_filter_window.push_back(left_back_press);
-	right_press_filter_window.push_back(right_back_press);
-
-	//采用最小值滤波, 较好的过滤毛刺
-	if (left_press_filter_window.size() > 5)
-	{
-		left_press_filter_window.pop_front();
-		right_press_filter_window.pop_front();
-
-		left_back_press = mid_window_val(left_press_filter_window, 5);
-		right_back_press = mid_window_val(right_press_filter_window, 5);
-
-	}
-
-
-
-
-	left_front_press_queue.push_back(left_front_press); left_back_press_queue.push_back(left_back_press);
-	right_front_press_queue.push_back(right_front_press); right_back_press_queue.push_back(right_back_press);
-
-	if (left_back_press_queue.size() > 40)
-	{
-		left_back_press_queue.pop_front(); right_back_press_queue.pop_front();
-	}
-
-	if (left_front_press_queue.size() > 40)
-	{
-		left_front_press_queue.pop_front(); right_front_press_queue.pop_front();
-	}
-
-	if (dual_acc.size() > 10)
-	{
-		dual_acc.pop_front();
-	}
-
-
-	if (left_front_press_queue.size() == 40)
-	{
-		/*
-		*  检测到前脚压力双脚都呈现了凸曲线,那么判断为前脚下蹲
-		*  还要检测双凸曲线的顶点,如果还处于上一个双凸曲线的有效时间内,则顶点值需要大于上一个双凸曲线,才能判断有效的双凸曲线
-		*/
-
-		int left_max_index, left_foot_right_side_index, left_foot_left_side_index;
-
-		detect_cancave_curve_top(left_front_press_queue, left_max_index, left_foot_right_side_index, left_foot_left_side_index);
-
-		int right_max_index, right_foot_right_side_index, right_foot_left_side_index;
-		
-		detect_cancave_curve_top(right_front_press_queue, right_max_index, right_foot_right_side_index, right_foot_left_side_index);
-
-		int left_dist = 1000, right_dist = 1000;
-
-		if (wait_press_top_unvalid > 0)
-		{
-			left_dist = max(left_dist, left_front_press_top);
-			right_dist = max(right_dist, right_front_press_top);
-		}
-
-		bool acc_valid = isValidAcc(dual_acc, 0, 512);
-		//检测到前脚压力双脚都呈现了凸曲线,那么判断为前脚下蹲
-		if (abs(left_max_index - right_max_index) < 6 &&
-			right_front_press_queue[right_foot_right_side_index] - right_front_press_queue[right_max_index] < -right_dist
-			&& right_front_press_queue[right_foot_left_side_index] - right_front_press_queue[right_max_index] < -right_dist
-			&& left_front_press_queue[left_foot_right_side_index] - left_front_press_queue[left_max_index] < -left_dist
-			&& left_front_press_queue[left_foot_left_side_index] - left_front_press_queue[left_max_index] < -left_dist
-			&& right_foot_right_side_index - right_foot_left_side_index < 31
-			&& left_foot_right_side_index - left_foot_left_side_index < 31
-			&& acc_valid
-			//&& abs(dual_press_front[right_max_index].right_press - dual_press_front[left_max_index].left_press) < 8000//经验值
-			)
-		{
-			// 还要检测双凸曲线的顶点,如果还处于上一个双凸曲线的有效时间内,则顶点值与左右的差值需要大于上一个双凸曲线,才能判断有效的双凸曲线
-			// 记录上一个双凸曲线的差值
-			if (right_front_press_queue[right_foot_right_side_index] - right_front_press_queue[right_max_index] < -1000
-				&& right_front_press_queue[right_foot_left_side_index] - right_front_press_queue[right_max_index] < -1000
-				&& left_front_press_queue[left_foot_right_side_index] - left_front_press_queue[left_max_index] < -1000
-				&& left_front_press_queue[left_foot_left_side_index] - left_front_press_queue[left_max_index] < -1000)
-			{
-				int right_dist = right_front_press_queue[right_max_index] - right_front_press_queue[right_foot_right_side_index];
-
-				right_dist = min(right_dist, right_front_press_queue[right_max_index] - right_front_press_queue[right_foot_left_side_index]);
-
-				//right_front_press_top = dual_press_front[right_max_index].right_press - 0.5 * right_dist;
-				right_front_press_top = 0.5 * right_dist;
-
-				int left_dist = left_front_press_queue[left_max_index] - left_front_press_queue[left_foot_right_side_index];
-
-				left_dist = min(left_dist, left_front_press_queue[left_max_index] - left_front_press_queue[left_foot_left_side_index]);
-
-				//left_front_press_top = dual_press_front[left_max_index].left_press - 0.5 * left_dist;
-				left_front_press_top =  0.5 * left_dist;
-
-				wait_press_top_unvalid = 60;
-
-			}
-
-			front_down = 1;
-		}
-
-		if ( left_front_press_queue[left_foot_right_side_index] - left_front_press_queue[left_max_index] < -2000
-			&& right_front_press_queue[right_foot_right_side_index] - right_front_press_queue[right_max_index] < -2000
-			&& left_foot_right_side_index - left_max_index < 30 && right_foot_right_side_index - right_max_index < 30
-			)
-		{
-
-			int right_dist = right_front_press_queue[right_max_index] - right_front_press_queue[right_foot_right_side_index];
-
-			right_dist = min(right_dist, right_front_press_queue[right_max_index] - right_front_press_queue[right_foot_left_side_index]);
-
-			//right_front_press_top = dual_press_front[right_max_index].right_press - 0.5 * right_dist;
-			right_front_press_top = 0.5 * right_dist;
-
-			int left_dist = left_front_press_queue[left_max_index] - left_front_press_queue[left_foot_right_side_index];
-
-			left_dist = min(left_dist, left_front_press_queue[left_max_index] - left_front_press_queue[left_foot_left_side_index]);
-
-			//left_front_press_top = dual_press_front[left_max_index].left_press - 0.5 * left_dist;
-			left_front_press_top = 0.5 * left_dist;
-
-			wait_press_top_unvalid = 60;
-
-			front_down = 1;
-		}
-
-	}
-
-	int back_down = 0;
-	if (left_back_press_queue.size()>=20 )
-	{
-		 back_down = back_press_up_trend(left_back_press_queue, right_back_press_queue);
-
-		if (back_down)
-		{
-			//记录最大值
-			if (wait_back_press_top_unvalid == 0)
-			{
-				wait_back_press_top_unvalid = 60;
-
-				left_back_press_top = left_back_press_queue.back();
-				right_back_press_top = right_back_press_queue.back();
-
-			}
-			else
-			{
-				if (left_back_press_top > left_back_press_queue.back() || right_back_press_top > right_back_press_queue.back())
-				{
-					back_down = 0;
-				}
-				else
-				{
-					wait_back_press_top_unvalid = 60;
-
-					left_back_press_top = left_back_press_queue.back();
-					right_back_press_top = right_back_press_queue.back();
-				}
-			}
-		}
-
-		//int left_max_index, left_foot_right_side_index, left_foot_left_side_index;
-
-		//detect_cancave_curve_top(left_back_press_queue, left_max_index, left_foot_right_side_index, left_foot_left_side_index);
-
-		//int right_max_index, right_foot_right_side_index, right_foot_left_side_index;
-
-		//detect_cancave_curve_top(right_back_press_queue, right_max_index, right_foot_right_side_index, right_foot_left_side_index);
-
-
-		//int special_down = 0;
-
-		////同样的检测双凹曲线,但是这个曲线应当为√曲线,左低右高
-		//if (
-		//	abs(left_max_index - right_max_index) < 11 &&
-		//	right_back_press_queue[right_foot_right_side_index] - right_back_press_queue[right_max_index] < -1500
-		//	&& right_back_press_queue[right_foot_left_side_index] - right_back_press_queue[right_max_index] < -1500
-		//	&& left_back_press_queue[left_foot_right_side_index] - left_back_press_queue[left_max_index] < -1500
-		//	&& left_back_press_queue[left_foot_left_side_index] - left_back_press_queue[left_max_index] < -1500
-		//	&& right_back_press_queue[right_max_index] > 12000 && left_back_press_queue[left_max_index] > 12000
-		//	)
-		//{
-		//	back_down = 1;
-		//}
-
-	}
-	if (wait_back_press_top_unvalid > 0)
-	{
-		wait_back_press_top_unvalid--;
-	}
-
-
-
-
-	if (wait_press_top_unvalid > 0)
-	{
-		back_down = 0;
-	}
-
-	if (wait_press_top_unvalid > 0)
-	{
-		wait_press_top_unvalid--;
-	}
-
-	if ((front_down == 1 || back_down == 1) && (last_down == 0 && last_front_down == 0) && cmd_wait_time == 0)
+	if (last_down == 0 && down == 1)
 	//if((front_down == 1 || back_down == 1))
 	//if((front_down == 1 || back_down == 1))
 	{
 	{
 		result[0] = MOTION_DOWN;
 		result[0] = MOTION_DOWN;
 
 
 		addMotionCount(DOWN_COUNT);
 		addMotionCount(DOWN_COUNT);
 
 
-		cmd_wait_time = 20;
+		std::cout << "BuidHouse : Down" << endl;
 	}
 	}
 
 
-	//处于蹲的倒计时,倒计时就不要工作了
-	if (!(front_down == 1 || back_down == 1) && cmd_wait_time > 0)
-	{
-		cmd_wait_time--;
-
-	}
 
 
-	last_down = back_down;
 
 
-	last_front_down = front_down;
+	last_down = down;
 
 
 
 
-	//result[1] = left_back_press;
-	//result[2] = right_back_press;
-	
 }
 }

+ 2 - 32
plugin/shoes_sdk/ios/Classes/src/CutCake.cpp

@@ -16,42 +16,12 @@ void CutCake::Process(int time_stamp, int* right_pos, int* right_att, int* right
 
 
 	result[0] = -1;
 	result[0] = -1;
 
 
-	if (left_acc_deque.size() > 10)
-	{
-		left_acc_deque.pop_front();
-		right_acc_deque.pop_front();
-	}
-
-	left_acc_deque.push_back(left_acc[2]);
-	right_acc_deque.push_back(right_acc[2]);
-
-	int max_left_acc = *(std::max_element(left_acc_deque.begin(), left_acc_deque.end()));
-	int max_right_acc = *(std::max_element(right_acc_deque.begin(), right_acc_deque.end()));
-
-
-	if (jump_calm_down == 0 && max_left_acc - left_acc[2] > 2048 && max_right_acc - right_acc[2] > 2048
-		&& max_left_acc > 3096 && max_right_acc > 3096 && left_acc[2] < 1024 && right_acc[2] < 1024 &&
-		left_acc_deque.front() > 1500 && right_acc_deque.front() > 1500)
-	{
-
-		jump = 1;
-		//result[0] = MOTION_JUMP;
-		left_acc_deque.clear();
-		right_acc_deque.clear();
-
-		jump_calm_down = 15;
-	}
-
-
-	if (jump_calm_down > 0)
-	{
-		jump_calm_down--;
-	}
-
 	if (last_jump == 0 && jump == 1)
 	if (last_jump == 0 && jump == 1)
 	{
 	{
 		result[0] = MOTION_JUMP;
 		result[0] = MOTION_JUMP;
 		addMotionCount(JUMP_COUNT);
 		addMotionCount(JUMP_COUNT);
+
+		std::cout << "CutCake: jump" << endl;
 	}
 	}
 
 
 	last_jump = jump;
 	last_jump = jump;

+ 168 - 121
plugin/shoes_sdk/ios/Classes/src/FingerGuessing.cpp

@@ -1,5 +1,7 @@
 #include "FingerGuessing.h"
 #include "FingerGuessing.h"
 
 
+#
+
 FingerGuessing::FingerGuessing()
 FingerGuessing::FingerGuessing()
 {
 {
 	left_foot_has_init = 0;
 	left_foot_has_init = 0;
@@ -21,7 +23,7 @@ FingerGuessing::FingerGuessing()
 	left_init = 0;
 	left_init = 0;
 	right_init = 0;
 	right_init = 0;
 
 
-	//原
+	//原锟斤拷
 	left_global_pos_vector.push_back({ 0, 0, 0, 0 });
 	left_global_pos_vector.push_back({ 0, 0, 0, 0 });
 	right_global_pos_vector.push_back({ 0, 0, 0, 0 });
 	right_global_pos_vector.push_back({ 0, 0, 0, 0 });
 
 
@@ -46,7 +48,7 @@ void FingerGuessing::ProcessResult(float* global_pos, deque<shoes_data_cell>& st
 		std::cout << "FingerGuessing::ProcessResult" << endl;
 		std::cout << "FingerGuessing::ProcessResult" << endl;
 		std::cout << endl;
 		std::cout << endl;
 
 
-		//寻找到距离最小的
+		//寻锟揭碉拷锟斤拷锟斤拷锟斤拷小锟斤拷
 		int vector_length = global_pos_vector.size();
 		int vector_length = global_pos_vector.size();
 
 
 		float distance_point = 0.05f;
 		float distance_point = 0.05f;
@@ -56,7 +58,7 @@ void FingerGuessing::ProcessResult(float* global_pos, deque<shoes_data_cell>& st
 
 
 		for (int i = 0; i < vector_length; i++)
 		for (int i = 0; i < vector_length; i++)
 		{
 		{
-			//回溯寻找曾经踩过的点
+			//锟斤拷锟斤拷寻锟斤拷锟斤拷锟斤拷锟饺癸拷锟侥碉拷
 			float dx = global_pos[0] - global_pos_vector.at(i).pos_x;
 			float dx = global_pos[0] - global_pos_vector.at(i).pos_x;
 			float dy = global_pos[1] - global_pos_vector.at(i).pos_y;
 			float dy = global_pos[1] - global_pos_vector.at(i).pos_y;
 
 
@@ -72,7 +74,7 @@ void FingerGuessing::ProcessResult(float* global_pos, deque<shoes_data_cell>& st
 				distance_point = distance_temp;
 				distance_point = distance_temp;
 
 
 			}
 			}
-			else if (i != 0  && distance_temp < distance_point)
+			else if (i != 0 && distance_temp < distance_point)
 			{
 			{
 
 
 				index = i;
 				index = i;
@@ -86,8 +88,8 @@ void FingerGuessing::ProcessResult(float* global_pos, deque<shoes_data_cell>& st
 		if (index == -1)
 		if (index == -1)
 		{
 		{
 			std::cout << "no find similar point" << endl;
 			std::cout << "no find similar point" << endl;
-			//没有找到基准点的时候,检测到往返点的时候,再做判断
-			//当检测到接近原点的时候,应当设置为0
+			//没锟斤拷锟揭碉拷锟斤拷准锟斤拷锟绞憋拷颍�锟解到锟斤拷锟斤拷锟斤拷锟绞憋拷锟�,锟斤拷锟斤拷锟叫讹拷
+			//锟斤拷锟斤拷獾斤拷咏锟皆�拷锟斤拷时锟斤拷应锟斤拷锟斤拷锟斤拷为0
 
 
 			global_pos_vector.push_back({ 0, global_pos[0], global_pos[1],global_pos[2] });
 			global_pos_vector.push_back({ 0, global_pos[0], global_pos[1],global_pos[2] });
 
 
@@ -121,7 +123,7 @@ void FingerGuessing::ProcessResult(float* global_pos, deque<shoes_data_cell>& st
 
 
 	}
 	}
 
 
-	//为了防止误触点,用五个触地点来测试
+	//为锟剿凤拷止锟襟触点,锟斤拷锟斤拷锟斤拷锟斤拷氐锟斤拷锟斤拷锟斤拷锟�
 
 
 }
 }
 
 
@@ -144,7 +146,7 @@ int FingerGuessing::ProcessDualStepVector(deque<shoes_data_cell>& left_cmd_step_
 		return -1;
 		return -1;
 	}
 	}
 
 
-	//还是判断拳头
+	//锟斤拷锟斤拷锟叫讹拷拳头
 
 
 	if (rssi > 30)
 	if (rssi > 30)
 	{
 	{
@@ -152,39 +154,48 @@ int FingerGuessing::ProcessDualStepVector(deque<shoes_data_cell>& left_cmd_step_
 		float dx = right_dx - left_dx;
 		float dx = right_dx - left_dx;
 		float dy = right_dy - left_dy;
 		float dy = right_dy - left_dy;
 
 
-			if (right_dx - left_dx > 0.3f)
-			{
-				left_cmd_global_pos[0] = -0.25f; left_cmd_global_pos[1] = 0.0f;
-				right_cmd_global_pos[0] = 0.25f; right_cmd_global_pos[1] = 0.0f;
-
-				return MOTION_PAPER;
-			}
+		if (right_dx - left_dx > 0.3f)
+		{
+			left_cmd_global_pos[0] = -0.25f; left_cmd_global_pos[1] = 0.0f;
+			right_cmd_global_pos[0] = 0.25f; right_cmd_global_pos[1] = 0.0f;
 
 
-			//判断剪刀有点麻烦
-			if (right_dx - left_dx < -0.3f)
-			{
+			return MOTION_PAPER;
+		}
 
 
-				if (left_dy - right_dy < -0.3f)
-				{
-					left_cmd_global_pos[0] = 0.0f; left_cmd_global_pos[1] = -0.15f;
-					right_cmd_global_pos[0] = 0.0f; right_cmd_global_pos[1] = 0.15f;
-					return MOTION_SCISSORS;
-				}
+		//锟叫断硷拷锟斤拷锟叫碉拷锟介烦
+		if (right_dx - left_dx < -0.3f)
+		{
 
 
-				if (left_dy - right_dy > 0.3f)
-				{
-					left_cmd_global_pos[0] = 0.0f; left_cmd_global_pos[1] = 0.15f;
-					right_cmd_global_pos[0] = 0.0f; right_cmd_global_pos[1] = -0.15f;
-					return MOTION_SCISSORS;
-				}
+			if (left_dy - right_dy < -0.3f)
+			{
+				left_cmd_global_pos[0] = 0.0f; left_cmd_global_pos[1] = -0.15f;
+				right_cmd_global_pos[0] = 0.0f; right_cmd_global_pos[1] = 0.15f;
+				return MOTION_SCISSORS;
+			}
 
 
+			if (left_dy - right_dy > 0.3f)
+			{
+				left_cmd_global_pos[0] = 0.0f; left_cmd_global_pos[1] = 0.15f;
+				right_cmd_global_pos[0] = 0.0f; right_cmd_global_pos[1] = -0.15f;
+				return MOTION_SCISSORS;
 			}
 			}
+
+		}
 	}
 	}
 
 
-	
+
 	return -1;
 	return -1;
 }
 }
 
 
+bool FingerGuessing::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))
+	{
+		return true;
+	}
+
+	return false;
+}
 
 
 
 
 void FingerGuessing::Process(int time_stamp, int* right_pos, int* right_att, int* right_acc, int right_zupt, int right_front_press, int right_back_press,
 void FingerGuessing::Process(int time_stamp, int* right_pos, int* right_att, int* right_acc, int right_zupt, int right_front_press, int right_back_press,
@@ -192,51 +203,125 @@ void FingerGuessing::Process(int time_stamp, int* right_pos, int* right_att, int
 	int jump, int down, int rssi)
 	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);
+	//锟斤拷锟节刚达拷锟截碉拷时锟斤拷,锟斤拷偶锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟脚号的关硷拷帧锟斤拷锟斤拷锟斤拷锟斤拷锟竭诧拷锟斤拷一锟斤拷
+
+	//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;
+	//}
 
 
-	if (online_zupt & 0x01)
+	if (has_init == 0)
+	{
+		rssi_vec.push_back(rssi);
+		pitch_vec.push_back(left_att[1] - right_att[1]);
+		roll_vec.push_back((left_att[2] + right_att[2]) * 0.5f);
+		left_acc_vec.push_back(sqrt(left_acc[0] * left_acc[0] + left_acc[1] * left_acc[1] + left_acc[2] * left_acc[2]));
+		right_acc_vec.push_back(sqrt(right_acc[0] * right_acc[0] + right_acc[1] * right_acc[1] + right_acc[2] * right_acc[2]));
+		
+
+		if (rssi_vec.size() > 50)
+		{
+			rssi_vec.pop_front();
+			pitch_vec.pop_front();
+			roll_vec.pop_front();
+			left_acc_vec.pop_front();
+			right_acc_vec.pop_front();
+		}
+
+		if (rssi_vec.size() == 50)
+		{
+
+			int max_rssi = *max_element(rssi_vec.begin(), rssi_vec.end());
+			int left_max_acc = *max_element(left_acc_vec.begin(), left_acc_vec.end());
+			int left_min_acc = *min_element(left_acc_vec.begin(), left_acc_vec.end());
+
+			int right_max_acc = *max_element(right_acc_vec.begin(), right_acc_vec.end());
+			int right_min_acc = *min_element(right_acc_vec.begin(), right_acc_vec.end());
+
+			if (max_rssi < 25 && left_max_acc - left_min_acc < 510 && right_max_acc - right_min_acc < 510)
+			{
+				std::cout << "test" << endl;
+				for (int i = 0; i < 50; i++)
+				{
+					pitch_reference_val += pitch_vec[i];
+					roll_reference_val += pitch_vec[i];
+				}
+				pitch_reference_val /= 50;
+				roll_reference_val /= 50;
+
+				std::cout << "init roll and pitch  !!!!" << endl;
+			}
+
+		}
+
+	}
+
+
+	/*if (left_zupt || right_zupt)
+	{
+		left_zupt = 1; right_zupt = 1;
+	}*/
+
+	if (left_zupt)
+	{
+		left_zupt_extension_time = 5;
+	}
+
+	if (right_zupt)
+	{
+		right_zupt_extension_time = 5;
+	}
+
+	if (left_zupt_extension_time > 0)
 	{
 	{
-		std::cout << "test :: left_zupt" << endl;
 		left_zupt = 1;
 		left_zupt = 1;
+
+		left_zupt_extension_time--;
 	}
 	}
-	if (online_zupt & 0x02)
+
+
+	if (right_zupt_extension_time > 0)
 	{
 	{
-		std::cout << "test :: right_zupt" << endl;
 		right_zupt = 1;
 		right_zupt = 1;
-	}
 
 
+		right_zupt_extension_time--;
+	}
 
 
 
 
-	//缓存一步内的空中数据
+	//锟斤拷锟斤拷一锟斤拷锟节的匡拷锟斤拷锟斤拷锟斤拷
 	setData(right_shoes_data_vector, time_stamp, right_pos[0] * 0.001f, right_pos[1] * 0.001f, right_pos[2] * 0.001f,
 	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);
 		right_att[0] * 0.0001f, right_att[1] * 0.0001f, right_att[2] * 0.0001f, right_zupt, rssi);
 
 
 	setData(left_shoes_data_vector, time_stamp, left_pos[0] * 0.001f, left_pos[1] * 0.001f, left_pos[2] * 0.001f,
 	setData(left_shoes_data_vector, time_stamp, left_pos[0] * 0.001f, left_pos[1] * 0.001f, left_pos[2] * 0.001f,
 		left_att[0] * 0.0001f, left_att[1] * 0.0001f, left_att[2] * 0.0001f, left_zupt, rssi);
 		left_att[0] * 0.0001f, left_att[1] * 0.0001f, left_att[2] * 0.0001f, left_zupt, rssi);
 
 
-	//根据新来的数据,计算的全局位置
+	//锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟捷o拷锟斤拷锟斤拷锟饺�拷锟轿伙拷锟�
 	calGlobalPos(right_shoes_data_vector, right_step_data_vector, right_global_pos, right_heading, 0, RIGHT_FOOT);
 	calGlobalPos(right_shoes_data_vector, right_step_data_vector, right_global_pos, right_heading, 0, RIGHT_FOOT);
 
 
 	calGlobalPos(left_shoes_data_vector, left_step_data_vector, left_global_pos, left_heading, 0, LEFT_FOOT);
 	calGlobalPos(left_shoes_data_vector, left_step_data_vector, left_global_pos, left_heading, 0, LEFT_FOOT);
 
 
 
 
-	//不断根据rssi和触地信号来估计归位,以及方向
-	resetZerosPointByRssi(left_zupt, 10 ,left_zupt_count, left_foot_has_init, left_att[0] * 0.0001f, left_heading, rssi, 25,left_global_pos);
+	//锟斤拷锟较革拷锟斤拷rssi锟酵达拷锟斤拷锟脚猴拷锟斤拷锟斤拷锟狡癸拷位锟斤拷锟皆硷拷锟斤拷锟斤拷
+	resetZerosPointByRssi(left_zupt, 10, left_zupt_count, left_foot_has_init, left_att[0] * 0.0001f, left_heading, rssi, 25, left_global_pos);
 	resetZerosPointByRssi(right_zupt, 10, right_zupt_count, right_foot_has_init, right_att[0] * 0.0001f, right_heading, rssi, 25, right_global_pos);
 	resetZerosPointByRssi(right_zupt, 10, right_zupt_count, right_foot_has_init, right_att[0] * 0.0001f, right_heading, rssi, 25, right_global_pos);
 
 
 
 
-	//通过加速度、以及vector已经缓存了空中的数据来定位判断命令所需的时间戳,这个时间戳是起延时判断的效果,延时是为了等合适的RSSI
-	if (left_step_data_vector.size() > 1 && left_step_data_vector.front().zupt == 1 && left_step_data_vector.back().zupt == 1)
+	//通锟斤拷锟斤拷锟劫度★拷锟皆硷拷vector锟窖撅拷锟斤拷锟斤拷锟剿匡拷锟叫碉拷锟斤拷锟斤拷锟斤拷锟斤拷位锟叫讹拷锟斤拷锟斤拷锟斤拷锟斤拷锟绞憋拷锟斤拷锟斤拷锟斤拷锟绞憋拷锟斤拷锟斤拷锟斤拷锟斤拷时锟叫断碉拷效锟斤拷锟斤拷锟斤拷时锟斤拷为锟剿等猴拷锟绞碉拷RSSI
+	if (left_step_data_vector.size() > 5 && left_step_data_vector.front().zupt == 1 && left_step_data_vector.back().zupt == 1)
 	{
 	{
 		if (unzuptValid(max_acc_unzupt_left, min_acc_unzupt_left))
 		if (unzuptValid(max_acc_unzupt_left, min_acc_unzupt_left))
 		{
 		{
-			//根据过往记录的位置点来,来优化
+			//锟斤拷锟捷癸拷锟斤拷锟斤拷录锟斤拷位锟矫碉拷锟斤拷锟斤拷锟斤拷锟脚伙拷
 			//ProcessResult(left_global_pos, left_step_data_vector, left_global_pos_vector, LEFT_FOOT);
 			//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;
 			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;
 			float dy = left_step_data_vector.back().pos_y - left_step_data_vector.front().pos_y;
@@ -252,18 +337,19 @@ void FingerGuessing::Process(int time_stamp, int* right_pos, int* right_att, int
 			left_cmd_wait_time = time_stamp;
 			left_cmd_wait_time = time_stamp;
 
 
 			left_init = 1;
 			left_init = 1;
+
 		}
 		}
 
 
 	}
 	}
 
 
-	if (right_step_data_vector.size() > 1 && right_step_data_vector.front().zupt == 1 && right_step_data_vector.back().zupt == 1)
+
+	if (right_step_data_vector.size() > 5 && right_step_data_vector.front().zupt == 1 && right_step_data_vector.back().zupt == 1)
 	{
 	{
 		if (unzuptValid(max_acc_unzupt_right, min_acc_unzupt_right))
 		if (unzuptValid(max_acc_unzupt_right, min_acc_unzupt_right))
 		{
 		{
-			//根据过往记录的位置点来,来优化
-			//ProcessResult(right_global_pos, right_step_data_vector, right_global_pos_vector, RIGHT_FOOT);
 
 
-			addMotionCount(STEP_COUNT);
+			//锟斤拷锟捷癸拷锟斤拷锟斤拷录锟斤拷位锟矫碉拷锟斤拷锟斤拷锟斤拷锟脚伙拷
+			//ProcessResult(right_global_pos, right_step_data_vector, right_global_pos_vector, RIGHT_FOOT);
 
 
 			right_cmd_step_data_vector = right_step_data_vector;
 			right_cmd_step_data_vector = right_step_data_vector;
 
 
@@ -289,112 +375,73 @@ void FingerGuessing::Process(int time_stamp, int* right_pos, int* right_att, int
 	setPolarAccUnzupt(max_acc_unzupt_left, min_acc_unzupt_left, left_acc, left_zupt);
 	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);
 	setPolarAccUnzupt(max_acc_unzupt_right, min_acc_unzupt_right, right_acc, right_zupt);
 
 
-	//重置命令
+	//锟斤拷锟斤拷锟斤拷锟斤拷
 	memset(result, -1, 4 * sizeof(int));
 	memset(result, -1, 4 * sizeof(int));
 
 
-	//判断双脚触地的时候, rssi < 23 必须归位,不然也没办法处理
-	//看起来rssi的延迟有够烂的
+	//锟叫讹拷双锟脚达拷锟截碉拷时锟斤拷, rssi < 23 锟斤拷锟斤拷锟轿伙拷锟斤拷锟饺灰裁伙拷旆�拷锟斤拷锟�
+	//锟斤拷锟斤拷锟斤拷rssi锟斤拷锟接筹拷锟叫癸拷锟矫碉拷
 
 
 
 
 	if (left_init == 1 && right_init == 1 &&
 	if (left_init == 1 && right_init == 1 &&
-		time_stamp - left_cmd_wait_time  > 9 && time_stamp - left_cmd_wait_time < 40 && time_stamp - right_cmd_wait_time > 9 && time_stamp - right_cmd_wait_time < 40)
+		time_stamp - left_cmd_wait_time > 9 && time_stamp - left_cmd_wait_time < 40 && time_stamp - right_cmd_wait_time > 9 && time_stamp - right_cmd_wait_time < 40)
+	//if (
+	//	(left_init == 1 && time_stamp - left_cmd_wait_time > 9 && time_stamp - left_cmd_wait_time < 40)
+	//	|| 
+	//	(right_init == 1 && time_stamp - right_cmd_wait_time > 9 && time_stamp - right_cmd_wait_time < 40)
+	//	)
 	{
 	{
-		
-		//rssi 有延迟,判断延迟50ms, 直接判断如果这时候的RSSI 小于阈值, 直接设置为0
-		if ( rssi < rssi_threshold)
-		{
-			for (int i = 0; i < 3; i++)
-			{
-				left_global_pos[i] -= left_cmd_global_pos[i];
-				right_global_pos[i] -= right_cmd_global_pos[i];
-			}
-			memset(left_cmd_global_pos, 0, 3 * sizeof(float));
-			memset(right_cmd_global_pos, 0, 3 * sizeof(float));
-
-			right_global_pos_vector.clear();
-			left_global_pos_vector.clear();
-
-			left_global_pos_vector.push_back({ 0,0,0,0 });
-			right_global_pos_vector.push_back({ 0,0,0,0 });
-		}
-
-		//尝试用特殊位移来计算结果, 左右想外移动,就肯定是布,如果左右脚收缩,上下有移动,rssi超过阈值就是剪刀了
-		if (ProcessDualStepVector(left_cmd_step_data_vector, right_cmd_step_data_vector, left_cmd_global_pos, right_cmd_global_pos, rssi) != -1)
-		{
-			memcpy(right_global_pos, right_cmd_global_pos, 3 * sizeof(float));
-			memcpy(left_global_pos, left_cmd_global_pos, 3 * sizeof(float));
-		}
-
-
-		
-		float dx = left_cmd_global_pos[0] - right_cmd_global_pos[0];
-
-		float dy = left_cmd_global_pos[1] - right_cmd_global_pos[1];
 
 
-		//根据位移来先处理
-		if (sqrt(dx * dx + dy * dy) < 0.1f)
+		if (rssi < rssi_threshold)
 		{
 		{
 			addMotionCount(ROCK_COUNT);
 			addMotionCount(ROCK_COUNT);
 
 
 			result[0] = MOTION_ROCK;
 			result[0] = MOTION_ROCK;
 
 
-			std::cout << "FingureResult : MOTION_ROCK" << endl;
+			std::cout << "FingureResult : MOTION_ROCK " << "rssi  拳头"<<endl;
 		}
 		}
 		else
 		else
 		{
 		{
+			int pitch_diff = left_att[1] - right_att[1];
 
 
-			std::cout << "dx : " << dx << " dy : " << dy << endl;
+			int roll_mean = 0.5f*(left_att[2] + right_att[2]);
 
 
-			if ((dx > 0.12f || dx < -0.12f) && fabsf(dy) < 3.0 / 4 * fabsf(dx))
+			if (pitch_diff - pitch_reference_val > 2000 || pitch_diff - pitch_reference_val < -2000)
 			{
 			{
-				//统计步数
-				addMotionCount(PAPER_COUNT);
+				//统锟狡硷拷锟斤拷
+				addMotionCount(SCISSORS_COUNT);
 
 
-				result[0] = MOTION_PAPER;
+				result[0] = MOTION_SCISSORS;
 
 
-				std::cout << "MOTION_PAPER, RSSI : " << rssi << endl;
+				std::cout << "FingureResult : MOTION_SCISSORS " << " 锟斤拷锟斤拷" << endl;
 
 
-				std::cout << "FingureResult : MOTION_PAPER" << endl;
-			
 			}
 			}
-			else if ((dy > 0.12f || dy < -0.12f) && fabsf(dx) < 3.0 / 4 * fabsf(dy))
+			else if (roll_mean - roll_reference_val > 1500)
 			{
 			{
-				//统计步数
-				addMotionCount(SCISSORS_COUNT);
+				//统锟狡诧拷锟斤拷
+				addMotionCount(PAPER_COUNT);
 
 
-				result[0] = MOTION_SCISSORS;
+				result[0] = MOTION_PAPER;
 
 
-				std::cout << "FingureResult : MOTION_SCISSORS" << endl;
+				std::cout << "MOTION_PAPER, RSSI : " << rssi << endl;
 
 
-				
+				std::cout << "FingureResult : MOTION_PAPER" << " 锟斤拷" << endl;
 			}
 			}
-			/*else if (dy > 0.3f || dy < -0.3f || dx > 0.3f || dx < -0.3f)*/
 			else
 			else
 			{
 			{
-				if (fabsf(dy) > fabsf(dx))
-				{
-					addMotionCount(SCISSORS_COUNT);
-
-					result[0] = MOTION_SCISSORS;
-
-					std::cout << "dy > dx FingureResult : MOTION_SCISSORS" << endl;
-				}
-				else
-				{
-					addMotionCount(PAPER_COUNT);
+				addMotionCount(ROCK_COUNT);
 
 
-					result[0] = MOTION_PAPER;
+				result[0] = MOTION_ROCK;
 
 
-					std::cout << "dy < dx FingureResult : MOTION_PAPER" << endl;
-				}
+				std::cout << "FingureResult : MOTION_ROCK "<< "default 石头" << endl;
 			}
 			}
-
-
 		}
 		}
 
 
 		left_cmd_wait_time = 0;
 		left_cmd_wait_time = 0;
 		right_cmd_wait_time = 0;
 		right_cmd_wait_time = 0;
 
 
+		left_init = 0;
+		right_init = 0;
+
 	}
 	}
 
 
 }
 }

+ 7 - 47
plugin/shoes_sdk/ios/Classes/src/FootStep.cpp

@@ -4,7 +4,7 @@
 FootStep::FootStep()
 FootStep::FootStep()
 {
 {
 	/*
 	/*
-		初始化均为0
+		锟斤拷始锟斤拷锟斤拷为0
 	*/
 	*/
 	stepStatus = 0;
 	stepStatus = 0;
 	stepFreq = 0;
 	stepFreq = 0;
@@ -83,7 +83,7 @@ void calStepFreq(vector<FLOOR_TIME_STYPE>& time_vector, float &mean_step_vel)
 		mean_step_vel = 100.f / (cur_floor_time_stype.time - last_floor_time_stype.time);
 		mean_step_vel = 100.f / (cur_floor_time_stype.time - last_floor_time_stype.time);
 	}
 	}
 
 
-	//删除所有的点
+	//删锟斤拷锟斤拷锟叫的碉拷
 	time_vector.clear();
 	time_vector.clear();
 	time_vector.push_back(cur_floor_time_stype);
 	time_vector.push_back(cur_floor_time_stype);
 
 
@@ -127,7 +127,7 @@ int check_time_vector(vector<FLOOR_TIME_STYPE>& time_vector)
 	for (int i = 1; i < time_vector_tmp.size(); i++)
 	for (int i = 1; i < time_vector_tmp.size(); i++)
 	{
 	{
 
 
-		//按照人步伐,也不可能触地以及在空中的时间是小于50ms的
+		//锟斤拷锟斤拷锟剿诧拷锟斤拷锟斤拷也锟斤拷锟斤拷锟杰达拷锟斤拷锟皆硷拷锟节匡拷锟叫碉拷时锟斤拷锟斤拷小锟斤拷50ms锟斤拷
 		if (time_vector_tmp[i].time - time_vector_tmp[i - 1].time >= 5)
 		if (time_vector_tmp[i].time - time_vector_tmp[i - 1].time >= 5)
 		{
 		{
 			time_vector.push_back(time_vector_tmp[i]);
 			time_vector.push_back(time_vector_tmp[i]);
@@ -231,60 +231,20 @@ void FootStep::stepCal(int timeStamp, int zupt, int front_mag, int back_mag, int
 	localTime += timeDistance;
 	localTime += timeDistance;
 
 
 
 
-	//if (lastZupt == 0 && zupt == 1 && stepTag == 1 )
-	//{
-	//	
-	//	int walkTime = 8 * (localTime - leaveFloorTime1);
-
-	//	// 模块发过来的频率为40ms发一次,所以一秒能发25次,
-	//	//所以计算步频的话一分钟除以walkTime 再除以一个2
-
-	//	stepFreq = 60 * 1000 / walkTime;
-
-	//	if (girl_shoes)
-	//	{
-	//		stepFreq *= 2;
-	//	}
-	//	
-
-	//	leaveFloorTime1 = localTime;
-	//	
-	//	stepTag = 0;
-
-	//	stepCount++;
-	//}
-
-	if (zupt == 0)
-	{
-		front_mag_min = std::min(front_mag_min, front_mag);
-		back_mag_min = std::min(back_mag_min, back_mag);
-	}
-
+	//锟斤拷锟姐触锟斤拷时锟斤拷
 	if (lastZupt == 0 && zupt == 1)
 	if (lastZupt == 0 && zupt == 1)
 	{
 	{
-		if ((front_mag_min != 40000 && front_mag - front_mag_min > 1000)
-			|| (back_mag_min != 40000 && back_mag - back_mag_min > 1000))
+		if (max_acc[0] - min_acc[0] > 2048 || max_acc[1] - min_acc[1] > 2048 || max_acc[2] - min_acc[2] > 2048)
 		{
 		{
 			catchFloorTime = localTime;
 			catchFloorTime = localTime;
 
 
 			time_vector.push_back({ CATCH_TIME_STYPE, localTime });
 			time_vector.push_back({ CATCH_TIME_STYPE, localTime });
 		}
 		}
-		else
-		{
-			//std::cout << "FootStep reset Zupt" << endl;
-			zupt = 0;
-		}
-
 		//catchFloorTime = localTime;
 		//catchFloorTime = localTime;
 
 
 		//time_vector.push_back({ CATCH_TIME_STYPE, localTime });
 		//time_vector.push_back({ CATCH_TIME_STYPE, localTime });
 	}
 	}
 
 
-	if (zupt == 1)
-	{
-		front_mag_min = 40000;
-		back_mag_min = 40000;
-	}
 
 
 	if (zupt == 0)
 	if (zupt == 0)
 	{
 	{
@@ -377,13 +337,13 @@ void FootStep::stepCal(int timeStamp, int zupt, int front_mag, int back_mag, int
 
 
 	lastZupt = zupt;
 	lastZupt = zupt;
 
 
-	//空中悬停也应当判断为不动
+	//锟斤拷锟斤拷锟斤拷停也应锟斤拷锟叫讹拷为锟斤拷锟斤拷
 	if (acc_z_deque.size() > 9)
 	if (acc_z_deque.size() > 9)
 	{
 	{
 		acc_z_deque.pop_front();
 		acc_z_deque.pop_front();
 	}
 	}
 
 
-	acc_z_deque.push_back(acc[2]);
+	acc_z_deque.push_back(acc[0]);
 
 
 
 
 	if (zupt == 1 ||
 	if (zupt == 1 ||

+ 9 - 9
plugin/shoes_sdk/ios/Classes/src/Game.cpp

@@ -86,27 +86,27 @@ void Game::GameProcess(int gameTime, int* right_pos_data, int* right_att_data, i
 	int jump, int down, int rssi)
 	int jump, int down, int rssi)
 {
 {
 
 
-	//游戏的主逻辑入口
+	//锟斤拷戏锟斤拷锟斤拷锟竭硷拷锟斤拷锟�
 	game->Process(gameTime, right_pos_data, right_att_data, right_acc_data, right_zupt, right_front_mag, right_back_mag,
 	game->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);
 		left_pos_data, left_att_data, left_acc_data, left_zupt, left_front_mag, left_back_mag, jump, down, rssi);
 	
 	
-	//获取游戏结果
+	//锟斤拷取锟斤拷戏锟斤拷锟�
 	game->getResult(resultMatrix);
 	game->getResult(resultMatrix);
 
 
 
 
-	///*交互命令计算*/
+	//*锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟�*/
 	interaction.Process(gameTime, right_pos_data, right_att_data, right_acc_data, right_zupt, right_front_mag, right_back_mag,
 	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);
 		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);
 	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);
 	rightFootStep.stepCal(gameTime, right_zupt, right_front_mag, right_back_mag, right_acc_data);
 
 
-	/*利用脚步抬高的高度以及步频 平衡出一个速度*/
-	stepVel.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);
+	///*锟斤拷锟矫脚诧拷抬锟竭的高讹拷锟皆硷拷锟斤拷频 平锟斤拷锟揭伙拷锟斤拷俣锟�*/
+	//stepVel.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);
 
 
 
 
 }
 }
@@ -176,7 +176,7 @@ string Game::getGameDataStr()
 {
 {
 	string data_str_temp = "";
 	string data_str_temp = "";
 
 
-	//先记录右边
+	//锟饺硷拷录锟揭憋拷
 
 
 	data_str_temp = data_str;
 	data_str_temp = data_str;
 
 
@@ -221,7 +221,7 @@ void Game::getFootAtt(int* left_att, int* right_att)
 }
 }
 
 
 
 
-//解析鞋子的数据
+//锟斤拷锟斤拷鞋锟接碉拷锟斤拷锟斤拷
 void Game::GameProcessBuf(uint8_t* buf, int len) {
 void Game::GameProcessBuf(uint8_t* buf, int len) {
 
 
 	right_pos_data[0] = int32_t(buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3] << 0);
 	right_pos_data[0] = int32_t(buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3] << 0);

+ 8 - 30
plugin/shoes_sdk/ios/Classes/src/H5_Game.cpp

@@ -27,23 +27,11 @@ void H5::Process(int time_stamp, int* right_pos, int* right_att, int* right_acc,
 	int jump, int down, int rssi)
 	int jump, int down, int rssi)
 {
 {
 
 
-	//规避一些跳的动作
-	left_front_press_deque.push_back(left_front_press);
 
 
-	right_front_press_deque.push_back(right_front_press);
-
-	if (left_front_press_deque.size() > 10)
-	{
-		left_front_press_deque.pop_front();
-		
-		right_front_press_deque.pop_front();
-
-	}
-
-	//获取触地
+	//锟斤拷取锟斤拷锟斤拷
 	if (last_left_zupt == 0 && left_zupt == 1)
 	if (last_left_zupt == 0 && left_zupt == 1)
 	{
 	{
-		//统计步数
+		//统锟狡诧拷锟斤拷
 		addMotionCount(STEP_COUNT);
 		addMotionCount(STEP_COUNT);
 
 
 		std::cout << "H5GAME:: MOTION_LEFT" << endl;
 		std::cout << "H5GAME:: MOTION_LEFT" << endl;
@@ -56,7 +44,7 @@ void H5::Process(int time_stamp, int* right_pos, int* right_att, int* right_acc,
 
 
 	if (last_right_zupt == 0 && right_zupt == 1)
 	if (last_right_zupt == 0 && right_zupt == 1)
 	{
 	{
-		//统计步数
+		//统锟狡诧拷锟斤拷
 		addMotionCount(STEP_COUNT);
 		addMotionCount(STEP_COUNT);
 
 
 		std::cout << "H5GAME:: MOTION_RIGHT" << endl;
 		std::cout << "H5GAME:: MOTION_RIGHT" << endl;
@@ -67,20 +55,10 @@ void H5::Process(int time_stamp, int* right_pos, int* right_att, int* right_acc,
 		result[1] = -1;
 		result[1] = -1;
 	}
 	}
 
 
-	//filter down jump
-
-	int valid_press = 1;
-
-	if (*max_element(left_front_press_deque.begin(), left_front_press_deque.end()) - *min_element(left_front_press_deque.begin(), left_front_press_deque.end()) < 1024
-		|| *max_element(right_front_press_deque.begin(), right_front_press_deque.end()) - *min_element(right_front_press_deque.begin(), right_front_press_deque.end()) < 1024)
-	{
-		valid_press = 0;
-	}
-
 
 
-	if (last_jump == 0 && jump == 1 && valid_press)
+	if (last_jump == 0 && jump == 1)
 	{
 	{
-		//统计步数
+		//统锟狡诧拷锟斤拷
 		addMotionCount(JUMP_COUNT);
 		addMotionCount(JUMP_COUNT);
 
 
 		std::cout << "H5GAME:: MOTION_JUMP" << endl;
 		std::cout << "H5GAME:: MOTION_JUMP" << endl;
@@ -95,7 +73,7 @@ void H5::Process(int time_stamp, int* right_pos, int* right_att, int* right_acc,
 	}
 	}
 
 
 	//reset jump wait time when both foot isn't on the floor
 	//reset jump wait time when both foot isn't on the floor
-	if ((valid_jump_wait_time > 0 && left_zupt == 0 && right_zupt == 0) || jump == 1)
+	if (( left_zupt == 0 && right_zupt == 0) || jump == 1)
 	{
 	{
 		valid_jump_wait_time = WAIT_TIME;
 		valid_jump_wait_time = WAIT_TIME;
 	}
 	}
@@ -113,9 +91,9 @@ void H5::Process(int time_stamp, int* right_pos, int* right_att, int* right_acc,
 
 
 
 
 	//same process with jump
 	//same process with jump
-	if (last_down == 0 && down == 1 && CANCLE_DOWN == 0)
+	if (last_down == 0 && down == 1 )
 	{
 	{
-		//统计步数
+		//统锟狡诧拷锟斤拷
 		addMotionCount(DOWN_COUNT);
 		addMotionCount(DOWN_COUNT);
 
 
 		std::cout << "H5GAME:: MOTION_DOWN" << endl;
 		std::cout << "H5GAME:: MOTION_DOWN" << endl;

+ 9 - 9
plugin/shoes_sdk/ios/Classes/src/Interaction.cpp

@@ -28,7 +28,7 @@ Interaction::Interaction()
 
 
 int Interaction::foot_on_floor(int _time,  int& triggerring_time, int zupt, int &last_zupt, int rssi, float pitch, int left_or_right)
 int Interaction::foot_on_floor(int _time,  int& triggerring_time, int zupt, int &last_zupt, int rssi, float pitch, int left_or_right)
 {
 {
-	if (pitch > 0.2f)
+	if (pitch > 0.3f)
 	{
 	{
 		return -1;
 		return -1;
 	}
 	}
@@ -64,8 +64,8 @@ int Interaction::foot_on_floor(int _time,  int& triggerring_time, int zupt, int
 
 
 int acc_is_valid(float* acc_window, int length)
 int acc_is_valid(float* acc_window, int length)
 {
 {
-	//要求窗口窗口长度大于10
-	//先判断最后五个元素是平稳的,阈值设置为0.06
+	//要锟襟窗口达拷锟节筹拷锟饺达拷锟斤拷10
+	//锟斤拷锟叫讹拷锟斤拷锟斤拷锟斤拷元锟斤拷锟斤拷平锟饺的o拷锟斤拷值锟斤拷锟斤拷为0.06
 	float station_max = acc_window[length - 1];
 	float station_max = acc_window[length - 1];
 	float station_min = acc_window[length - 1];
 	float station_min = acc_window[length - 1];
 
 
@@ -104,7 +104,7 @@ int acc_is_valid(float* acc_window, int length)
 		}
 		}
 	}
 	}
 
 
-	if (window_max - window_min < 0.1f)
+	if (window_max - window_min < 0.05f)
 	{
 	{
 		return 1;
 		return 1;
 	}
 	}
@@ -121,13 +121,13 @@ int Interaction::enter_key_listen( float* acc, float* acc_x_buff,int &station_co
 
 
 	pitch_buff[9] = pitch;
 	pitch_buff[9] = pitch;
 
 
-	//先判断俯仰角是否正常着地,这样才能判断确认键
-	if (pitch < 0.2f)
+	//锟斤拷锟叫断革拷锟斤拷锟斤拷锟角凤拷锟斤拷锟斤拷锟脚地o拷锟斤拷锟斤拷锟斤拷锟斤拷锟叫讹拷确锟较硷拷
+	if (pitch < 0.6f)
 	{
 	{
 		angle_has_reset = 1;
 		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++;
 		station_count++;
 	}
 	}
@@ -136,8 +136,8 @@ int Interaction::enter_key_listen( float* acc, float* acc_x_buff,int &station_co
 		station_count = 0;
 		station_count = 0;
 	}
 	}
 
 
-	//x轴速度剧烈抖动,而且俯仰角大于45度,则证明是踮脚
-	if (station_count > 10 && pitch > 0.3f  && angle_has_reset == 1)
+	//x锟斤拷锟劫度撅拷锟揭讹拷锟斤拷锟斤拷锟斤拷锟揭革拷锟斤拷锟角达拷锟斤拷45锟饺o拷锟斤拷证锟斤拷锟斤拷锟节斤拷
+	if (station_count > 10 && pitch > 0.6f  && angle_has_reset == 1)
 	{
 	{
 		angle_has_reset = 0;
 		angle_has_reset = 0;
 
 

+ 139 - 218
plugin/shoes_sdk/ios/Classes/src/JumpHouse.cpp

@@ -17,22 +17,14 @@ JumpHouse::JumpHouse()
 		}
 		}
 	}
 	}
 
 
-	left_back_press_offset = 40000;
-
-	right_back_press_offset = 40000;
-
-	left_back_press_detect_time = 50;
-
-
-    right_back_press_detect_time = 50;
 
 
 }
 }
 
 
 bool JumpHouse::unzuptValid(int* max_acc, int* min_acc)
 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[2] > 3000)
+	if ((max_acc[0] - min_acc[0] > 2048 || max_acc[1] - min_acc[1] > 2048 || max_acc[2] - min_acc[2] > 2048) && min_acc[0] < 500)
 	{
 	{
-		std::cout << "JumpHouse::unzuptValid" << endl;
+
 		return true;
 		return true;
 	}
 	}
 
 
@@ -44,151 +36,107 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
 	int* left_pos, int* left_att, int* left_acc, int left_zupt, int left_front_press, int left_back_press,
 	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 jump, int down, int rssi)
 {
 {
-	//缓存一步内的空中数据
-	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);
-
-	setData(left_shoes_data_vector, time_stamp, left_pos[0] * 0.001f, left_pos[1] * 0.001f, left_pos[2] * 0.001f,
-		left_att[0] * 0.0001f, left_att[1] * 0.0001f, left_att[2] * 0.0001f, left_zupt, rssi);
-
-	//根据新来的数据,计算的全局位置
-	calGlobalPos(right_shoes_data_vector, right_step_data_vector, right_global_pos, right_heading, 0, RIGHT_FOOT);
-
-	calGlobalPos(left_shoes_data_vector, left_step_data_vector, left_global_pos, left_heading, 0, LEFT_FOOT);
-
-	//补充后脚跟落地的问题
 
 
-	left_back_press_vector.push_back(left_back_press);
+	//锟教斤拷锟斤拷为锟斤拷锟节碉拷锟斤拷
+	// 
 
 
-	if(left_back_press_vector.size()> 10)
+	if (has_init == 0)
 	{
 	{
-		//表示有触地命令时候,触发检测, 是不是为假触地
-		left_back_press_vector.pop_front();
-		auto max_point = std::max_element(left_back_press_vector.begin(), left_back_press_vector.end());
-		auto min_point = std::min_element(left_back_press_vector.begin(), left_back_press_vector.end());
+		rssi_vec.push_back(rssi);
+		pitch_vec.push_back(left_att[1] - right_att[1]);
+		roll_vec.push_back((left_att[2] + right_att[2]) * 0.5f);
+		left_acc_vec.push_back(sqrt(left_acc[0] * left_acc[0] + left_acc[1] * left_acc[1] + left_acc[2] * left_acc[2]));
+		right_acc_vec.push_back(sqrt(right_acc[0] * right_acc[0] + right_acc[1] * right_acc[1] + right_acc[2] * right_acc[2]));
 
 
-		if (left_back_press > *min_point + 2000 && max_point > min_point)
-		{
-			int offser_temp = *min_point;
-
-			if (left_back_press_detect_time == 0)
-			{
-				left_back_press_detect_time = 50;
-			}
 
 
-
-			if (offser_temp < left_back_press_offset + 10)
-			{
-				left_back_press_detect_time = 50;
-				left_back_press_offset = offser_temp;
-			}
-		}
-		if (left_back_press_detect_time > 0)
+		if (rssi_vec.size() > 50)
 		{
 		{
-			if (left_back_press < left_back_press_offset + 2000)
-			{
-				left_back_press_detect_time = 0;
-
-				left_back_press_offset = 40000;
-			}
+			rssi_vec.pop_front();
+			pitch_vec.pop_front();
+			roll_vec.pop_front();
+			left_acc_vec.pop_front();
+			right_acc_vec.pop_front();
 		}
 		}
-	}
-
-
-	right_back_press_vector.push_back(right_back_press);
-
-	if (right_back_press_vector.size() > 10)
-	{
-		//表示有触地命令时候,触发检测, 是不是为假触地
-		right_back_press_vector.pop_front();
-		auto max_point = std::max_element(right_back_press_vector.begin(), right_back_press_vector.end());
-		auto min_point = std::min_element(right_back_press_vector.begin(), right_back_press_vector.end());
 
 
-		if (right_back_press > *min_point + 2000 && max_point > min_point)
+		if (rssi_vec.size() == 50)
 		{
 		{
-			int offser_temp = *min_point;
-
-			if (right_back_press_detect_time == 0)
-			{
-				right_back_press_detect_time = 50; 		
-				right_back_press_offset = offser_temp;
-			}
+			int max_rssi = *max_element(rssi_vec.begin(), rssi_vec.end());
+			int left_max_acc = *max_element(left_acc_vec.begin(), left_acc_vec.end());
+			int left_min_acc = *min_element(left_acc_vec.begin(), left_acc_vec.end());
 
 
+			int right_max_acc = *max_element(right_acc_vec.begin(), right_acc_vec.end());
+			int right_min_acc = *min_element(right_acc_vec.begin(), right_acc_vec.end());
 
 
-			if (offser_temp < right_back_press_offset + 10)
+			if (max_rssi < 25 && left_max_acc - left_min_acc < 510 && right_max_acc - right_min_acc < 510)
 			{
 			{
-				right_back_press_detect_time = 50;
-				right_back_press_offset = offser_temp;
+				for (int i = 0; i < 50; i++)
+				{
+					pitch_reference_val += pitch_vec[i];
+					roll_reference_val += pitch_vec[i];
+				}
+				pitch_reference_val /= 50;
+				roll_reference_val /= 50;
+
+				std::cout << "init roll and pitch  !!!!" << endl;
 			}
 			}
 
 
-
 		}
 		}
-		if (right_back_press_detect_time > 0)
-		{
-			if (  right_back_press < right_back_press_offset + 2000)
-			{
-				right_back_press_detect_time = 0;
 
 
-				right_back_press_offset = 40000;
+	}
+	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.5f)
+	{
+		std::cout << "if (right_zupt == 1 && right_att[1] * 0.0001f > 0.6f) " << right_att[1] * 0.0001f << endl;
+		right_zupt = 0;
+	}
 
 
-	
-			}
-		}
+	if (left_zupt)
+	{
+		left_zupt_extension_time = 5;
 	}
 	}
 
 
-	left_front_press_vector.push_back(left_front_press);
-	right_front_press_vector.push_back(right_front_press);
-	if (left_front_press_vector.size() > 10)
+	if (right_zupt)
 	{
 	{
-		left_front_press_vector.pop_front(); right_front_press_vector.pop_front();
+		right_zupt_extension_time = 5;
 	}
 	}
 
 
-	if (left_front_press_vector.size() == 10)
+	if (left_zupt_extension_time > 0)
 	{
 	{
-		auto front_max_point = max_element(left_front_press_vector.begin(), left_front_press_vector.end());
-		auto front_min_point = min_element(left_front_press_vector.begin(), left_front_press_vector.end());
+		left_zupt = 1;
 
 
-		auto back_max_point = max_element(left_back_press_vector.begin(), left_back_press_vector.end());
-		auto back_min_point = min_element(left_back_press_vector.begin(), left_back_press_vector.end());
+		left_zupt_extension_time--;
+	}
 
 
-		if (front_max_point > front_min_point && *front_max_point - *front_min_point > 2000 && *front_max_point - left_front_press < 50)
-		{
-			left_press_valid = 10;
-		}
+	if (right_zupt_extension_time > 0)
+	{
+		right_zupt = 1;
 
 
-		if (back_max_point > back_min_point && *back_max_point - *back_min_point > 2000 && *back_max_point - left_back_press < 50)
-		{
-			left_press_valid = 10;
-		}
+		right_zupt_extension_time--;
 	}
 	}
 
 
-	if (right_front_press_vector.size() == 10)
-	{
-		auto front_max_point = max_element(right_front_press_vector.begin(), right_front_press_vector.end());
-		auto front_min_point = min_element(right_front_press_vector.begin(), right_front_press_vector.end());
+	//锟斤拷锟斤拷一锟斤拷锟节的匡拷锟斤拷锟斤拷锟斤拷
+	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);
 
 
-		auto back_max_point = max_element(right_back_press_vector.begin(), right_back_press_vector.end());
-		auto back_min_point = min_element(right_back_press_vector.begin(), right_back_press_vector.end());
+	setData(left_shoes_data_vector, time_stamp, left_pos[0] * 0.001f, left_pos[1] * 0.001f, left_pos[2] * 0.001f,
+		left_att[0] * 0.0001f, left_att[1] * 0.0001f, left_att[2] * 0.0001f, left_zupt, rssi);
 
 
-		if (front_max_point > front_min_point && *front_max_point - *front_min_point > 2000 && *front_max_point - right_front_press < 50)
-		{
-			right_press_valid = 10;
-		}
+	//锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟捷o拷锟斤拷锟斤拷锟饺�拷锟轿伙拷锟�
+	calGlobalPos(right_shoes_data_vector, right_step_data_vector, right_global_pos, right_heading, 0, RIGHT_FOOT);
 
 
-		if (back_max_point > back_min_point && *back_max_point - *back_min_point > 2000 && *back_max_point - right_back_press < 50)
-		{
-			right_press_valid = 10;
-		}
-	}
+	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
-		&& (left_back_press_detect_time == 0 || left_back_press_detect_time == 50))
+	//通锟斤拷锟斤拷锟劫度★拷锟皆硷拷vector锟窖撅拷锟斤拷锟斤拷锟剿匡拷锟叫碉拷锟斤拷锟斤拷锟斤拷锟斤拷位锟叫讹拷锟斤拷锟斤拷锟斤拷锟斤拷锟绞憋拷锟斤拷锟斤拷锟斤拷锟绞憋拷锟斤拷锟斤拷锟斤拷锟斤拷时锟叫断碉拷效锟斤拷锟斤拷锟斤拷时锟斤拷为锟剿等猴拷锟绞碉拷RSSI
+	if (left_step_data_vector.size() > 5 && 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) && press_valid)
-		if (unzuptValid(max_acc_unzupt_left, min_acc_unzupt_left))
+		if (unzuptValid(max_acc_unzupt_left, min_acc_unzupt_left) || left_front_press & 0x01)
 		{
 		{
+			left_zupt_extension_time = 20;
 
 
 			left_cmd_wait_time = time_stamp;
 			left_cmd_wait_time = time_stamp;
 
 
@@ -198,13 +146,12 @@ 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
-		&& (right_back_press_detect_time == 0 || right_back_press_detect_time == 50))
+	if (right_step_data_vector.size() > 5 && 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) && press_valid)
-		if (unzuptValid(max_acc_unzupt_right, min_acc_unzupt_right))
+		if (unzuptValid(max_acc_unzupt_right, min_acc_unzupt_right) || right_front_press & 0x01)
 		{
 		{
+			right_zupt_extension_time = 20;
 
 
 			right_cmd_wait_time = time_stamp;
 			right_cmd_wait_time = time_stamp;
 
 
@@ -214,90 +161,63 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
 
 
 	}
 	}
 
 
-	/*添加加速度过滤器
-	for (int i = 1; i < 3; i++)
-	{
-		for (int k = 0; k < 3; k++)
-		{
-			left_acc_buff[i - 1][k] = left_acc_buff[i][k];
-			right_acc_buff[i - 1][k] = right_acc_buff[i][k];
-		}
-	}
-
-	for (int i = 0; i < 3; i++)
-	{
-		left_acc_buff[2][i] = left_acc[i]; right_acc_buff[2][i] = right_acc[i];
-	}
-
-	for (int i = 0; i < 3; i++)
-	{
-		left_acc[i] = max(max(left_acc_buff[0][i], left_acc_buff[1][i]), left_acc_buff[2][i]);
-
-		right_acc[i] = max(max(right_acc_buff[0][i], right_acc_buff[1][i]), right_acc_buff[2][i]);
-
-		left_acc[i]  = (left_acc_buff[0][i] +  left_acc_buff[1][i]  +  left_acc_buff[2][i]) * 0.3333;
+	//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);
 
 
-		right_acc[i] = (right_acc_buff[0][i] + right_acc_buff[1][i] + right_acc_buff[2][i]) * 0.3333;
-
-	}*/
-
-	if (left_step_data_vector.size() > 1 && left_zupt == 0)
-	{
-		setPolarAccUnzupt(max_acc_unzupt_left, min_acc_unzupt_left, left_acc, left_zupt);
-	}
-	else
-	{
-		for (int k = 0; k < 3; k++)
-		{
-			max_acc_unzupt_left[k] = left_acc[k]; 
-			min_acc_unzupt_left[k] = left_acc[k];
-		}
-	}
-
-	if (right_step_data_vector.size() > 1 && right_zupt == 0)
-	{
-		setPolarAccUnzupt(max_acc_unzupt_right, min_acc_unzupt_right, right_acc, right_zupt);
-	}
-	else
-	{
-		for (int k = 0; k < 3; k++)
-		{
-			max_acc_unzupt_right[k] = right_acc[k];
-			min_acc_unzupt_right[k] = left_acc[k];
-		}
-	}
-
-	static int count = 0;
-
-	count++;
+	setPolarAccUnzupt(max_acc_unzupt_right, min_acc_unzupt_right, right_acc, right_zupt);
+	
 
 
-	//重置命令
+	//锟斤拷锟斤拷锟斤拷锟斤拷
 	memset(result, -1, 4 * sizeof(int));
 	memset(result, -1, 4 * sizeof(int));
 
 
-	//判断双脚触地的时候, rssi < 23 必须归位,不然也没办法处理
-	//看起来rssi的延迟有够烂的
 
 
-	if (left_init == 1 && time_stamp - left_cmd_wait_time >= 9 && time_stamp - left_cmd_wait_time < 20 && left_press_valid > 0)
+	//锟叫讹拷双锟脚达拷锟截碉拷时锟斤拷, rssi < 23 锟斤拷锟斤拷锟轿伙拷锟斤拷锟饺灰裁伙拷旆�拷锟斤拷锟�
+	//锟斤拷锟斤拷锟斤拷rssi锟斤拷锟接筹拷锟叫癸拷锟矫碉拷
+
+	if (left_init == 1 && time_stamp - left_cmd_wait_time >= 9 && time_stamp - left_cmd_wait_time < 30)
 	{
 	{
-		if (right_init == 1 && right_press_valid > 0)
+		std::cout  << " left_att[1] : " << left_att[1] << " right_att[1] : " << right_att[1] << std::endl;
+		if (right_init == 1)
 		{
 		{
 			if (rssi < rssi_threshold)
 			if (rssi < rssi_threshold)
 			{
 			{
 				result[0] = MOTION_BOTH_ON_FLOOR_CLOSE;
 				result[0] = MOTION_BOTH_ON_FLOOR_CLOSE;
 
 
-				std::cout << " MOTION_BOTH_ON_FLOOR_CLOSE " << count  << " " << rssi << std::endl;
+				std::cout << " MOTION_BOTH_ON_FLOOR_CLOSE " << rssi <<  ", " << " 锟较斤拷"  <<std::endl;
 			}
 			}
 			else
 			else
 			{
 			{
 				result[0] = MOTION_BOTH_ON_FLOOR_OPEN;
 				result[0] = MOTION_BOTH_ON_FLOOR_OPEN;
-				std::cout << " MOTION_BOTH_ON_FLOOR_OPEN " << count  << " " << rssi << std::endl;
+
+				std::cout << " MOTION_BOTH_ON_FLOOR_OPEN "<< rssi << ", "  << " 锟斤拷锟斤拷"<<std::endl;
 			}
 			}
 
 
 		}
 		}
 		else
 		else
 		{
 		{
-			result[0] = MOTION_LEFT_ON_FLOOR;
-			std::cout << " MOTION_LEFT_ON_FLOOR " << count << " "<<time_stamp << std::endl;
+			std::cout << "pitch_reference_val : " << pitch_reference_val << endl;
+			if (abs(left_att[1] - right_att[1] - pitch_reference_val) < 2000)
+			{
+				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;
+				}
+
+				right_shoes_data_vector.pop_front();
+				right_step_data_vector.pop_front();
+			}
+			else
+			{
+				result[0] = MOTION_LEFT_ON_FLOOR;
+				std::cout << " MOTION_LEFT_ON_FLOOR " << time_stamp << ", " << " 锟襟单斤拷" << std::endl;
+			}
 		
 		
 		}
 		}
 
 
@@ -305,25 +225,24 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
 		right_cmd_wait_time = 0;
 		right_cmd_wait_time = 0;
 		left_init = 0;
 		left_init = 0;
 		left_cmd_wait_time = 0;
 		left_cmd_wait_time = 0;
-		left_press_valid = 0;
 
 
-		right_press_valid = 0;
 
 
 	}
 	}
-	else if (right_init == 1 && time_stamp - right_cmd_wait_time >= 9 && time_stamp - right_cmd_wait_time < 20 && right_press_valid > 0)
+	else if (right_init == 1 && time_stamp - right_cmd_wait_time >= 9 && time_stamp - right_cmd_wait_time < 30)
 	{
 	{
-		if (left_init == 1 && left_press_valid > 0)
+		std::cout  << " left_att[1] : " << left_att[1] << " right_att[1] : " << right_att[1] << std::endl;
+		if (left_init == 1)
 		{
 		{
 			if (rssi < rssi_threshold)
 			if (rssi < rssi_threshold)
 			{
 			{
 				result[0] = MOTION_BOTH_ON_FLOOR_CLOSE;
 				result[0] = MOTION_BOTH_ON_FLOOR_CLOSE;
 
 
-				std::cout << " MOTION_BOTH_ON_FLOOR_CLOSE " << count << " "<< rssi << std::endl;
+				std::cout << " MOTION_BOTH_ON_FLOOR_CLOSE "  << " "<< rssi << ", " << " 锟较斤拷" << std::endl;
 			}
 			}
 			else
 			else
 			{
 			{
 				result[0] = MOTION_BOTH_ON_FLOOR_OPEN;
 				result[0] = MOTION_BOTH_ON_FLOOR_OPEN;
-				std::cout << " MOTION_BOTH_ON_FLOOR_OPEN " << count << " " << rssi << std::endl;
+				std::cout << " MOTION_BOTH_ON_FLOOR_OPEN "  << " " << rssi << ", "  << " 锟斤拷锟斤拷"<<std::endl;
 			}
 			}
 
 
 			left_init = 0;
 			left_init = 0;
@@ -332,8 +251,29 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
 		}
 		}
 		else
 		else
 		{
 		{
-			result[0] = MOTION_RIGHT_ON_FLOOR;
-			std::cout << " MOTION_RIGHT_ON_FLOOR " << count << std::endl;
+			std::cout << "pitch_reference_val : " << pitch_reference_val << endl;
+			if (abs(left_att[1] - right_att[1] - pitch_reference_val) < 2000)
+			{
+				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;
+				}
+
+				left_shoes_data_vector.pop_front();
+				left_step_data_vector.pop_front();
+			}
+			else
+			{
+				result[0] = MOTION_RIGHT_ON_FLOOR;
+				std::cout << " MOTION_RIGHT_ON_FLOOR " << time_stamp << ", " << "锟揭碉拷锟斤拷" << std::endl;
+			}
 			
 			
 		}
 		}
 		right_init = 0;
 		right_init = 0;
@@ -341,43 +281,24 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
 		left_init = 0;
 		left_init = 0;
 		left_cmd_wait_time = 0;
 		left_cmd_wait_time = 0;
 
 
-		left_press_valid = 0;
-
-		right_press_valid = 0;
 	}
 	}
-	if (right_init == 1 && time_stamp - right_cmd_wait_time >= 20)
+
+	if (right_init == 1 && time_stamp - right_cmd_wait_time >= 30)
 	{
 	{
 		right_init = 0;
 		right_init = 0;
 		right_cmd_wait_time = 0;
 		right_cmd_wait_time = 0;
 	}
 	}
 
 
-	if (left_init == 1 && time_stamp - left_cmd_wait_time >= 20)
+	if (left_init == 1 && time_stamp - left_cmd_wait_time >= 30)
 	{
 	{
 		left_init = 0;
 		left_init = 0;
 		left_cmd_wait_time = 0;
 		left_cmd_wait_time = 0;
 	}
 	}
 
 
-	//else if (count < 850 && count > 830)
-	//{
-	//	std::cout << "right_init : " << right_init << " time_stamp - right_cmd_wait_time : " << time_stamp - right_cmd_wait_time
-	//		<< " right_press_valid : " << right_press_valid << endl;
-	//}
 
 
 	if (result[0] != -1)
 	if (result[0] != -1)
 	{
 	{
 		addMotionCount(JUMP_COUNT);
 		addMotionCount(JUMP_COUNT);
 	}
 	}
 
 
-	if (left_back_press_detect_time > 0) left_back_press_detect_time--;
-	if (right_back_press_detect_time > 0) right_back_press_detect_time--;
-
-	if (left_press_valid > 0)
-	{
-		left_press_valid--;
-	}
-
-	if (right_press_valid > 0)
-	{
-		right_press_valid--;
-	}
 }
 }

+ 47 - 140
plugin/shoes_sdk/ios/Classes/src/Kongfu.cpp

@@ -1,6 +1,6 @@
 #include "Kongfu.h"
 #include "Kongfu.h"
 
 
-//功夫小羊游
+//锟斤拷锟斤拷小锟斤拷锟斤拷
 
 
 Kongfu::Kongfu()
 Kongfu::Kongfu()
 {
 {
@@ -35,7 +35,7 @@ int getKickByAcc(int zupt, int& kick, int& last_kick, int& kick_wait, float acc_
 	{
 	{
 		acc_x_buff.clear();
 		acc_x_buff.clear();
 	}
 	}
-	//利用在空中判断一次
+	//锟斤拷锟斤拷锟节匡拷锟斤拷锟叫讹拷一锟斤拷
 	if (shoes_data_vector.size() >  1)
 	if (shoes_data_vector.size() >  1)
 	{
 	{
 		float start_x = shoes_data_vector.front().pos_x;
 		float start_x = shoes_data_vector.front().pos_x;
@@ -55,7 +55,7 @@ int getKickByAcc(int zupt, int& kick, int& last_kick, int& kick_wait, float acc_
 		}
 		}
 
 
 	}
 	}
-	//利用x轴加速度来判断是否踢脚, 左右脚应该是翻转过来的
+	//锟斤拷锟斤拷x锟斤拷锟斤拷俣锟斤拷锟斤拷卸锟斤拷欠锟斤拷呓锟�, 锟斤拷锟揭斤拷应锟斤拷锟角凤拷转锟斤拷锟斤拷锟斤拷
 	if (acc_x_buff.size() > 1)
 	if (acc_x_buff.size() > 1)
 	{
 	{
 		if (acc_x_buff.back() - acc_x_buff[acc_x_buff.size() - 2] > 0.0f)
 		if (acc_x_buff.back() - acc_x_buff[acc_x_buff.size() - 2] > 0.0f)
@@ -71,7 +71,7 @@ int getKickByAcc(int zupt, int& kick, int& last_kick, int& kick_wait, float acc_
 		}
 		}
 	}
 	}
 
 
-	//过滤持续判断踢的动作命令
+	//锟斤拷锟剿筹拷锟斤拷锟叫讹拷锟竭的讹拷锟斤拷锟斤拷锟斤拷
 	if (last_kick == 0 && kick == 1)
 	if (last_kick == 0 && kick == 1)
 	{
 	{
 		kick_wait = 4;
 		kick_wait = 4;
@@ -84,7 +84,7 @@ int getKickByAcc(int zupt, int& kick, int& last_kick, int& kick_wait, float acc_
 		kick_wait = 0;
 		kick_wait = 0;
 	}
 	}
 
 
-	//利用三个数据点的时间长度,避免触地时候踢的动作
+	//锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟捷碉拷锟绞憋拷涑わ拷龋锟斤拷锟斤拷獯ワ拷锟绞憋拷锟斤拷叩亩锟斤拷锟�
 	if ((kick_wait--) == 1)
 	if ((kick_wait--) == 1)
 	{
 	{
 		return 1;
 		return 1;
@@ -106,22 +106,40 @@ void Kongfu::Process(int time_stamp, int* right_pos, int* right_att, int* right_
 	setData(left_shoes_data_vector, time_stamp, left_pos[0] * 0.001f, left_pos[1] * 0.001f, left_pos[2] * 0.001f,
 	setData(left_shoes_data_vector, time_stamp, left_pos[0] * 0.001f, left_pos[1] * 0.001f, left_pos[2] * 0.001f,
 		left_att[0] * 0.0001f, left_att[1] * 0.0001f, left_att[2] * 0.0001f, left_zupt, rssi);
 		left_att[0] * 0.0001f, left_att[1] * 0.0001f, left_att[2] * 0.0001f, left_zupt, rssi);
 
 
-	down = 0;
 
 
-	if (extract_motion.online_detect_down(right_front_press, left_front_press, right_back_press, left_back_press,
-		right_acc, left_acc))
+	//filter down jump
+
+	if (last_jump == 0 && jump == 1)
 	{
 	{
-		down = 1;
+		result[2] = MOTION_JUMP;
+
+		addMotionCount(JUMP_COUNT);
+
+		CANCLE_JUMP = 20;
+
+		std::cout << "KONGFU : motion_jump" << std::endl;
 	}
 	}
+	else
+	{
+		result[2] = -1;
+	}
+
+	//down = 0;
+
+	//if (extract_motion.online_detect_down(right_front_press, left_front_press, right_back_press, left_back_press,
+	//	right_acc, left_acc))
+	//{
+	//	down = 1;
+	//}
 
 
-	//设置重置为-1
+	//锟斤拷锟斤拷锟斤拷锟斤拷为-1
 	result[0] = -1;
 	result[0] = -1;
 	result[1] = -1;
 	result[1] = -1;
 
 
-	if (getKickByAcc(left_zupt, left_kick, last_left_kick, left_kick_wait, left_acc[0] / 2048.f, left_acc_x_buff, left_shoes_data_vector)
-		&& unzuptValid(max_acc_unzupt_left, min_acc_unzupt_left))
+	if (getKickByAcc(left_zupt, left_kick, last_left_kick, left_kick_wait, left_acc[2] / 2048.f, left_acc_x_buff, left_shoes_data_vector)
+		&& unzuptValid(max_acc_unzupt_left, min_acc_unzupt_left) && CANCLE_JUMP == 0)
 	{
 	{
-		//统计踢的动作
+		//统锟斤拷锟竭的讹拷锟斤拷
 		addMotionCount(KICK_COUNT);
 		addMotionCount(KICK_COUNT);
 
 
 		CANCLE_FLOOR_CMD_LEFT = 1;
 		CANCLE_FLOOR_CMD_LEFT = 1;
@@ -129,10 +147,10 @@ void Kongfu::Process(int time_stamp, int* right_pos, int* right_att, int* right_
 		result[0] = MOTION_LEFT;
 		result[0] = MOTION_LEFT;
 	}
 	}
 
 
-	if (getKickByAcc(right_zupt, right_kick, last_right_kick, right_kick_wait, right_acc[0] / 2048.f, right_acc_x_buff, right_shoes_data_vector)
-		&& unzuptValid(max_acc_unzupt_right, min_acc_unzupt_right))
+	if (getKickByAcc(right_zupt, right_kick, last_right_kick, right_kick_wait, right_acc[2] / 2048.f, right_acc_x_buff, right_shoes_data_vector)
+		&& unzuptValid(max_acc_unzupt_right, min_acc_unzupt_right) && CANCLE_JUMP == 0)
 	{
 	{
-		//统计踢的动作
+		//统锟斤拷锟竭的讹拷锟斤拷
 		addMotionCount(KICK_COUNT);
 		addMotionCount(KICK_COUNT);
 
 
 		CANCLE_FLOOR_CMD_RIGHT = 1;
 		CANCLE_FLOOR_CMD_RIGHT = 1;
@@ -141,10 +159,10 @@ void Kongfu::Process(int time_stamp, int* right_pos, int* right_att, int* right_
 	}
 	}
 
 
 
 
-	//获取触地
-	if (last_left_zupt == 0 && left_zupt == 1 && unzuptValid(max_acc_unzupt_left, min_acc_unzupt_left))
+	//锟斤拷取锟斤拷锟斤拷
+	if (last_left_zupt == 0 && left_zupt == 1 && unzuptValid(max_acc_unzupt_left, min_acc_unzupt_left) && CANCLE_JUMP == 0)
 	{
 	{
-		//统计步数
+		//统锟狡诧拷锟斤拷
 		addMotionCount(STEP_COUNT);
 		addMotionCount(STEP_COUNT);
 
 
 		if (CANCLE_FLOOR_CMD_LEFT == 0)
 		if (CANCLE_FLOOR_CMD_LEFT == 0)
@@ -160,9 +178,9 @@ void Kongfu::Process(int time_stamp, int* right_pos, int* right_att, int* right_
 	}
 	}
 
 
 
 
-	if (last_right_zupt == 0 && right_zupt == 1 && unzuptValid(max_acc_unzupt_right, min_acc_unzupt_right))
+	if (last_right_zupt == 0 && right_zupt == 1 && unzuptValid(max_acc_unzupt_right, min_acc_unzupt_right) &&CANCLE_JUMP == 0)
 	{
 	{
-		//统计步数
+		//统锟狡诧拷锟斤拷
 		addMotionCount(STEP_COUNT);
 		addMotionCount(STEP_COUNT);
 
 
 		if (CANCLE_FLOOR_CMD_RIGHT == 0)
 		if (CANCLE_FLOOR_CMD_RIGHT == 0)
@@ -187,137 +205,21 @@ void Kongfu::Process(int time_stamp, int* right_pos, int* right_att, int* right_
 		std::cout << "right motion is kick" << endl;
 		std::cout << "right motion is kick" << endl;
 	}
 	}
 
 
-	//filter down jump
-
-	if (last_jump == 0 && jump == 1 && cmd_jump_wait_time== 0)
-	{
-		cmd_jump_wait_time = CMD_JUMP_WAIT_TIME;
-
-		valid_jump_wait_time = WAIT_TIME;
-	}
-	else
-	{
-		result[2] = -1;
-	}
-
-	if (cmd_jump_wait_time > 0)
-	{
-		if (left_acc_deque.size() == 5)
-		{
-			int left_max_val = *(std::max_element(left_acc_deque.begin(), left_acc_deque.end()));
-			int left_min_val = *(std::min_element(left_acc_deque.begin(), left_acc_deque.end()));
-
-			int right_max_val = *(std::max_element(right_acc_deque.begin(), right_acc_deque.end()));
-			int right_min_val = *(std::min_element(right_acc_deque.begin(), right_acc_deque.end()));
-
-
-			if (left_max_val - left_min_val > 1024 && right_max_val - right_min_val > 1024)
-			{
-				result[2] = MOTION_JUMP;
-
-				addMotionCount(JUMP_COUNT);
-
-				cmd_jump_wait_time = 0;
-			}
-		}
-	}
-
-	if (cmd_jump_wait_time > 0)
-	{
-		cmd_jump_wait_time--;
-	}
-
-
-
-	//reset jump wait time when both foot isn't on the floor
-	if ((valid_jump_wait_time > 0 && left_zupt == 0 && right_zupt == 0) || jump == 1)
-	{
-		valid_jump_wait_time = WAIT_TIME;
-	}
-
-	if (valid_jump_wait_time > 0)
-	{
-		CANCLE_JUMP = 1;
-
-		valid_jump_wait_time--;
-	}
-	else
-	{
-		CANCLE_JUMP = 0;
-	}
 
 
-	//仿造踢馆大师,特殊处理蹲看看效果
-	left_acc_deque.push_back(left_acc[2]);
-	right_acc_deque.push_back(right_acc[2]);
-
-	if (left_acc_deque.size() > 5)
-	{
-		left_acc_deque.pop_front();
-		right_acc_deque.pop_front();
-	}
-
-	int acc_valid = 0;
-	if (left_acc_deque.size() == 5)
-	{
-		int left_max_val = *(std::max_element(left_acc_deque.begin(), left_acc_deque.end()));
-		int left_min_val = *(std::min_element(left_acc_deque.begin(), left_acc_deque.end()));
-
-		int right_max_val = *(std::max_element(right_acc_deque.begin(), right_acc_deque.end()));
-		int right_min_val = *(std::min_element(right_acc_deque.begin(), right_acc_deque.end()));
-
-
-		if (left_max_val - left_min_val < 512 && right_max_val - right_min_val < 512)
-		{
-			acc_valid = 1;
-		}
-	}
+	
 
 
 	result[3] = -1;
 	result[3] = -1;
 	//same process with jump
 	//same process with jump
-	if (last_down == 0 && down == 1 && CANCLE_DOWN == 0)
+	if (last_down == 0 && down == 1)
 	{
 	{
-		/*std::cout << "H5GAME:: MOTION_DOWN" << endl;
+		std::cout << "H5GAME:: MOTION_DOWN" << endl;
 
 
 		result[3] = MOTION_DOWN;
 		result[3] = MOTION_DOWN;
 
 
-		addMotionCount(DOWN_COUNT);*/
-
-		valid_down_wait_time = WAIT_TIME;
-		wait_down = 6;
-	}
-
-	if (wait_down == 1 && acc_valid == 1)
-	{
 		addMotionCount(DOWN_COUNT);
 		addMotionCount(DOWN_COUNT);
 
 
-		std::cout << "KONGFU:: MOTION_DOWN" << endl;
-		result[3] = MOTION_DOWN;
-	}
-
-
-	if (wait_down > 0)
-	{
-		wait_down--;
 	}
 	}
 
 
-	if ((valid_jump_wait_time > 0) || down == 1)
-	{
-		valid_down_wait_time = WAIT_TIME;
-	}
-
-	if (valid_down_wait_time > 0)
-	{
-		CANCLE_DOWN = 1;
-
-		if (down == 0)
-		{
-			valid_down_wait_time--;
-		}
-	}
-	else
-	{
-		CANCLE_DOWN = 0;
-	}
 
 
 
 
 	last_left_zupt = left_zupt;
 	last_left_zupt = left_zupt;
@@ -328,4 +230,9 @@ void Kongfu::Process(int time_stamp, int* right_pos, int* right_att, int* right_
 
 
 	setPolarAccUnzupt(max_acc_unzupt_left, min_acc_unzupt_left, left_acc, left_zupt);
 	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);
 	setPolarAccUnzupt(max_acc_unzupt_right, min_acc_unzupt_right, right_acc, right_zupt);
+
+	if (CANCLE_JUMP > 0)
+	{
+		CANCLE_JUMP--;
+	}
 }
 }

+ 24 - 32
plugin/shoes_sdk/ios/Classes/src/RunGame.cpp

@@ -22,8 +22,8 @@ void RunGame::Process(int time_stamp, int* right_pos, int* right_att, int* right
 	int jump, int down, int rssi)
 	int jump, int down, int rssi)
 {
 {
 
 
-	// 额外处理蹲
-	down = 0;
+	// 锟斤拷锟解处锟斤拷锟�
+	/*down = 0;
 	int online_down = extract_motion.online_detect_down(right_front_press, left_front_press, right_back_press, left_back_press,
 	int online_down = extract_motion.online_detect_down(right_front_press, left_front_press, right_back_press, left_back_press,
 		right_acc, left_acc);
 		right_acc, left_acc);
 	if (online_down)
 	if (online_down)
@@ -36,22 +36,22 @@ void RunGame::Process(int time_stamp, int* right_pos, int* right_att, int* right
 	if (online_jump)
 	if (online_jump)
 	{
 	{
 		jump = online_jump;
 		jump = online_jump;
-	}
+	}*/
 
 
-	//存放一步的空中数据到shoes_data_vector 队列中, 头必须是触地时刻信
+	//锟斤拷锟揭伙拷锟斤拷目锟斤拷锟斤拷锟斤拷莸锟絪hoes_data_vector 锟斤拷锟斤拷锟叫o拷 头锟斤拷锟斤拷锟角达拷锟斤拷时锟斤拷锟斤拷
 	setData(right_shoes_data_vector, time_stamp, right_pos[0] * 0.001f, right_pos[1] * 0.001f, right_pos[2] * 0.001f,
 	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);
 		right_att[0] * 0.0001f, right_att[1] * 0.0001f, right_att[2] * 0.0001f, right_zupt, rssi);
 
 
 	setData(left_shoes_data_vector, time_stamp, left_pos[0] * 0.001f, left_pos[1] * 0.001f, left_pos[2] * 0.001f,
 	setData(left_shoes_data_vector, time_stamp, left_pos[0] * 0.001f, left_pos[1] * 0.001f, left_pos[2] * 0.001f,
 		left_att[0] * 0.0001f, left_att[1] * 0.0001f, left_att[2] * 0.0001f, left_zupt, rssi);
 		left_att[0] * 0.0001f, left_att[1] * 0.0001f, left_att[2] * 0.0001f, left_zupt, rssi);
 
 
-	//计算全局位置,选择当前的旋转量为这一步即将离地时候的方向,额外的旋转量为10度
-	//hoes_data_vector存的是鞋子上传的数据,它的方向是鞋子烧录时候的方向,并不是玩游戏时候的方向,需要旋转至玩游戏的方向
-	//step_data_vector 的位置已经选择到游戏的方向了,位置是相对位移,即相对于left_step_data_vector[0]的位置偏移
+	//锟斤拷锟斤拷全锟斤拷位锟矫o拷选锟斤拷前锟斤拷锟斤拷转锟斤拷为锟斤拷一锟斤拷锟斤拷锟斤拷锟斤拷锟绞憋拷锟侥凤拷锟津,讹拷锟斤拷锟斤拷锟阶�拷锟轿�10锟斤拷
+	//hoes_data_vector锟斤拷锟斤拷锟叫�拷锟斤拷洗锟斤拷锟斤拷锟斤拷荩锟斤拷锟斤拷姆锟斤拷锟斤拷锟叫�拷锟斤拷锟铰际憋拷锟侥凤拷锟津,诧拷锟斤拷锟斤拷锟斤拷锟斤拷戏时锟斤拷姆锟斤拷锟斤拷锟揭�拷锟阶�拷锟斤拷锟斤拷锟较凤拷姆锟斤拷锟�
+	//step_data_vector 锟斤拷位锟斤拷锟窖撅拷选锟斤拷锟斤拷戏锟侥凤拷锟斤拷锟剿o拷位锟斤拷锟斤拷锟斤拷锟轿伙拷疲锟斤拷锟斤拷锟斤拷锟斤拷left_step_data_vector[0]锟斤拷位锟斤拷偏锟斤拷
 	calGlobalPos(right_shoes_data_vector, right_step_data_vector, right_global_pos, right_shoes_data_vector[0].heading, 10.0f / 180 * PI, RIGHT_FOOT);
 	calGlobalPos(right_shoes_data_vector, right_step_data_vector, right_global_pos, right_shoes_data_vector[0].heading, 10.0f / 180 * PI, RIGHT_FOOT);
 	calGlobalPos(left_shoes_data_vector, left_step_data_vector, left_global_pos, left_shoes_data_vector[0].heading, -10.0f / 180 * PI, LEFT_FOOT);
 	calGlobalPos(left_shoes_data_vector, left_step_data_vector, left_global_pos, left_shoes_data_vector[0].heading, -10.0f / 180 * PI, LEFT_FOOT);
 
 
-	//这里为了脚本容易观测,设置全局位置为0
+	//锟斤拷锟斤拷为锟剿脚憋拷锟斤拷锟阶观测,锟斤拷锟斤拷全锟斤拷位锟斤拷为0
 	if (left_step_data_vector.front().zupt == 0)
 	if (left_step_data_vector.front().zupt == 0)
 	{
 	{
 		memset(left_global_pos, 0, 3 * sizeof(float));
 		memset(left_global_pos, 0, 3 * sizeof(float));
@@ -63,15 +63,15 @@ void RunGame::Process(int time_stamp, int* right_pos, int* right_att, int* right
 	}
 	}
 
 
 
 
-	//判断命令触发
+	//锟叫讹拷锟斤拷锟筋触锟斤拷
 	int left_cmd = -1;
 	int left_cmd = -1;
 	if (left_step_data_vector.size() > 1 && left_step_data_vector.front().zupt == 1)
 	if (left_step_data_vector.size() > 1 && left_step_data_vector.front().zupt == 1)
 	{
 	{
-		//跑酷游戏只要有空中的数据(不想其他游戏一样需要落地时候判断就好),就需要进行游戏
+		std::cout << left_step_data_vector.back().pos_x << ", " << left_step_data_vector.back().pos_y << endl;
+		//锟杰匡拷锟斤拷戏只要锟叫匡拷锟叫碉拷锟斤拷锟捷o拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷戏一锟斤拷锟斤拷要锟斤拷锟绞憋拷锟斤拷卸暇秃茫锟斤拷锟斤拷锟斤拷锟揭�拷锟斤拷锟斤拷锟较�
 		if (left_step_data_vector.back().zupt || left_step_data_vector.back().pitch < 0.3f)
 		if (left_step_data_vector.back().zupt || left_step_data_vector.back().pitch < 0.3f)
 		{
 		{
-			//垫脚跑不触发命令。如果硬要垫脚跑,那么就等到他触地的时候再判断了
-
+			//锟斤拷锟斤拷懿锟斤拷锟斤拷锟斤拷锟斤拷睢o拷锟斤拷硬要锟斤拷锟斤拷埽锟斤拷锟矫达拷偷鹊锟斤拷锟斤拷锟斤拷氐锟绞憋拷锟斤拷锟斤拷卸锟斤拷锟�
 			float max_val = left_step_data_vector.front().pos_x;
 			float max_val = left_step_data_vector.front().pos_x;
 
 
 			for (int i = 0; i < left_step_data_vector.size(); i++)
 			for (int i = 0; i < left_step_data_vector.size(); i++)
@@ -81,7 +81,7 @@ void RunGame::Process(int time_stamp, int* right_pos, int* right_att, int* right
 					max_val = left_step_data_vector[i].pos_x;
 					max_val = left_step_data_vector[i].pos_x;
 				}
 				}
 			}
 			}
-			//有效距离为0.23m
+			//锟斤拷效锟斤拷锟斤拷为0.23m
 			if (max_val - left_step_data_vector.back().pos_x > 0.23f)
 			if (max_val - left_step_data_vector.back().pos_x > 0.23f)
 			{
 			{
 				left_cmd = MOTION_LEFT;
 				left_cmd = MOTION_LEFT;
@@ -170,10 +170,10 @@ void RunGame::Process(int time_stamp, int* right_pos, int* right_att, int* right
 
 
 		wait_down = 0;
 		wait_down = 0;
 	}
 	}
-
-	if (wait_down == 1  && acc_valid == 1)
+	//std::cout << "test_down" << endl;
+	//if (wait_down == 1  && acc_valid == 1)
 	//if (wait_down == 10)
 	//if (wait_down == 10)
-	//if(down)
+	if(down)
 	{
 	{
 
 
 		addMotionCount(DOWN_COUNT);
 		addMotionCount(DOWN_COUNT);
@@ -196,13 +196,13 @@ void RunGame::Process(int time_stamp, int* right_pos, int* right_att, int* right
 	result[2] = jump_cmd;
 	result[2] = jump_cmd;
 	//result[3] = down_cmd;
 	//result[3] = down_cmd;
 
 
-	//续一个空中不能触发蹲的命令
+	//锟斤拷一锟斤拷锟斤拷锟叫诧拷锟杰达拷锟斤拷锟阶碉拷锟斤拷锟斤拷
 	/*if (left_zupt == 0 && right_zupt == 0 && down_wait_after_jump > 0)
 	/*if (left_zupt == 0 && right_zupt == 0 && down_wait_after_jump > 0)
 	{
 	{
 		down_wait_after_jump = 10;
 		down_wait_after_jump = 10;
 	}*/
 	}*/
 
 
-	//计步
+	//锟狡诧拷
 	if (last_left_zupt == 0 && left_zupt == 1 && unzuptValid(max_acc_unzupt_left, min_acc_unzupt_left))
 	if (last_left_zupt == 0 && left_zupt == 1 && unzuptValid(max_acc_unzupt_left, min_acc_unzupt_left))
 	{
 	{
 		addMotionCount(STEP_COUNT);
 		addMotionCount(STEP_COUNT);
@@ -227,27 +227,19 @@ int RunGame::getResultDown(int down)
 
 
 	int canva_down = ((down & 0x04) > 0 ? 1 : 0);
 	int canva_down = ((down & 0x04) > 0 ? 1 : 0);
 	
 	
-
-
-	if (last_canva_down == 0 && canva_down == 1 && down_wait_after_jump < 0)
-	//if (last_canva_down == 0 && canva_down == 1 )
-	{
-		isDown = MOTION_DOWN;
-	}
-	else if (last_down == 0 && down > 0 && down_wait_after_jump < 0)
-	//if ( last_down == 0 && down == 1)
+	if (last_down == 0 && down > 0)
 	{
 	{
 		isDown = 1;
 		isDown = 1;
 
 
-		//addMotionCount(DOWN_COUNT);
+		addMotionCount(DOWN_COUNT);
 
 
-		//std::cout << "motion : down" << std::endl;
+		std::cout << "motion : down" << std::endl;
 
 
 		//down_count++;
 		//down_count++;
 	}
 	}
 	/*
 	/*
-	* down_wait_after_jump:避免前脚蹲后,接着后脚压下来的情况,当down_wait_after_jump == -1时候,判断蹲生
-	* 当一直处于蹲的时候,额外加拖延时间,在这个时间不允许触发蹲。
+	* down_wait_after_jump:锟斤拷锟斤拷前锟脚蹲后,斤拷锟脚猴拷锟窖癸拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷down_wait_after_jump == -1时锟斤拷锟叫断讹拷锟斤拷
+	* 锟斤拷一直锟斤拷锟节蹲碉拷时锟津,讹拷锟斤拷锟斤拷锟斤拷锟绞憋拷洌�拷锟斤拷锟斤拷时锟戒不锟斤拷锟斤拷锟斤拷锟阶★拷
 	*/
 	*/
 
 
 	if (down == 0 && down_wait_after_jump >=0)
 	if (down == 0 && down_wait_after_jump >=0)
@@ -279,7 +271,7 @@ int RunGame::getResultJump(int jump)
 		jump_count++;
 		jump_count++;
 	}
 	}
 	/*
 	/*
-	* 跳之后不能立即接着蹲,用down_wait_after_jump来避免
+	* 锟斤拷之锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟脚蹲o拷锟斤拷down_wait_after_jump锟斤拷锟斤拷锟斤拷
 	*/
 	*/
 	if (jump)
 	if (jump)
 	{
 	{

+ 12 - 6
plugin/shoes_sdk/ios/Classes/src/TestGame.cpp

@@ -4,6 +4,8 @@ TestGame::TestGame()
 {
 {
 	 jump_valid_time = 0;
 	 jump_valid_time = 0;
 	 jump_calm_down = 0;
 	 jump_calm_down = 0;
+
+	 last_jump = 0;
 }
 }
 
 
 
 
@@ -12,11 +14,6 @@ void TestGame::Process(int time_stamp, int* right_pos, int* right_att, int* righ
 	int jump, int down, int rssi)
 	int jump, int down, int rssi)
 {
 {
 
 
-	static deque<int> left_acc_deque;
-	static deque<int> right_acc_deque;
-	static int jump_valid_time;
-	static int jump_calm_down;
-
 	result[0] = -1;
 	result[0] = -1;
 	
 	
 	if (left_acc_deque.size() > 10)
 	if (left_acc_deque.size() > 10)
@@ -36,7 +33,9 @@ void TestGame::Process(int time_stamp, int* right_pos, int* right_att, int* righ
 		&& max_left_acc > 3096 && max_right_acc > 3096 && left_acc[2] < 1024 && right_acc[2] < 1024 && 
 		&& max_left_acc > 3096 && max_right_acc > 3096 && left_acc[2] < 1024 && right_acc[2] < 1024 && 
 		left_acc_deque.front() > 1500 && right_acc_deque.front() > 1500)
 		left_acc_deque.front() > 1500 && right_acc_deque.front() > 1500)
 	{
 	{
-		result[0] = MOTION_JUMP;
+
+		jump = 1;
+		//result[0] = MOTION_JUMP;
 		left_acc_deque.clear();
 		left_acc_deque.clear();
 		right_acc_deque.clear();
 		right_acc_deque.clear();
 
 
@@ -49,6 +48,13 @@ void TestGame::Process(int time_stamp, int* right_pos, int* right_att, int* righ
 		jump_calm_down--;
 		jump_calm_down--;
 	}
 	}
 
 
+	if (last_jump == 0 && jump == 1)
+	{
+		result[0] = MOTION_JUMP;
+	}
+
+	last_jump = jump;
+
 
 
 }
 }
 
 

+ 14 - 14
plugin/shoes_sdk/ios/Classes/src/online_motion.cpp

@@ -62,7 +62,7 @@ void top_point(deque<int> &left_front_mag_queue , int &top_index, int &left_inde
 
 
 }
 }
 
 
-//最小值滤波
+//锟斤拷小值锟剿诧拷
 int online_motion::min_window_val(deque<int>& press_deque, int mid_window_size)
 int online_motion::min_window_val(deque<int>& press_deque, int mid_window_size)
 {
 {
 	deque<int> press_deque_temp = press_deque;
 	deque<int> press_deque_temp = press_deque;
@@ -109,11 +109,11 @@ int online_motion::online_detect_down(int right_front_mag, int left_front_mag, i
 	int* right_acc, int* left_acc)
 	int* right_acc, int* left_acc)
 {
 {
 
 
-	//滑动窗口补充
+	//锟斤拷锟斤拷锟斤拷锟节诧拷锟斤拷
 	left_press_filter_window.push_back(left_back_mag);
 	left_press_filter_window.push_back(left_back_mag);
 	right_press_filter_window.push_back(right_back_mag);
 	right_press_filter_window.push_back(right_back_mag);
 
 
-	//采用最小值滤波, 较好的过滤毛刺
+	//锟斤拷锟斤拷锟斤拷小值锟剿诧拷锟斤拷 锟较好的癸拷锟斤拷毛锟斤拷
 	if (left_press_filter_window.size() > 5)
 	if (left_press_filter_window.size() > 5)
 	{
 	{
 		left_press_filter_window.pop_front();
 		left_press_filter_window.pop_front();
@@ -224,8 +224,8 @@ int online_motion::online_detect_down(int right_front_mag, int left_front_mag, i
 			break;
 			break;
 		}
 		}
 
 
-		if (*max_element(left_front_acc.begin() , left_front_acc.end()) - *min_element(left_front_acc.begin() , left_front_acc.end()) < 256
-			&& *max_element(right_front_acc.begin() , right_front_acc.end()) - *min_element(right_front_acc.begin() , right_front_acc.end()) < 256)
+		if (*max_element(left_front_acc.begin() + 10 , left_front_acc.end()) - *min_element(left_front_acc.begin() + 10, left_front_acc.end()) < 256
+			&& *max_element(right_front_acc.begin() + 10, right_front_acc.end()) - *min_element(right_front_acc.begin() + 10, right_front_acc.end()) < 256)
 		{
 		{
 			if (right_front_temp.size() > 5 && left_front_temp.size() > 5 && left_front_temp.front() >  left_front_temp.back() + 1500
 			if (right_front_temp.size() > 5 && left_front_temp.size() > 5 && left_front_temp.front() >  left_front_temp.back() + 1500
 				&& right_front_temp.front() > right_front_temp.back() + 1500
 				&& right_front_temp.front() > right_front_temp.back() + 1500
@@ -237,7 +237,7 @@ int online_motion::online_detect_down(int right_front_mag, int left_front_mag, i
 
 
 	}
 	}
 
 
-	//继续补充 微小变动的
+	//锟斤拷锟斤拷锟斤拷锟斤拷 微小锟戒动锟斤拷
 	int little_front_down = 0;
 	int little_front_down = 0;
 
 
 
 
@@ -281,7 +281,7 @@ int online_motion::online_detect_down(int right_front_mag, int left_front_mag, i
 
 
 	if (left_front_mag_canve_queue.size() > 9)
 	if (left_front_mag_canve_queue.size() > 9)
 	{
 	{
-		//1、补充蹲,检测到一个完成的波视为蹲就好
+		//1锟斤拷锟斤拷锟斤拷祝锟斤拷锟解到一锟斤拷锟斤拷傻牟锟斤拷锟轿�拷拙秃锟�
 
 
 		int left_top_index;
 		int left_top_index;
 		int left_foot_left_side_index, left_foot_right_side_index;
 		int left_foot_left_side_index, left_foot_right_side_index;
@@ -292,11 +292,11 @@ int online_motion::online_detect_down(int right_front_mag, int left_front_mag, i
 		top_point(right_front_mag_canve_queue, right_top_index, right_foot_left_side_index, right_foot_right_side_index);
 		top_point(right_front_mag_canve_queue, right_top_index, right_foot_left_side_index, right_foot_right_side_index);
 
 
 		if (
 		if (
-			abs(left_top_index - right_top_index) < 4    //保持定点位置不要相差太多
-			&& left_front_mag_canve_queue[left_top_index] > left_front_mag_canve_queue[left_foot_left_side_index] + 800
-			&& left_front_mag_canve_queue[left_top_index] > left_front_mag_canve_queue[left_foot_right_side_index] + 800
-			&& right_front_mag_canve_queue[right_top_index] > right_front_mag_canve_queue[right_foot_left_side_index] + 800
-			&& right_front_mag_canve_queue[right_top_index] > right_front_mag_canve_queue[right_foot_right_side_index] + 800)
+			abs(left_top_index - right_top_index) < 4    //锟斤拷锟街讹拷锟斤拷位锟矫诧拷要锟斤拷锟教�拷锟�
+			&&left_front_mag_canve_queue[left_top_index] > left_front_mag_canve_queue[left_foot_left_side_index] + 700
+			&& left_front_mag_canve_queue[left_top_index] > left_front_mag_canve_queue[left_foot_right_side_index] + 700
+			&& right_front_mag_canve_queue[right_top_index] > right_front_mag_canve_queue[right_foot_left_side_index] + 700
+			&& right_front_mag_canve_queue[right_top_index] > right_front_mag_canve_queue[right_foot_right_side_index] + 700)
 		{
 		{
 			little_front_down = 1;
 			little_front_down = 1;
 		}
 		}
@@ -363,7 +363,7 @@ int online_motion::online_detect_down(int right_front_mag, int left_front_mag, i
 }
 }
 
 
 /*
 /*
-* 检测触地的一个东西
+* 锟斤拷獯ワ拷氐锟揭伙拷锟斤拷锟斤拷锟�
 */
 */
 
 
 void online_motion::push_press_queue(deque<int>& press_queue, int press, int queue_size)
 void online_motion::push_press_queue(deque<int>& press_queue, int press, int queue_size)
@@ -427,7 +427,7 @@ int online_motion::online_detect_touch_floor(int right_front_mag, int left_front
 
 
 
 
 /*
 /*
-* 在线检测跳
+* 锟斤拷锟竭硷拷锟斤拷锟�
 */
 */
 
 
 int online_motion::online_detect_jump(int right_front_mag, int left_front_mag, int right_back_mag, int  left_back_mag,
 int online_motion::online_detect_jump(int right_front_mag, int left_front_mag, int right_back_mag, int  left_back_mag,