Skip to content

Commit

Permalink
Merge pull request #124 from zauberzeug/navigation-gnss
Browse files Browse the repository at this point in the history
Add test to ensure we can navigate even though the GNSS location becomes None
  • Loading branch information
rodja authored Jul 18, 2024
2 parents 1153734 + 1b90cab commit f00c03a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from field_friend.automations import Field
from field_friend.automations.implements import Implement, Recorder
from field_friend.automations.navigation import StraightLineNavigation
from field_friend.localization import GnssSimulation


async def test_straight_line(system: System):
Expand All @@ -23,6 +24,21 @@ async def test_straight_line(system: System):
assert system.odometer.prediction.point.x == pytest.approx(system.straight_line_navigation.length, abs=0.1)


async def test_straight_line_with_failing_gnss(system: System, gnss: GnssSimulation, detector: rosys.vision.DetectorSimulation):
async def empty():
return None
create_new_record = gnss._create_new_record
system.automator.start()
await forward(5)
gnss._create_new_record = empty # type: ignore
await forward(0.5)
gnss._create_new_record = create_new_record
await forward(5)
assert system.automator.is_running
assert len(detector.simulated_objects) == 0
assert system.odometer.prediction.yaw_deg == pytest.approx(0, abs=1)


async def test_driving_to_exact_positions(system: System):
class Stopper(Implement):
def __init__(self, system: System) -> None:
Expand Down

0 comments on commit f00c03a

Please sign in to comment.