[chronojump] Force sensor GetVariabilityAndAccuracy Error (feedback) fixed
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Force sensor GetVariabilityAndAccuracy Error (feedback) fixed
- Date: Fri, 7 Jun 2019 13:14:45 +0000 (UTC)
commit 3887b49feb04b3e69a54b3fb8cb30ce9a4d13063
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Jun 7 15:14:08 2019 +0200
Force sensor GetVariabilityAndAccuracy Error (feedback) fixed
src/forceSensor.cs | 27 +++++++++++++++++----------
src/gui/forceSensorAnalyze.cs | 8 ++++----
2 files changed, 21 insertions(+), 14 deletions(-)
---
diff --git a/src/forceSensor.cs b/src/forceSensor.cs
index ea024d8c..82888bbf 100644
--- a/src/forceSensor.cs
+++ b/src/forceSensor.cs
@@ -247,7 +247,7 @@ public class ForceSensorCapturePoints
double elapsedSeconds = times[countB]/1000000.0 - times[countA]/1000000.0;
return sum * Util.DivideSafe(elapsedSeconds, samples);
}
- public void GetVariabilityAndAccuracy(int countA, int countB, int feedbackN, out double variability,
out double feedbackDifference)
+ public void GetVariabilityAndAccuracy(int countA, int countB, int feedbackF, out double variability,
out double feedbackDifference)
{
if(countA == countB)
{
@@ -265,17 +265,24 @@ public class ForceSensorCapturePoints
for(int i = countA; i <= countB; i ++)
sum += forces[i];
-
double avg = sum / numSamples;
- // 2) move all the forces to 0 (substracting from average)
- // and have them in absolute value
- double sumAt0 = 0;
+ // 2) Average of the differences between force and average
+ sum = 0;
+ for(int i = countA; i <= countB; i ++)
+ sum += Math.Abs(forces[i]-avg);
+
+ variability = Util.DivideSafe(sum, numSamples);
+
+ // 3) Calculate difference.
+ // Average of the differences between force and average
+
+ //feedbackDifference = Math.Abs(feedbackF - avg);
+ sum = 0;
for(int i = countA; i <= countB; i ++)
- sumAt0 += Math.Abs(forces[i]-avg);
+ sum += Math.Abs(forces[i]-feedbackF);
- variability = Util.DivideSafe(sumAt0, numSamples);
- feedbackDifference = Math.Abs(feedbackN - avg);
+ feedbackDifference = Util.DivideSafe(sum, numSamples);
}
public int MarginLeft
@@ -871,9 +878,9 @@ public class ForceSensorAnalyzeInstant
}
public void CalculateVariabilityAndAccuracy(int countA, int countB,
- int feedbackN, out double variability, out double feedbackDifference)
+ int feedbackF, out double variability, out double feedbackDifference)
{
- fscAIPoints.GetVariabilityAndAccuracy(countA, countB, feedbackN, out variability, out
feedbackDifference);
+ fscAIPoints.GetVariabilityAndAccuracy(countA, countB, feedbackF, out variability, out
feedbackDifference);
}
/*
* Calculates RFD in a point using previous and next point
diff --git a/src/gui/forceSensorAnalyze.cs b/src/gui/forceSensorAnalyze.cs
index a38ac4cb..68f7283a 100644
--- a/src/gui/forceSensorAnalyze.cs
+++ b/src/gui/forceSensorAnalyze.cs
@@ -1003,9 +1003,9 @@ public partial class ChronoJumpWindow
// 11) calculate and paint variability
double variability = 0;
double feedbackDiff = 0;
- int feedbackN = Convert.ToInt32(spin_force_sensor_capture_feedback_at.Value);
+ int feedbackF = Convert.ToInt32(spin_force_sensor_capture_feedback_at.Value);
- fsAI.CalculateVariabilityAndAccuracy(hscaleLower, hscaleHigher, feedbackN, out
variability, out feedbackDiff);
+ fsAI.CalculateVariabilityAndAccuracy(hscaleLower, hscaleHigher, feedbackF, out
variability, out feedbackDiff);
layout_force_ai_text.SetMarkup(string.Format("Variability: {0:0.#} N",
Math.Round(variability, 1) ));
@@ -1016,9 +1016,9 @@ public partial class ChronoJumpWindow
layout_force_ai_text);
// 12) calculate and paint Accuracy (Feedback difference)
- if(feedbackN > 0)
+ if(feedbackF > 0)
{
- layout_force_ai_text.SetMarkup(string.Format("Accuracy (vs Feedback): {0:0.#}
N",
+ layout_force_ai_text.SetMarkup(string.Format("Error (Feedback): {0:0.#} N",
Math.Round(feedbackDiff, 1) ));
layout_force_ai_text.GetPixelSize(out textWidth, out textHeight);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]