[chronojump] Better abs values on calculations at encoder paint
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Better abs values on calculations at encoder paint
- Date: Fri, 9 Dec 2016 16:05:19 +0000 (UTC)
commit 1387473c951ac697d721f7522a029524475fdeb6
Author: Xavier Padullés <x padulles gmail com>
Date: Fri Dec 9 17:04:01 2016 +0100
Better abs values on calculations at encoder paint
encoder/graph.R | 7 ++++++-
encoder/util.R | 8 ++++----
2 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index c529955..b227d26 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -2844,7 +2844,12 @@ doProcess <- function(options)
par(new=T)
ylimHeight = max(abs(range(accel$y)))
ylim=c(- 1.05 * ylimHeight, 1.05 * ylimHeight) #put 0 in the middle, and
have 5% margin at each side
- plot(abs(accel$y), col="magenta", ylim=ylim, type="l", xlab="",ylab="",axes=F)
+
+ if(isInertial(op$EncoderConfigurationName))
+ plot(abs(accel$y), col="magenta", ylim=ylim, type="l",
xlab="",ylab="",axes=F)
+ else
+ plot(accel$y, col="magenta", ylim=ylim, type="l",
xlab="",ylab="",axes=F)
+
axis(4, col="magenta", lty=lty[1], line=axisLineRight, lwd=1, padj=-.5)
axisLineRight = axisLineRight +2
}
diff --git a/encoder/util.R b/encoder/util.R
index e7ee258..0c019ff 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -883,7 +883,7 @@ getDynamicsInertial <- function(encoderConfigurationName, displacement, diameter
anglePush = 90 #TODO: send from C#
forceDisc = abs(inertiaMomentum * angleAccel) * (2 / diameter.m)
- forceBody = mass * (accel + g * sin(anglePush * pi / 180))
+ forceBody = mass * (abs(accel) + g * sin(anglePush * pi / 180))
powerDisc = abs((inertiaMomentum * angleAccel) * angleSpeed)
powerBody = abs(mass * (accel + g * sin(anglePush * pi / 180)) * speed)
@@ -901,7 +901,7 @@ getDynamicsInertial <- function(encoderConfigurationName, displacement, diameter
#If the movement is horizontal g*sin(alpha) = 0
forceDisc = abs(inertiaMomentum * angleAccel) * (2 / diameter.m)
- forceBody = mass * (accel + g * sin(anglePush * pi / 180))
+ forceBody = mass * (abs(accel) + g * sin(anglePush * pi / 180))
powerDisc = abs((inertiaMomentum * angleAccel) * angleSpeed)
powerBody = abs(mass * (accel + g * sin(anglePush * pi / 180)) * speed)
@@ -915,13 +915,13 @@ getDynamicsInertial <- function(encoderConfigurationName, displacement, diameter
anglePush = 0 #TODO: send from C#
forceDisc = abs(inertiaMomentum * angleAccel) * (2 / diameter.m)
- forceBody = mass * accel
+ forceBody = mass * abs(accel)
powerDisc = abs((inertiaMomentum * angleAccel) * angleSpeed)
powerBody = abs(mass * accel * speed)
}
- force = abs(forceDisc / gearedDown) + abs(forceBody)
+ force = (forceDisc / gearedDown) + forceBody
power = powerDisc + powerBody
loopsMax = diameter.m * max(angle)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]