leftSpeed -= 0.5 * MAX_SPEED rightSpeed += 0.5 * MAX_SPEED print("front_obstacle") elif left_obstacle: leftSpeed -= 0.5 * MAX_SPEED rightSpeed += 0.5 * MAX_SPEED print("left_obstacle") elif right_obstacle: leftSpeed += 0.5 * MAX_SPEED rightSpeed -= 0.5 * MAX_SPEED print("right_obstacle") # set up the motor speeds at x% of the MAX_SPEED. leftMotorFront.setVelocity(leftSpeed) rightMotorFront.setVelocity(rightSpeed) leftMotorBack.setVelocity(leftSpeed) rightMotorBack.setVelocity(rightSpeed) Camera.getImage(kinectColor) Camera.saveImage(kinectColor, 'color.png', 1) RangeFinder.getRangeImage(kinectDepth) RangeFinder.saveImage(kinectDepth, 'depth.png', 1) frameColor = cv.imread('color.png') frameDepth = cv.imread('depth.png') cv.imshow("Color", frameColor) cv.imshow("Depth", frameDepth) cv.waitKey(10)
#print("sag bir engel var") # motoların hızını belirler # - koyarsak araç geri geri gelir solMotor.setVelocity(sol_hiz) sağMotor.setVelocity(sag_hiz) # araç üzerinden resimi getirirz Camera.getImage(kinectColor) #araç üzerinden resimi kayıt ederiz Camera.saveImage(kinectColor, "color.png", 1) #araç üzerinden RangeFinder.getRangeImage(kinectRange) RangeFinder.saveImage(kinectRange, "range.png", 1) #resimi okuruz frameColor = cv2.imread("color.png") #resim kopyalanır cikti = frameColor.copy() #resimin renigini belirleriz gray = cv2.cvtColor(frameColor, cv2.COLOR_BGR2GRAY) #resim de blur blur getirmeisini sağlarız gray_blur = cv2.blur(gray, (3, 3)) #tüm daireleri yakalamaya çalışırız daireler = cv2.HoughCircles(gray_blur, cv2.HOUGH_GRADIENT, 1,