From 2fe0c0a556a437b2d6ed697dc9cdcab98f827996 Mon Sep 17 00:00:00 2001 From: Harry Kimpel Date: Wed, 29 Nov 2023 18:01:27 +0100 Subject: [PATCH] =?UTF-8?q?Anpassung=20fahre=5Fgerade=5Faus=20f=C3=BCr=20n?= =?UTF-8?q?egative=20Strecken?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Harry Kimpel --- iqrobot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iqrobot.py b/iqrobot.py index e2e8890..eba783c 100644 --- a/iqrobot.py +++ b/iqrobot.py @@ -128,8 +128,8 @@ class IQRobot: versatz = self.bewegungsSensor.get_yaw_angle() sum_versatz = sum_versatz + versatz abweichung = (kp * versatz + ki * sum_versatz) / 100 - linker_speed = speed * (1 - abweichung) - rechter_speed = speed * (1 + abweichung) + linker_speed = speed * richtung * (1 - abweichung) + rechter_speed = speed * richtung * (1 + abweichung) self.antrieb.start_tank_at_power(int(linker_speed), int(rechter_speed)) #print("Versatz: " + str(versatz) + " , linker Speed: " + str(linker_speed) + ", rechter Speed: " + str(rechter_speed) + ", strecke: " + str(sum_cm))