From 3e343a5c68bef09faa836d07b88b847104718064 Mon Sep 17 00:00:00 2001 From: George_Andreou Date: Mon, 23 Jun 2025 02:45:48 +0300 Subject: [PATCH] Update --- rally.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rally.py b/rally.py index b7f4757..fb33d46 100644 --- a/rally.py +++ b/rally.py @@ -24,8 +24,8 @@ DECAY_MODE = motor.SLOW_DECAY UPDATE_RATE = 100 # Hz SLEEP_TIME = 1 / UPDATE_RATE BASE_THROTTLE = 0.9 # Base throttle for both motors -Kp_sync = 0.05 # Proportional gain for sync correction -Kd_sync = 0.001 +Kp_sync = 0.08 # Proportional gain for sync correction +Kd_sync = 0.008 prev_error = 0 # Create a digitalinout object for the user switch @@ -93,11 +93,12 @@ while True: if avg >= target_dist: print("Target reached!!!") - mot_left.throttle = left_throttle - mot_right.throttle = right_throttle + mot_left.throttle = 0 + mot_right.throttle = 0 break - mot_right.throttle = 1 - mot_left.throttle = - 1 + mot_right.throttle = - right_throttle + mot_left.throttle = - left_throttle time.sleep(0.05) +print("Finished!!!")