File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010 else :
1111 ChannelFactoryInitialize (0 )
1212
13- client = ObstaclesAvoidClient ()
14- client .SetTimeout (3.0 )
15- client .Init ()
13+ try :
14+ client = ObstaclesAvoidClient ()
15+ client .SetTimeout (3.0 )
16+ client .Init ()
1617
17- client .SwitchSet (False )
18- time .sleep (2 )
18+ while not client .SwitchGet ()[1 ]:
19+ client .SwitchSet (True )
20+ time .sleep (0.1 )
1921
20- client .SwitchSet (True )
21- time .sleep (2 )
22+ print ("obstacles avoid switch on" )
2223
23- client .UseRemoteCommandFromApi (True )
24- time .sleep (2 )
25- while True :
24+ client .UseRemoteCommandFromApi (True )
25+ time .sleep (0.5 )
2626 client .Move (0.5 , 0.0 , 0.0 )
27- time .sleep (0.02 )
27+ time .sleep (1.0 ) # move 1s
28+ client .Move (0.0 , 0.0 , 0.0 )
29+ client .UseRemoteCommandFromApi (False )
30+
31+ except KeyboardInterrupt :
32+ client .Move (0.0 , 0.0 , 0.0 )
33+ client .UseRemoteCommandFromApi (False )
34+ print ("exit!!" )
2835
You can’t perform that action at this time.
0 commit comments