From 116b13adcb15e57b6f27b943fda2d9d956cbc49f Mon Sep 17 00:00:00 2001 From: Piotr Dec Date: Tue, 30 Jul 2024 22:47:57 +0200 Subject: [PATCH] test: Python route test --- python/test.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/python/test.py b/python/test.py index ae5a23d..0ff701f 100644 --- a/python/test.py +++ b/python/test.py @@ -109,6 +109,30 @@ def compass(controller: Controller): pass +def route(controller: Controller): + print("Route") + controller.set_direction(OutAngle.Left) + controller.set_gps(True) + controller.set_speed(50, 50) + controller.set_distance(1.2, Unit.Kilometres) + sleep(1) + controller.set_distance(1.1, Unit.Kilometres) + sleep(1) + controller.set_distance(1, Unit.Kilometres) + sleep(1) + remaining = 900 + while remaining > 0: + controller.set_distance(remaining, Unit.Metres) + sleep(1) + remaining -= 100 + controller.set_direction(OutAngle.Right, OutType.Flag) + remaining = 900 + while remaining > 0: + controller.set_distance(remaining, Unit.Metres) + sleep(1) + remaining -= 100 + + if __name__ == '__main__': import os name = '/dev/rfcomm0' if os.name != 'nt' else 'COM8'