From 9d938cf59fe4c4a13c738189720f3f162380379b Mon Sep 17 00:00:00 2001
From: m-guberina <gubi.guberina@gmail.com>
Date: Tue, 21 Nov 2023 00:53:08 +0100
Subject: [PATCH] this should be the fix. i am 100% on this. just move it
 closer and it will work

---
 python/examples/fixes_for_demo.md         | 3 +++
 python/ur_simple_control/basics/basics.py | 8 +++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/python/examples/fixes_for_demo.md b/python/examples/fixes_for_demo.md
index aa3489d..6a80169 100644
--- a/python/examples/fixes_for_demo.md
+++ b/python/examples/fixes_for_demo.md
@@ -1,3 +1,6 @@
+THERE WAS A NORM IN THE ERROR TERM IN MOVEJ THAT'S WHY IT KEPT GOING FORWARD
+GOD DAMN IT
+thank you jesus for showing me that one, good lord thank you
 1. i'm pretty sure why it goes so far with movej is because you gave it a tight error.
    well, give it a lax error then. atm there is a single instance where you're running this command,
    so it's fine, you cares. bottom line is, be above the starting point, and then go down with 
diff --git a/python/ur_simple_control/basics/basics.py b/python/ur_simple_control/basics/basics.py
index 20189ab..748cd9e 100644
--- a/python/ur_simple_control/basics/basics.py
+++ b/python/ur_simple_control/basics/basics.py
@@ -25,13 +25,15 @@ def moveJControlLoop(q_desired, robot, i, past_data):
     q = q[:6]
     q_error = q_desired - q
 
-    # STOP MUCH BEFORE YOU NEED TO
+    # STOP MUCH BEFORE YOU NEED TO FOR THE DEMO
     # EVEN THIS MIGHT BE TOO MUCH
-    if np.linalg.norm(q_error) < 1e-1:
+    # TODO fix later obviously
+    if np.linalg.norm(q_error) < 1e-3:
         breakFlag = True
     # stupid hack, for the love of god remove this
     # but it should be small enough lel
-    qd = q_error / (np.linalg.norm(q_error) *14)
+    # there. fixed. tko radi taj i grijesi, al jebemu zivot sta je to bilo
+    qd = q_error * robot.dt
     robot.sendQd(qd)
     return breakFlag, {}, {}
 
-- 
GitLab