ADEEPT PiCar-Pro Manual page 175

Table of Contents

Advertisement

27.
if
min(scanList) < rangeKeep:
28.
if
scanList.index(min(scanList)) == 0:
29.
'''
30.
Turn right
31.
'''
32.
print('Turn
right')
elif
33.
scanList.index(min(scanList)) == 1:
if
34.
scanList[0] < scanList[2]:
35.
'''
36.
If the detected distance on the left is shorter than the right, turn to the right
37.
'''
38.
print('Turn
39.
else:
40.
'''''
41.
Otherwise, turn left
42.
'''
43.
print('Turn
44.
elif
scanList.index(min(scanList)) == 2:
45.
'''
46.
Turn Left
47.
'''
48.
print('Turn
Left')
49.
if
max(scanList) < rangeKeep:
50.
'''
51.
If the distances in the left, center, and right directions are all closer than rangeKeep, reverse
52.
'''
print('reverse')
53.
else:
54.
55.
'''
56.
All three directions are farther than rangeKeep
57.
'''
58.
print('Go
forward')
#The shortest distance detected on the left
#The shortest distance detected in the middle
right')
left')
#The shortest distance detected on the right
172

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the PiCar-Pro and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents

Save PDF