From f361edfc8f13046119ca4713aebc4ecbdb978522 Mon Sep 17 00:00:00 2001 From: wutong88yuyu <2179751939@qq.com> Date: Thu, 18 Dec 2025 18:39:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E5=8F=96=E7=AE=80=E5=8D=95=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=99=A8=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Active-Lane-Keeping-Assistant/agent.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Active-Lane-Keeping-Assistant/agent.py b/src/Active-Lane-Keeping-Assistant/agent.py index 091c3df28d..6c51f98c18 100644 --- a/src/Active-Lane-Keeping-Assistant/agent.py +++ b/src/Active-Lane-Keeping-Assistant/agent.py @@ -7,7 +7,8 @@ class Agent(): """Agent that outputs the desired behaviour given """ - + SIMPLE_STEER_LIMIT = 0.75 + SIMPLE_ERROR_TOLERANCE = 0.1 def __init__(self, tau_p:float = 0, tau_d:float = 0, tau_i:float = 0, surface_lower_threshold:float = 20e6, throttle:float = 0.3, suface_upper_threshold=30e6, controller:str = 'simple') -> None: @@ -146,12 +147,14 @@ def _simple_controller(error:float) -> float: Returns: float: Steering angle to use. """ - if (abs(error) < 0.1): + limit = 0.75 + tolerance = 0.1 + if (abs(error) < tolerance): steer = 0 elif error > 0: - steer = -0.75 + steer = -limit else: - steer = 0.75 + steer = limit return steer def _p_controller(self, error:float) -> float: