From d36eb6e3681768db77e75333b4705a3ffe9872ff Mon Sep 17 00:00:00 2001 From: Pascal Schade <165774906+pascalzauberzeug@users.noreply.github.com> Date: Wed, 25 Sep 2024 14:53:12 +0200 Subject: [PATCH] Fix gnss navigation bug (#185) We had driving timeouts when starting an automation the first time, because the target position was set before the robot updated it's position. This PR fixes that. --- field_friend/automations/navigation/navigation.py | 1 + tests/test_navigation.py | 1 + 2 files changed, 2 insertions(+) diff --git a/field_friend/automations/navigation/navigation.py b/field_friend/automations/navigation/navigation.py index ea0d9a46..a6c60dc9 100644 --- a/field_friend/automations/navigation/navigation.py +++ b/field_friend/automations/navigation/navigation.py @@ -82,6 +82,7 @@ async def prepare(self) -> bool: if isinstance(self.detector, rosys.vision.DetectorSimulation) and not rosys.is_test: self.detector.simulated_objects = [] self.log.info('clearing plant provider') + await self.gnss.update_robot_pose() return True async def finish(self) -> None: diff --git a/tests/test_navigation.py b/tests/test_navigation.py index 198ae826..62bb646e 100644 --- a/tests/test_navigation.py +++ b/tests/test_navigation.py @@ -34,6 +34,7 @@ async def test_straight_line_with_high_angles(system: System): await system.driver.wheels.stop() assert isinstance(system.current_navigation, StraightLineNavigation) system.current_navigation.length = 1.0 + system.gnss.observed_poses.clear() system.automator.start() await forward(until=lambda: system.automator.is_running) await forward(until=lambda: system.automator.is_stopped)