Differences

This shows you the differences between two versions of the page.

Link to this comparison view

iothings:laboratoare:2025_code:lab7_1 [2025/11/05 18:55]
dan.tudose created
iothings:laboratoare:2025_code:lab7_1 [2025/11/05 19:16] (current)
dan.tudose
Line 104: Line 104:
 static int bootstrap_count = 0; static int bootstrap_count = 0;
 static bool model_ready = false; static bool model_ready = false;
 +static bool stage_prompted[3] = {false, false, false};
 +constexpr int BOOTSTRAP_STAGE_WINDOWS = 10; // ~20 s total per instruction phase
  
 // ===== helpers ===== // ===== helpers =====
Line 118: Line 120:
   Serial.printf("​feat:​ aMean=%.3f, aStd=%.3f, gMean=%.3f, gStd=%.3f\n",​   Serial.printf("​feat:​ aMean=%.3f, aStd=%.3f, gMean=%.3f, gStd=%.3f\n",​
                 x.f[0], x.f[1], x.f[2], x.f[3]);                 x.f[0], x.f[1], x.f[2], x.f[3]);
 +}
 +
 +void prompt_bootstrap_stage() {
 +  if (model_ready) {
 +    return;
 +  }
 +
 +  if (bootstrap_count < BOOTSTRAP_STAGE_WINDOWS && !stage_prompted[0]) {
 +    Serial.println("​Stage 1/3: move the board UP and DOWN for the first cluster."​);​
 +    Serial.println("​Collecting motion windows... keep moving!"​);​
 +    stage_prompted[0] = true;
 +  } else if (bootstrap_count >= BOOTSTRAP_STAGE_WINDOWS &&
 +             ​bootstrap_count < 2 * BOOTSTRAP_STAGE_WINDOWS && !stage_prompted[1]) {
 +    Serial.println("​Stage 2/3: move the board LEFT and RIGHT for the second cluster."​);​
 +    Serial.println("​Keep sweeping side-to-side until prompted again."​);​
 +    stage_prompted[1] = true;
 +  } else if (bootstrap_count >= 2 * BOOTSTRAP_STAGE_WINDOWS &&
 +             ​bootstrap_count < 3 * BOOTSTRAP_STAGE_WINDOWS && !stage_prompted[2]) {
 +    Serial.println("​Stage 3/3: hold the board STILL to capture the stationary cluster."​);​
 +    Serial.println("​Stay steady while we finish collecting samples."​);​
 +    stage_prompted[2] = true;
 +  }
 } }
  
Line 179: Line 203:
  
   Serial.println("​IMU Activity Clustering (K-means, K=3)."​);​   Serial.println("​IMU Activity Clustering (K-means, K=3)."​);​
-  Serial.println("​Bootstrapping ~60 s of windows ​for unsupervised init..."​);​+  Serial.println("​Bootstrapping ~80 s of guided motion ​for unsupervised init..."​); 
 +  prompt_bootstrap_stage();
 } }
  
 void loop() { void loop() {
 +  prompt_bootstrap_stage();​
 +
   Feature feat = compute_window_features();​   Feature feat = compute_window_features();​
   print_feature(feat);​   print_feature(feat);​
iothings/laboratoare/2025_code/lab7_1.1762361745.txt.gz · Last modified: 2025/11/05 18:55 by dan.tudose
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0