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()