[chronojump] Fixed mass on LINEARONPLANEWEIGHTDIFFANGLE. canJump only in linear and inverted
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Fixed mass on LINEARONPLANEWEIGHTDIFFANGLE. canJump only in linear and inverted
- Date: Thu, 16 Apr 2015 17:10:46 +0000 (UTC)
commit 10a5102778ee00588960726ce9e4fcb9060d13d5
Author: Xavier Padullés <x padulles gmail com>
Date: Thu Apr 16 19:09:23 2015 +0200
Fixed mass on LINEARONPLANEWEIGHTDIFFANGLE. canJump only in linear and inverted
encoder/graph.R | 10 +++++-
encoder/util.R | 89 ++++++++++++++++++++++++++-----------------------------
2 files changed, 51 insertions(+), 48 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index 274e79b..baf1fdc 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -435,6 +435,14 @@ kinematicRanges <- function(singleFile, displacement, curves,
power=c(-maxPower,maxPower)))
}
+canJump <- function(encoderConfigurationName)
+{
+ if(encoderConfigurationName == "LINEAR" || encoderConfigurationName == "LINEARINVERTED")
+ return(TRUE)
+
+ return(FALSE)
+}
+
paint <- function(displacement, eccon, xmin, xmax, yrange, knRanges, superpose, highlight,
startX, startH, smoothingOneEC, smoothingOneC, massBody, massExtra,
@@ -793,7 +801,7 @@ paint <- function(displacement, eccon, xmin, xmax, yrange, knRanges, superpose,
#takeoff = min(which(force[concentric]<=weight)) + length_eccentric + length_isometric
takeoff = -1
- if(length(which(force[concentric] <= 0)) == 0)
+ if(! canJump(encoderConfigurationName) || length(which(force[concentric] <= 0)) == 0)
takeoff = -1
else {
#1 get force only in concentric phase
diff --git a/encoder/util.R b/encoder/util.R
index b72fde6..adc1df7 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -225,37 +225,6 @@ getMass <- function(mass, gearedDown, angle) {
return ( ( mass / gearedDown ) * sin( angle * pi / 180 ) )
}
-getMassBodyByExercise <- function(massBody, exercisePercentBodyWeight) {
- if(massBody == 0 || exercisePercentBodyWeight == 0)
- return (0)
-
- return (massBody * exercisePercentBodyWeight / 100.0)
-}
-
-getMassByEncoderConfiguration <- function(encoderConfigurationName, massBody, massExtra,
exercisePercentBodyWeight, gearedDown, anglePush, angleWeight)
-{
- massBody = getMassBodyByExercise(massBody,exercisePercentBodyWeight)
-
- if(
- encoderConfigurationName == "WEIGHTEDMOVPULLEYLINEARONPERSON1" ||
- encoderConfigurationName == "WEIGHTEDMOVPULLEYLINEARONPERSON1INV" ||
- encoderConfigurationName == "WEIGHTEDMOVPULLEYLINEARONPERSON2" ||
- encoderConfigurationName == "WEIGHTEDMOVPULLEYLINEARONPERSON2INV" ||
- encoderConfigurationName == "WEIGHTEDMOVPULLEYROTARYFRICTION" ||
- encoderConfigurationName == "WEIGHTEDMOVPULLEYROTARYAXIS" )
- {
- massExtra = getMass(massExtra, gearedDown, anglePush)
- } else if(encoderConfigurationName == "LINEARONPLANE") {
- massBody = getMass(massBody, gearedDown, anglePush)
- massExtra = getMass(massExtra, gearedDown, anglePush)
- } else if(encoderConfigurationName == "LINEARONPLANEWEIGHTDIFFANGLE") {
- massBody = getMass(massBody, gearedDown, anglePush)
- massExtra = getMass(massExtra, gearedDown, angleWeight)
- }
-
- mass = massBody + massExtra
- return (mass)
-}
#used in alls eccons
reduceCurveBySpeed <- function(eccon, row, startT, startH, displacement, smoothingOneC)
@@ -607,32 +576,58 @@ isInertial <- function(encoderConfigurationName) {
return(FALSE)
}
+getMassBodyByExercise <- function(massBody, exercisePercentBodyWeight) {
+ return (massBody * exercisePercentBodyWeight / 100.0)
+}
+
getDynamics <- function(encoderConfigurationName,
speed, accel, massBody, massExtra, exercisePercentBodyWeight, gearedDown, anglePush,
angleWeight,
displacement, diameter, inertiaMomentum, smoothing)
{
- mass = getMassByEncoderConfiguration (encoderConfigurationName, massBody, massExtra,
exercisePercentBodyWeight, gearedDown, anglePush, angleWeight)
-
- if(isInertial(encoderConfigurationName))
- return (getDynamicsInertial(encoderConfigurationName, displacement, diameter, mass,
inertiaMomentum, smoothing))
- else
- return (getDynamicsNotInertial (encoderConfigurationName, speed, accel, mass,
exercisePercentBodyWeight, gearedDown, anglePush, angleWeight))
+ massBody = getMassBodyByExercise(massBody,exercisePercentBodyWeight)
+
+ if(
+ encoderConfigurationName == "WEIGHTEDMOVPULLEYLINEARONPERSON1" ||
+ encoderConfigurationName == "WEIGHTEDMOVPULLEYLINEARONPERSON1INV" ||
+ encoderConfigurationName == "WEIGHTEDMOVPULLEYLINEARONPERSON2" ||
+ encoderConfigurationName == "WEIGHTEDMOVPULLEYLINEARONPERSON2INV" ||
+ encoderConfigurationName == "WEIGHTEDMOVPULLEYROTARYFRICTION" ||
+ encoderConfigurationName == "WEIGHTEDMOVPULLEYROTARYAXIS" )
+ {
+ massExtra = getMass(massExtra, gearedDown, anglePush)
+ } else if(encoderConfigurationName == "LINEARONPLANE") {
+ massBody = getMass(massBody, gearedDown, anglePush)
+ massExtra = getMass(massExtra, gearedDown, anglePush)
+ } else if(encoderConfigurationName == "LINEARONPLANEWEIGHTDIFFANGLE") {
+ massBody = getMass(massBody, gearedDown, anglePush)
+ massExtra = getMass(massExtra, gearedDown, angleWeight)
+ }
+
+ massTotal = massBody + massExtra
+
+ if(isInertial(encoderConfigurationName))
+ return (getDynamicsInertial(encoderConfigurationName, displacement, diameter, massTotal,
inertiaMomentum, smoothing))
+ else
+ return (getDynamicsNotInertial (encoderConfigurationName, speed, accel,
+ massBody, massExtra, massTotal,
+ exercisePercentBodyWeight, gearedDown, anglePush, angleWeight))
}
#mass extra can be connected to body or connected to a pulley depending on encoderConfiguration
-getDynamicsNotInertial <- function(encoderConfigurationName, speed, accel, mass, exercisePercentBodyWeight,
gearedDown, anglePush, angleWeight)
-{
- #TODO getDynamicsNotInertial needs massBody, massExtra, alpha, and beta in order to calcule the
- #force in inclinated planes with different push angles
-
- #if(encoderConfigurationName == "LINEARONPLANEWEIGHTDIFFANGLE") {
- # force <- massBody*accel + massBody*g*sin(alpha) + extraMass(g*sin(beta) + accel)
- #}
- force <- mass*(accel+g) #g:9.81 (used when movement is against gravity)
+getDynamicsNotInertial <- function(encoderConfigurationName, speed, accel,
+ massBody, massExtra, massTotal,
+ exercisePercentBodyWeight, gearedDown, anglePush, angleWeight)
+{
+ force = NULL
+ if(encoderConfigurationName == "LINEARONPLANEWEIGHTDIFFANGLE") {
+ force <- massBody*accel + massBody*g*sin(anglePush) + massExtra*(g*sin(angleWeight) + accel)
+ } else {
+ force <- massTotal*(accel+g) #g:9.81 (used when movement is against gravity)
+ }
power <- force*speed
- return(list(mass=mass, force=force, power=power))
+ return(list(mass=massTotal, force=force, power=power))
}
#diameter: diameter of the axis (where string is wrapped)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]