diff --git a/kuukar/kuukar_motion.py b/kuukar/kuukar_motion.py index 0bc4a3b..694a597 100644 --- a/kuukar/kuukar_motion.py +++ b/kuukar/kuukar_motion.py @@ -105,8 +105,11 @@ class motion: self.__roam_handle() def __roam_handle(self): - sensitivity = 35 - self.drive(23) + sensitivity = 65 + turn_speed = 30 + drive_speed = 30 + + 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") @@ -115,24 +118,24 @@ class motion: if l_dist < sensitivity: # Left side is blocked if r_dist < sensitivity: # Both side are blocked, do a full 180deg turn print("full turn") - self.turn(30, 2*TURN_TIME_FS_90DEG_MS) + self.turn(30, 2) self.drive(23) else: # Right Side is Free, turn right print("right turn") - self.turn(30, TURN_TIME_FS_90DEG_MS) - self.drive(23) + self.turn(turn_speed, 1) + self.drive(drive_speed) elif r_dist < sensitivity: # Right side is blocked, left side is free, turn left print("right left") - self.turn(-30, TURN_TIME_FS_90DEG_MS) - self.drive(23) + self.turn(-turn_speed, 1) + self.drive(drive_speed) else: # Both Side are free, randomize a direction print("turn random") right: bool = randint(0, 1) if right: - self.turn(30, TURN_TIME_FS_90DEG_MS) - self.drive(23) + self.turn(turn_speed, 1) + self.drive(drive_speed) else: - self.turn(-23, TURN_TIME_FS_90DEG_MS) - self.drive(30) + self.turn(-turn_speed, 1) + self.drive(drive_speed) time.sleep(0.5) \ No newline at end of file