File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ from arduino_alvik import ArduinoAlvik
2
+ from time import sleep_ms
3
+ import sys
4
+
5
+ alvik = ArduinoAlvik ()
6
+ alvik .begin ()
7
+
8
+ while True :
9
+ try :
10
+
11
+ alvik .move (100.0 )
12
+ while (ack := alvik .get_ack ()) != ord ('M' ):
13
+ sleep_ms (200 )
14
+ print ("on target after move" )
15
+
16
+ alvik .rotate (90.0 )
17
+ while (ack := alvik .get_ack ()) != ord ('R' ):
18
+ sleep_ms (200 )
19
+ print ("on target after rotation" )
20
+
21
+ alvik .move (50.0 )
22
+ while (ack := alvik .get_ack ()) != ord ('M' ):
23
+ sleep_ms (200 )
24
+ print ("on target after move" )
25
+
26
+ alvik .rotate (- 45.00 )
27
+ while (ack := alvik .get_ack ()) != ord ('R' ):
28
+ sleep_ms (200 )
29
+ print ("on target after rotation" )
30
+
31
+ x , y , theta = alvik .get_pose ()
32
+ print (f'Current pose is x={ x } , y={ y } ,theta={ theta } ' )
33
+
34
+ alvik .reset_pose (0 , 0 , 0 )
35
+
36
+ x , y , theta = alvik .get_pose ()
37
+ print (f'Updated pose is x={ x } , y={ y } ,theta={ theta } ' )
38
+ sleep_ms (500 )
39
+
40
+ except KeyboardInterrupt as e :
41
+ print ('over' )
42
+ alvik .stop ()
43
+ sys .exit ()
You can’t perform that action at this time.
0 commit comments