reverse after collision
This commit is contained in:
parent
7bf2ead82c
commit
2418bee407
|
@ -106,13 +106,16 @@ class motion:
|
|||
|
||||
def __roam_handle(self):
|
||||
sensitivity = 35
|
||||
turn_speed = 30
|
||||
turn_speed = 40
|
||||
drive_speed = 25
|
||||
|
||||
self.drive(drive_speed)
|
||||
f_dist = self.sensors.sonar_get_distance(1)
|
||||
if 0 < f_dist < sensitivity: # Close to collision, turn the vehicle
|
||||
print("collision")
|
||||
self.drive(-drive_speed)
|
||||
time.sleep(0.75)
|
||||
self.stop()
|
||||
l_dist = self.sensors.sonar_get_distance(0)
|
||||
r_dist = self.sensors.sonar_get_distance(2)
|
||||
if l_dist < sensitivity: # Left side is blocked
|
||||
|
|
Loading…
Reference in New Issue