[chronojump/michrolab] Fixed error on encoder R findECPhases on current R versions (in previous R versions was warning)
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump/michrolab] Fixed error on encoder R findECPhases on current R versions (in previous R versions was warning)
- Date: Thu, 14 Jul 2022 16:37:54 +0000 (UTC)
commit cbc08e7274c9a2f4095bce2ed48d0717aea1ad71
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Jun 8 12:00:21 2022 +0200
Fixed error on encoder R findECPhases on current R versions (in previous R versions was warning)
encoder/util.R | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/encoder/util.R b/encoder/util.R
index b89717495..f06904a95 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -585,7 +585,12 @@ kinematicsF <- function(displacement, repOp, smoothingOneEC, smoothingOneC, g, i
concentric = phases$concentric
#temporary fix problem of found MinSpeedEnd at right
- if(eccentric == 0 && isometric == 0 && concentric == 0)
+
+ #if(eccentric == 0 && isometric == 0 && concentric == 0)
+ #condition "if (eccentric == 0)" fails when is a vector on recent R versions, so
check first the length
+ if(length(eccentric) == 1 && eccentric == 0 &&
+ length(isometric) == 1 && isometric == 0 &&
+ length(concentric) == 1 && concentric == 0)
propulsiveEnd = length(displacement)
else {
maxSpeedT <- min(which(speed$y == max(speed$y)))
@@ -619,7 +624,7 @@ kinematicsF <- function(displacement, repOp, smoothingOneEC, smoothingOneC, g, i
if(eccModesStartOnGround && ! isInertial(repOp$econfName) &&
(repOp$eccon == "e" || repOp$eccon == "ec")) {
#if eccentric is undefined, find it
- if(eccentric == 0) {
+ if(length(eccentric == 1) && eccentric == 0) {
if(repOp$eccon == "e")
eccentric = 1:length(displacement)
else { #(repOp$eccon=="ec")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]