From cf9052d9cff2370e2aced11be4d0620947c227e8 Mon Sep 17 00:00:00 2001
From: arno gay-bauer <arno.gay-bauer@u-psud.fr>
Date: Thu, 7 Jun 2018 09:40:54 +0000
Subject: [PATCH] :bug: Fixed the smoother activation on the wrong frames

---
 scripts/correct_trajectories.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/scripts/correct_trajectories.py b/scripts/correct_trajectories.py
index d5439a98..2693e014 100644
--- a/scripts/correct_trajectories.py
+++ b/scripts/correct_trajectories.py
@@ -302,9 +302,11 @@ def handleAllPoint(trajData,geoData):
     
     smooth_order = 3
     for index,inputs in enumerate(new_trajectories):
-        if (smooth_order < int(inputs[1]) and index < len(new_trajectories)-smooth_order and new_trajectories[index + smooth_order][0] == new_trajectories[index][0]):
-            new_x,new_y = smoothPoint(new_trajectories[index - smooth_order : index + smooth_order])
-            new_trajectories[index] = [inputs[0],inputs[1],floatToString(new_x),floatToString(new_y),inputs[4]]
+        if (smooth_order < index and index < len(new_trajectories)-smooth_order 
+            and new_trajectories[index + smooth_order][0] == new_trajectories[index][0]
+            and new_trajectories[index - smooth_order][0] == new_trajectories[index][0]):
+                new_x,new_y = smoothPoint(new_trajectories[index - smooth_order : index + smooth_order])
+                new_trajectories[index] = [inputs[0],inputs[1],floatToString(new_x),floatToString(new_y),inputs[4]]
         if (math.fmod(index,10000) == 0):
             print("Smoothing: [",index,"/",len(trajData),"]")   
            
-- 
GitLab