test: Python route test
This commit is contained in:
parent
35e24dcc8e
commit
116b13adcb
1 changed files with 24 additions and 0 deletions
|
@ -109,6 +109,30 @@ def compass(controller: Controller):
|
||||||
pass
|
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__':
|
if __name__ == '__main__':
|
||||||
import os
|
import os
|
||||||
name = '/dev/rfcomm0' if os.name != 'nt' else 'COM8'
|
name = '/dev/rfcomm0' if os.name != 'nt' else 'COM8'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue