From 70e67b8dbd5529ae9d1ad63754150af4c79135a5 Mon Sep 17 00:00:00 2001 From: bernat Date: Thu, 1 Aug 2019 11:36:34 +0200 Subject: [PATCH] Better steering for manual control (#1957) --- CHANGELOG.md | 1 + PythonAPI/examples/manual_control.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dcc8db3f..8ce4bb0b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ ## Latest + * Better steering in manual control * Added Doxygen documentation online with automatic updates through Jenkins pipeline diff --git a/PythonAPI/examples/manual_control.py b/PythonAPI/examples/manual_control.py index 238bc46bf..f440718b9 100755 --- a/PythonAPI/examples/manual_control.py +++ b/PythonAPI/examples/manual_control.py @@ -337,9 +337,15 @@ class KeyboardControl(object): self._control.throttle = 1.0 if keys[K_UP] or keys[K_w] else 0.0 steer_increment = 5e-4 * milliseconds if keys[K_LEFT] or keys[K_a]: - self._steer_cache -= steer_increment + if self._steer_cache > 0: + self._steer_cache = 0 + else: + self._steer_cache -= steer_increment elif keys[K_RIGHT] or keys[K_d]: - self._steer_cache += steer_increment + if self._steer_cache < 0: + self._steer_cache = 0 + else: + self._steer_cache += steer_increment else: self._steer_cache = 0.0 self._steer_cache = min(0.7, max(-0.7, self._steer_cache))