[chronojump] paint debug mode for loopsAblines (WIP)
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] paint debug mode for loopsAblines (WIP)
- Date: Fri, 24 Jul 2015 13:21:02 +0000 (UTC)
commit 2100fd9fa632a0c95b57ea8cf1dda69675358d26
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Jul 24 15:20:07 2015 +0200
paint debug mode for loopsAblines (WIP)
encoder/graph.R | 23 +++++++++++++++++++++++
encoder/util.R | 9 +++++++--
2 files changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index 6d7c9df..621ba37 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -964,6 +964,7 @@ paint <- function(displacement, eccon, xmin, xmax, yrange, knRanges, superpose,
else
plot(startX:length(speedPlot),speedPlot[startX:length(speedPlot)],type="l",
xlim=c(1,length(displacement)),ylim=ylim,xlab="",ylab="",col="darkgreen",lty=2,lwd=3,axes=F)
+
}
if(draw & showSpeed & !superpose) {
@@ -1073,6 +1074,28 @@ paint <- function(displacement, eccon, xmin, xmax, yrange, knRanges, superpose,
power = dynamics$power
+ if(draw && isInertial(encoderConfigurationName) && debug)
+ {
+ #start blank graph with ylim of position
+ ylim = yrange
+ if(ylim[1] == "undefined") {
+ ylim = NULL
+ ylim = c(min(position-min(position)), max(position-min(position)))
+ }
+ par(new=T)
+ plot(0,0,type="n",axes=F,xlab="",ylab="", ylim=ylim)
+
+ abline(h=100*dynamics$loopsAblines, col="yellow") #m -> cm
+ print("dynamics$loopsAblines")
+ print(dynamics$loopsAblines)
+
+ print("ylim")
+ print(ylim)
+
+ #TODO: add here angleSpeed graph when diameter is variable (version 1.5.3)
+ }
+
+
if(draw & showForce) {
ylimHeight = max(abs(range(force)))
ylim=c(- 1.05 * ylimHeight, 1.05 * ylimHeight) #put 0 in the middle, and have 5% margin at
each side
diff --git a/encoder/util.R b/encoder/util.R
index d84f29b..fd62e56 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -743,6 +743,7 @@ getDynamicsInertial <- function(encoderConfigurationName, displacement, diameter
position.m = abs(cumsum(displacement)) / 1000 #m
diameter.m = diameter / 100 #cm -> m
+ angleSpeed = 0
forceDisc = 0
forceBody = 0
powerDisc = 0
@@ -799,8 +800,12 @@ getDynamicsInertial <- function(encoderConfigurationName, displacement, diameter
force = forceDisc + forceBody
power = powerDisc + powerBody
- #return(list(displacement=displacement, mass=mass, force=force, power=power))
- return(list(displacement=displacement, mass=mass, force=force, power=power, forceDisc=forceDisc,
forceBody=forceBody, powerDisc=powerDisc, powerBody=powerBody))
+ loopsMax = diameter.m * max(angle)
+ loopsAblines = seq(from=0, to=loopsMax, by=diameter.m*pi)
+
+ return(list(displacement=displacement, mass=mass, force=force, power=power,
+ loopsAblines=loopsAblines, angleSpeed=angleSpeed,
+ forceDisc=forceDisc, forceBody=forceBody, powerDisc=powerDisc, powerBody=powerBody))
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]