[chronojump] Fixed inertia momentum for machines with low oscillation
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Fixed inertia momentum for machines with low oscillation
- Date: Mon, 2 Mar 2015 18:13:24 +0000 (UTC)
commit ae02d8f830d33709a81da5582ccbbffb6088b8e9
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Mar 2 19:12:28 2015 +0100
Fixed inertia momentum for machines with low oscillation
encoder/inertia-momentum.R | 11 +++--------
src/gui/encoder.cs | 2 +-
2 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/encoder/inertia-momentum.R b/encoder/inertia-momentum.R
index f8dbb2f..57ebe3d 100644
--- a/encoder/inertia-momentum.R
+++ b/encoder/inertia-momentum.R
@@ -73,14 +73,9 @@ calculate <- function (displacement, mass, length)
T = NULL
#T <- diff(tmax[1:length(tmax)])
T <- 2 * diff(tall[1:length(tall)])
- print(c("T",T))
- print("T is null")
- print(is.null(T))
- print(length(T))
-
- print("logT i el Ilog")
- print(log(T))
- print(I(log(tall[1:(length(tall)-1)])))
+
+ if(is.null(T) || length(T) <= 3)
+ return (-1)
#Coefficients of a Logarithmic regression
logT <- lm( log(T) ~ I(log(tall[1:(length(tall)-1)])))
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index d8d62f4..2048b0d 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -5469,7 +5469,7 @@ LogB.Debug("D");
Util.ReadFile(UtilEncoder.GetEncoderSpecialDataTempFileName(), true) );
LogB.Information("imResultText = |" + imResultText + "|");
- if(imResultText == "NA" || imResultText == "")
+ if(imResultText == "NA" || imResultText == "-1" || imResultText == "")
encoder_configuration_win.Button_encoder_capture_inertial_do_ended
(0, "Error capturing. Maybe need more oscillations.");
else {
//script calculates Kg*m^2 -> GUI needs Kg*cm^2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]