From ff58356c23e7e874f3f628d3221f6de43f1015eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 29 May 2026 10:37:44 +0200 Subject: [PATCH] =?UTF-8?q?Auto-Rotate=20blockiert=20Joystick-Parser=20w?= =?UTF-8?q?=C3=A4hrend=20der=20Drehung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rosparam /auto_rotate_active pausiert joystick_parser_node komplett. Modus-Wiederherstellung erst nach Erreichen der Zielposition. Co-Authored-By: Claude Sonnet 4.6 --- scripts/auto_rotate_ros.py | 8 +++++--- src/joystick_parser_node.py | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/auto_rotate_ros.py b/scripts/auto_rotate_ros.py index b98a31f..f16b017 100644 --- a/scripts/auto_rotate_ros.py +++ b/scripts/auto_rotate_ros.py @@ -79,6 +79,7 @@ def main(): _publisher = rospy.Publisher('/rover_command', RoverCommand, queue_size=1) rospy.Subscriber('/imu/data', Imu, _on_imu, queue_size=1) + rospy.set_param('/auto_rotate_active', True) # Kurz warten bis IMU-Daten ankommen deadline = time.time() + 5.0 @@ -87,6 +88,7 @@ def main(): if _heading is None: rospy.logerr('auto_rotate: keine IMU-Daten') + rospy.set_param('/auto_rotate_active', False) _publish(restore_mode, vel=0) sys.exit(1) @@ -96,12 +98,11 @@ def main(): error = _shortest_error(_heading, target_deg) if abs(error) <= _DONE_DEG: + rospy.set_param('/auto_rotate_active', False) _publish(restore_mode, vel=0) sys.exit(0) - # Richtung wie Joystick: immer positiver vel, steering ±180 für Richtung - # steering=0 → Linksdrehung (deg < 85) - # steering=180 → Rechtsdrehung (deg >= 85) + # Richtung wie Joystick: immer positiver vel, steering ±180 fuer Richtung if error > 0: _publish(_POINT_TURN, vel=_VEL, steering=0) else: @@ -109,6 +110,7 @@ def main(): rate.sleep() # Abbruch per Signal + rospy.set_param('/auto_rotate_active', False) _publish(restore_mode, vel=0) sys.exit(0) diff --git a/src/joystick_parser_node.py b/src/joystick_parser_node.py index c373299..ed2a51d 100644 --- a/src/joystick_parser_node.py +++ b/src/joystick_parser_node.py @@ -180,6 +180,9 @@ def callback(data): global last_webgui_time global last_locomotion_mode + if rospy.get_param('/auto_rotate_active', False): + return + is_webgui = data.header.frame_id == "webgui" now = rospy.Time.now()