[chronojump] Encoder historical records and feedback of also meanSpeed and meanForce
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder historical records and feedback of also meanSpeed and meanForce
- Date: Fri, 7 Feb 2020 17:59:56 +0000 (UTC)
commit 82357d9d896944c682e422513bbb2d5e4771f17e
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Feb 7 18:30:49 2020 +0100
Encoder historical records and feedback of also meanSpeed and meanForce
src/gui/app1/chronojump.cs | 2 +-
src/gui/app1/encoder.cs | 83 +++++++++++++++++++++++++++++++----------
src/gui/encoderGraphObjects.cs | 34 +++++++++++------
src/gui/repetitiveConditions.cs | 14 +++++--
src/sqlite/encoder.cs | 22 ++++++-----
5 files changed, 110 insertions(+), 45 deletions(-)
---
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 5d9c1493..87ba275f 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -7045,7 +7045,7 @@ LogB.Debug("mc finished 5");
configChronojump.PlaySoundsFromFile,
captureCurvesBarsData,
encoderCaptureListStore,
- maxPowerIntersession);
+ sendMaxPowerSpeedForceIntersession(mainVariable));
} else
UtilGtk.ErasePaint(encoder_capture_curves_bars_drawingarea,
encoder_capture_curves_bars_pixmap);
}
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index 6f654ec3..a3c0c755 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -653,7 +653,8 @@ public partial class ChronoJumpWindow
}
*/
- double findMaxPowerIntersession()
+ //find best historical values for feedback on meanPower, meanSpeed, meanForce
+ private void findMaxPowerSpeedForceIntersession()
{
//finding historical maxPower of a person in an exercise
Constants.EncoderGI encGI = getEncoderGI();
@@ -661,25 +662,42 @@ public partial class ChronoJumpWindow
getExerciseIDFromEncoderCombo(exerciseCombos.CAPTURE), "curve",
EncoderSQL.Eccons.ALL, getLateralityFromGui(true),
false, false);
- double maxPower = 0;
+
+ maxPowerIntersession = 0;
+ maxSpeedIntersession = 0;
+ maxForceIntersession = 0;
if(encGI == Constants.EncoderGI.GRAVITATORY)
{
//TODO: do a regression to find maxPower with a value of extraWeight unused
double extraWeight = Convert.ToDouble(spin_encoder_extra_weight.Value);
- foreach(EncoderSQL es in arrayTemp) {
-
if(Util.SimilarDouble(Convert.ToDouble(Util.ChangeDecimalSeparator(es.extraWeight)), extraWeight) &&
- Convert.ToDouble(es.future1) > maxPower)
- maxPower = Convert.ToDouble(es.future1);
+ foreach(EncoderSQL es in arrayTemp)
+ {
+
if(Util.SimilarDouble(Convert.ToDouble(Util.ChangeDecimalSeparator(es.extraWeight)), extraWeight))
+ {
+ if(Convert.ToDouble(es.future1) > maxPowerIntersession)
+ maxPowerIntersession = Convert.ToDouble(es.future1);
+ if(Convert.ToDouble(es.future2) > maxSpeedIntersession)
+ maxSpeedIntersession = Convert.ToDouble(es.future2);
+ if(Convert.ToDouble(es.future3) > maxForceIntersession)
+ maxForceIntersession = Convert.ToDouble(es.future3);
+ }
}
}
else if(encGI == Constants.EncoderGI.INERTIAL)
{
foreach(EncoderSQL es in arrayTemp)
- if(es.encoderConfiguration == encoderConfigurationCurrent &&
Convert.ToDouble(es.future1) > maxPower)
- maxPower = Convert.ToDouble(es.future1);
+ {
+ if(es.encoderConfiguration == encoderConfigurationCurrent)
+ {
+ if(Convert.ToDouble(es.future1) > maxPowerIntersession)
+ maxPowerIntersession = Convert.ToDouble(es.future1);
+ if(Convert.ToDouble(es.future2) > maxSpeedIntersession)
+ maxSpeedIntersession = Convert.ToDouble(es.future2);
+ if(Convert.ToDouble(es.future3) > maxForceIntersession)
+ maxForceIntersession = Convert.ToDouble(es.future3);
+ }
+ }
}
-
- return maxPower;
}
bool canCaptureEncoder()
@@ -872,6 +890,8 @@ public partial class ChronoJumpWindow
}
double maxPowerIntersession;
+ double maxSpeedIntersession;
+ double maxForceIntersession;
//called from main GUI
void on_button_encoder_capture_clicked (object o, EventArgs args)
{
@@ -897,7 +917,7 @@ public partial class ChronoJumpWindow
firstSetOfCont = firstSet;
- maxPowerIntersession = findMaxPowerIntersession();
+ findMaxPowerSpeedForceIntersession();
//LogB.Information("maxPower: " + maxPowerIntersession);
if(encoderThreadBG != null && encoderThreadBG.IsAlive) //if we are capturing on the
background ...
@@ -1672,7 +1692,7 @@ public partial class ChronoJumpWindow
* if we have not captured yet, just Sqlite select now
*/
if(! repetitiveConditionsWin.EncoderRelativeToSet)
- maxPowerIntersession = findMaxPowerIntersession();
+ findMaxPowerSpeedForceIntersession();
spin_encoder_extra_weight.Value =
Convert.ToDouble(Util.ChangeDecimalSeparator(eSQL.extraWeight));
@@ -2469,6 +2489,8 @@ public partial class ChronoJumpWindow
}
string meanPowerStr = "";
+ string meanSpeedStr = "";
+ string meanForceStr = "";
string desc = "";
if(mode == "curve") {
EncoderCurve curve = treeviewEncoderCaptureCurvesGetCurve(selectedID,true);
@@ -2479,6 +2501,8 @@ public partial class ChronoJumpWindow
int duration = Convert.ToInt32(decimal.Truncate(Convert.ToDecimal(curve.Duration)));
meanPowerStr = curve.MeanPower;
+ meanSpeedStr = curve.MeanSpeed;
+ meanForceStr = curve.MeanForce;
if(ecconLast != "c") {
EncoderCurve curveNext =
treeviewEncoderCaptureCurvesGetCurve(selectedID+1,false);
@@ -2495,7 +2519,9 @@ public partial class ChronoJumpWindow
//duration is duration of ecc + duration of iso + duration of concentric
duration += (isometricDuration + curveConDuration);
- meanPowerStr = curveNext.MeanPower; //take power of concentric phase
+ meanPowerStr = curveNext.MeanPower; //concentric phase
+ meanSpeedStr = curveNext.MeanSpeed; //concentric phase
+ meanForceStr = curveNext.MeanForce; //concentric phase
}
/*
@@ -2573,6 +2599,8 @@ public partial class ChronoJumpWindow
if(mode == "curve") {
eSQL.status = "active";
eSQL.future1 = meanPowerStr;
+ eSQL.future2 = meanSpeedStr;
+ eSQL.future3 = meanForceStr;
}
eSQL.encoderConfiguration = encoderConfigurationCurrent;
@@ -5312,7 +5340,7 @@ public partial class ChronoJumpWindow
configChronojump.PlaySoundsFromFile,
captureCurvesBarsData,
encoderCaptureListStore,
- maxPowerIntersession);
+
sendMaxPowerSpeedForceIntersession(preferences.encoderCaptureMainVariable));
}
}
@@ -5457,6 +5485,17 @@ public partial class ChronoJumpWindow
encoder_capture_signal_allocationXOld = allocation.Width;
}
+ private double sendMaxPowerSpeedForceIntersession(Constants.EncoderVariablesCapture evc)
+ {
+ if(evc == Constants.EncoderVariablesCapture.MeanPower)
+ return maxPowerIntersession;
+ else if(evc == Constants.EncoderVariablesCapture.MeanSpeed)
+ return maxSpeedIntersession;
+ else if(evc == Constants.EncoderVariablesCapture.MeanForce)
+ return maxForceIntersession;
+
+ return maxPowerIntersession; //default if any problem
+ }
/*
@@ -6134,7 +6173,7 @@ public partial class ChronoJumpWindow
configChronojump.PlaySoundsFromFile,
captureCurvesBarsData,
encoderCaptureListStore,
- maxPowerIntersession);
+
sendMaxPowerSpeedForceIntersession(preferences.encoderCaptureMainVariable));
//}
needToRefreshTreeviewCapture = false;
@@ -6645,7 +6684,7 @@ public partial class ChronoJumpWindow
}
- maxPowerIntersession = findMaxPowerIntersession();
+ findMaxPowerSpeedForceIntersession();
encoderGraphDoPlot.NewPreferences(preferences);
encoderGraphDoPlot.Start(
@@ -6658,7 +6697,7 @@ public partial class ChronoJumpWindow
configChronojump.PlaySoundsFromFile,
captureCurvesBarsData,
encoderCaptureListStore,
- maxPowerIntersession);
+
sendMaxPowerSpeedForceIntersession(preferences.encoderCaptureMainVariable));
button_encoder_signal_save_comment.Label = Catalog.GetString("Save comment");
button_encoder_signal_save_comment.Sensitive = false;
@@ -6748,7 +6787,7 @@ public partial class ChronoJumpWindow
manageCurvesOfThisSignal();
//update meanPower on SQL encoder
- findAndMarkSavedCurves(true, true); //SQL opened; update curve SQL
records (like future1: meanPower)
+ findAndMarkSavedCurves(true, true); //SQL opened; update curve SQL
records (like future1: meanPower, 2 and 3)
Sqlite.Close();
@@ -7105,10 +7144,16 @@ public partial class ChronoJumpWindow
encoderCaptureSelectBySavedCurves(esc.msCentral, true);
if(updateSQLRecords) {
- //update the future1
+ //update the future1, future2, future3
Sqlite.Update(true, Constants.EncoderTable, "future1",
"", curve.MeanPower,
"uniqueID", esc.curveID.ToString());
+ Sqlite.Update(true, Constants.EncoderTable, "future2",
+ "", curve.MeanSpeed,
+ "uniqueID", esc.curveID.ToString());
+ Sqlite.Update(true, Constants.EncoderTable, "future3",
+ "", curve.MeanForce,
+ "uniqueID", esc.curveID.ToString());
}
break;
diff --git a/src/gui/encoderGraphObjects.cs b/src/gui/encoderGraphObjects.cs
index 85a1872e..5f1d984f 100644
--- a/src/gui/encoderGraphObjects.cs
+++ b/src/gui/encoderGraphObjects.cs
@@ -45,7 +45,7 @@ public class EncoderGraphDoPlot
private bool playSoundsFromFile;
private ArrayList data7Variables;
private Gtk.ListStore encoderCaptureListStore;
- private double maxPowerIntersession;
+ private double maxPowerSpeedForceIntersession; //it will be one of these 3
private int discardFirstN;
private int showNRepetitions;
@@ -139,7 +139,8 @@ public class EncoderGraphDoPlot
string secondaryVariable, bool capturing, string eccon,
RepetitiveConditionsWindow repetitiveConditionsWin,
bool hasInertia, bool playSoundsFromFile,
- ArrayList data7Variables, Gtk.ListStore encoderCaptureListStore, double
maxPowerIntersession)
+ ArrayList data7Variables, Gtk.ListStore encoderCaptureListStore,
+ double maxPowerSpeedForceIntersession)
{
this.mainVariable = mainVariable;
this.mainVariableHigher = mainVariableHigher;
@@ -153,7 +154,7 @@ public class EncoderGraphDoPlot
this.playSoundsFromFile = playSoundsFromFile;
this.data7Variables = data7Variables;
this.encoderCaptureListStore = encoderCaptureListStore;
- this.maxPowerIntersession = maxPowerIntersession;
+ this.maxPowerSpeedForceIntersession = maxPowerSpeedForceIntersession;
graphWidth = drawingarea.Allocation.Width;
graphHeight = drawingarea.Allocation.Height;
@@ -356,18 +357,19 @@ public class EncoderGraphDoPlot
return;
double maxAbsolute = maxThisSet;
+ //can be on meanPower, meanSpeed, meanForce
if(! repetitiveConditionsWin.EncoderRelativeToSet)
{
//relative to historical of this person
/*
*
- * if there's a set captured but without repetitions saved, maxPowerIntersession will
be 0
+ * if there's a set captured but without repetitions saved,
maxPowerSpeedForceIntersession will be 0
* and current set (loaded or captured) will have a power that will be out of the
graph
* for this reason use maxAbsolute or maxThisSet, whatever is higher
*/
- if(maxPowerIntersession > maxAbsolute)
- maxAbsolute = maxPowerIntersession;
+ if(maxPowerSpeedForceIntersession > maxAbsolute)
+ maxAbsolute = maxPowerSpeedForceIntersession;
}
//calculate maxAbsoluteSecondary (will be secondary variable)
@@ -432,23 +434,33 @@ public class EncoderGraphDoPlot
//sum saved curves to do avg
double sumSaved = 0;
double countSaved = 0;
+ string units = "";
//draw line for person max intersession
if(! repetitiveConditionsWin.EncoderRelativeToSet)
{
layout_encoder_capture_curves_bars_text.SetMarkup("Person's best:");
layout_encoder_capture_curves_bars_text.GetPixelSize(out textWidth, out textHeight);
- pixmap.DrawLayout (pen_yellow_encoder_capture,
+ pixmap.DrawLayout (pen_black_encoder_capture,
left_margin, top_margin - textHeight,
layout_encoder_capture_curves_bars_text);
- pixmap.DrawLine(pen_yellow_encoder_capture,
+ pixmap.DrawLine(pen_black_encoder_capture,
left_margin, top_margin,
graphWidth - right_margin, top_margin);
- layout_encoder_capture_curves_bars_text.SetMarkup(Util.TrimDecimals(maxAbsolute, 1) +
"W");
+
+ int decs = 0;
+ if(mainVariable == Constants.MeanPower)
+ units = " W";
+ else if(mainVariable == Constants.MeanSpeed) {
+ units = " m/s";
+ decs = 2;
+ } else if(mainVariable == Constants.MeanForce)
+ units = " N";
+ layout_encoder_capture_curves_bars_text.SetMarkup(Util.TrimDecimals(maxAbsolute,
decs) + units);
layout_encoder_capture_curves_bars_text.GetPixelSize(out textWidth, out textHeight);
- pixmap.DrawLayout (pen_yellow_encoder_capture,
+ pixmap.DrawLayout (pen_black_encoder_capture,
graphWidth - (right_margin + textWidth),
top_margin - textHeight,
layout_encoder_capture_curves_bars_text);
@@ -684,7 +696,7 @@ public class EncoderGraphDoPlot
// start plot title ----->
- string units = "";
+ units = "";
int decimals;
if(mainVariable == Constants.MeanSpeed || mainVariable == Constants.MaxSpeed) {
diff --git a/src/gui/repetitiveConditions.cs b/src/gui/repetitiveConditions.cs
index 6ebb1ce4..5c8b6e87 100644
--- a/src/gui/repetitiveConditions.cs
+++ b/src/gui/repetitiveConditions.cs
@@ -336,8 +336,12 @@ public class RepetitiveConditionsWindow
//need to do it "manually" at start
hbox_combo_encoder_secondary_variable.Visible =
check_encoder_show_secondary_variable.Active;
- if(encoderCaptureMainVariableThisSetOrHistorical ||
- encoderMainVariable != Constants.EncoderVariablesCapture.MeanPower)
//MeanPower is the only one who has historical
+ //MeanPower, MeanSpeed, MeanFOrce can be historical
+ if(encoderCaptureMainVariableThisSetOrHistorical || (
+ encoderMainVariable !=
Constants.EncoderVariablesCapture.MeanPower &&
+ encoderMainVariable !=
Constants.EncoderVariablesCapture.MeanSpeed &&
+ encoderMainVariable !=
Constants.EncoderVariablesCapture.MeanForce
+ ) )
radio_encoder_relative_to_set.Active = true;
else
radio_encoder_relative_to_historical.Active = true;
@@ -405,8 +409,10 @@ public class RepetitiveConditionsWindow
{
string mainVariable = UtilGtk.ComboGetActive(combo_encoder_main_variable);
- radio_encoder_relative_to_historical.Visible = (mainVariable == "Mean power");
- if(mainVariable != "Mean power")
+ radio_encoder_relative_to_historical.Visible =
+ (mainVariable == "Mean power" || mainVariable == "Mean speed" || mainVariable ==
"Mean force");
+
+ if(mainVariable != "Mean power" && mainVariable != "Mean speed" && mainVariable != "Mean
force")
radio_encoder_relative_to_set.Active = true;
label_main_variable_text.Text = mainVariable;
diff --git a/src/sqlite/encoder.cs b/src/sqlite/encoder.cs
index 616a9d6a..a137e245 100644
--- a/src/sqlite/encoder.cs
+++ b/src/sqlite/encoder.cs
@@ -60,8 +60,8 @@ class SqliteEncoder : Sqlite
"encoderConfiguration TEXT, " + //text separated by ':'
"future1 TEXT, " + //Since 1.4.4 (DB 1.06) this stores last meanPower detected
on a curve
//(as string with '.' because future1 was created as TEXT)
- "future2 TEXT, " +
- "future3 TEXT )";
+ "future2 TEXT, " + //same as future1
+ "future3 TEXT )"; //same as future1
dbcmd.ExecuteNonQuery();
}
@@ -91,7 +91,7 @@ class SqliteEncoder : Sqlite
"\", \"" + es.status + "\", \"" +
Util.MakeURLrelative(es.videoURL) + "\", \"" +
es.encoderConfiguration.ToStringOutput(EncoderConfiguration.Outputs.SQL) + "\", \"" +
- Util.ConvertToPoint(es.future1) + "\", \"" + es.future2 + "\", \"" + es.future3 +
"\")";
+ Util.ConvertToPoint(es.future1) + "\", \"" + Util.ConvertToPoint(es.future2) + "\",
\"" + Util.ConvertToPoint(es.future3) + "\")";
LogB.SQL(dbcmd.CommandText.ToString());
dbcmd.ExecuteNonQuery();
@@ -141,9 +141,9 @@ class SqliteEncoder : Sqlite
"\", status = \"" + es.status +
"\", videoURL = \"" + Util.MakeURLrelative(es.videoURL) +
"\", encoderConfiguration = \"" +
es.encoderConfiguration.ToStringOutput(EncoderConfiguration.Outputs.SQL) +
- "\", future1 = \"" + Util.ConvertToPoint(es.future1) +
- "\", future2 = \"" + es.future2 +
- "\", future3 = \"" + es.future3 +
+ "\", future1 = \"" + Util.ConvertToPoint(es.future1) +
+ "\", future2 = \"" + Util.ConvertToPoint(es.future2) +
+ "\", future3 = \"" + Util.ConvertToPoint(es.future3) +
"\" WHERE uniqueID == " + es.uniqueID ;
LogB.SQL(mycmd.CommandText.ToString());
@@ -315,8 +315,8 @@ class SqliteEncoder : Sqlite
videoURL, //videoURL
econf, //encoderConfiguration
Util.ChangeDecimalSeparator(reader[16].ToString()), //future1
(meanPower on curves)
- reader[17].ToString(), //future2
- reader[18].ToString(), //future3
+ Util.ChangeDecimalSeparator(reader[17].ToString()), //future2
(meanSpeed on curves)
+ Util.ChangeDecimalSeparator(reader[18].ToString()), //future3
(meanForce on curves)
reader[19].ToString() //EncoderExercise.name
);
array.Add (eSQL);
@@ -535,7 +535,7 @@ class SqliteEncoder : Sqlite
Sqlite.Open();
dbcmd.CommandText =
- "SELECT person77.name, person77.sex, encoder.encoderConfiguration,
encoderExercise.name, encoder.extraWeight, encoder.future1 " +
+ "SELECT person77.name, person77.sex, encoder.encoderConfiguration,
encoderExercise.name, encoder.extraWeight, encoder.future1 " + //TODO: future2, future3
"FROM person77, encoderExercise, encoder " +
"WHERE sessionID = " + sessionID.ToString() +
" AND signalOrCurve = \"curve\" " +
@@ -571,6 +571,7 @@ class SqliteEncoder : Sqlite
reader[3].ToString(), //encoder exercise name
Util.ChangeDecimalSeparator(reader[4].ToString()), //extra mass
reader[5].ToString() //power
+ //TODO: speed, force
};
array.Add (s);
} else {
@@ -579,6 +580,7 @@ class SqliteEncoder : Sqlite
reader[1].ToString(), //person sex
reader[3].ToString(), //encoder exercise name
reader[5].ToString() //power
+ //TODO: speed, force
};
array.Add (s);
}
@@ -603,7 +605,7 @@ class SqliteEncoder : Sqlite
"signalID INT, " +
"curveID INT, " +
"msCentral INT, " +
- "future1 TEXT )"; //need future2, future3. Better to use alter table here and on
encoder table
+ "future1 TEXT )"; //right now unused. need future2, future3. Better to use alter
table here and on encoder table
dbcmd.ExecuteNonQuery();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]