From 5720dcc638099ffa26abab0f7069bb29d2daa478 Mon Sep 17 00:00:00 2001
From: Samuel Tardieu <sam@rfc1149.net>
Date: Fri, 12 Jul 2024 08:33:55 +0200
Subject: [PATCH] Adapt PID coefficients to updated speed ranges

---
 controller/python/localpid.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/controller/python/localpid.py b/controller/python/localpid.py
index b0bd33a..7a793a2 100644
--- a/controller/python/localpid.py
+++ b/controller/python/localpid.py
@@ -5,15 +5,15 @@
 from controller import Controller
 import time
 
-k_p = 0.3
-k_i = 0.005
+k_p = 0.25
+k_i = 0.004
 k_d = 0
 
 min_speed = 0
 precision = 10
 
 
-# distance and max_speed are in ticks
+# distance and max_speed are in ticks, max_motor_speed
 def advance(c, distance, max_speed):
     # Configure motor speed
     c.set_max_percentage(100)
@@ -93,7 +93,7 @@ def command(err, acc, der):
 c = Controller()
 assert c.who_am_i() == 0x57
 try:
-    advance(c, 20000, 50)
+    advance(c, 20000, 40)
     # advance(c, -10000, 50)
 except KeyboardInterrupt:
     print("Stopping engine")
-- 
GitLab