[chronojump] encoder analyze single array is readed from C#
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] encoder analyze single array is readed from C#
- Date: Wed, 27 Jan 2016 21:05:53 +0000 (UTC)
commit 4a5ddad9fca5f9461d9d8653050dd7b2745510e2
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Jan 27 22:05:15 2016 +0100
encoder analyze single array is readed from C#
encoder/graph.R | 14 ++++++++++++++
src/encoder.cs | 44 ++++++++++++++++++++++++++++++++++++++++++++
src/gui/encoder.cs | 8 ++++++++
3 files changed, 66 insertions(+), 0 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index 40de644..b2eff00 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -2760,6 +2760,20 @@ doProcess <- function(options)
(op$AnalysisVariables[3] == "Force"), #show force
(op$AnalysisVariables[4] == "Power") #show power
)
+
+
+ #record array of data
+ write("going to create array of data", stderr())
+ kn <- kinematicsF(displacement[curves[op$Jump,1]:curves[op$Jump,2]],
+ repOp,
+ SmoothingsEC[smoothingPos], op$SmoothingOneC, g, isPropulsive)
+
+ df=data.frame(cbind(kn$speedy, kn$accely, kn$force, kn$power))
+ colnames(df)=c("speed","acceleration","force","power")
+
+ write("going to write it to file", stderr())
+ write.csv(df, op$SpecialData, quote=FALSE)
+ write("done!", stderr())
}
}
diff --git a/src/encoder.cs b/src/encoder.cs
index 6a48e08..d452a51 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -1439,3 +1439,47 @@ public class EncoderConfiguration {
return code + str_d + str_D + str_anglePush + str_angleWeight + str_inertia + str_gearedDown;
}
}
+
+public class EncoderAnalyzeInstant
+{
+ public List<double> speed;
+ public List<double> accel;
+ public List<double> force;
+ public List<double> power;
+
+ public EncoderAnalyzeInstant() {
+ speed = new List<double>();
+ accel = new List<double>();
+ force = new List<double>();
+ power = new List<double>();
+ }
+
+ public void ReadFile(string filename)
+ {
+ List<string> lines = Util.ReadFileAsStringList(filename);
+ if(lines == null)
+ return;
+ if(lines.Count <= 1) //return if there's only the header
+ return;
+
+ bool headerLine = true;
+ foreach(string l in lines) {
+ if(headerLine) {
+ headerLine = false;
+ continue;
+ }
+
+ string [] lsplit = l.Split(new char[] {','});
+ speed.Add(Convert.ToDouble(Util.ChangeDecimalSeparator(lsplit[1])));
+ accel.Add(Convert.ToDouble(Util.ChangeDecimalSeparator(lsplit[2])));
+ force.Add(Convert.ToDouble(Util.ChangeDecimalSeparator(lsplit[3])));
+ power.Add(Convert.ToDouble(Util.ChangeDecimalSeparator(lsplit[4])));
+ }
+ }
+
+ public void PrintDebug() {
+ LogB.Information("Printing speed");
+ foreach(double s in speed)
+ LogB.Debug(s.ToString());
+ }
+}
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 0fd33f8..50d0027 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -5611,6 +5611,14 @@ public partial class ChronoJumpWindow
createTreeViewEncoderAnalyze(contents);
}
}
+
+ if(encoderAnalysis == "single") {
+ EncoderAnalyzeInstant eai = new EncoderAnalyzeInstant();
+ eai.ReadFile(
+ UtilEncoder.GetEncoderSpecialDataTempFileName());
+ //eai.PrintDebug();
+ }
+
}
button_encoder_analyze.Visible = true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]