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