Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test to ensure we can navigate even though the GNSS location becomes None #124

Merged
merged 5 commits into from
Jul 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading