Exemplo n.º 1
0
    epoch = time.time()

    # Parker robots have a simple routine
    if identity in PARKER_ROBOTS:
        drivers.move(drivers.RobotState(drivers.DRIVE, in_to_cm(ROBOT_AXIAL + 2)))
        sleep(3)
        drivers.move(drivers.RobotState(drivers.DRIVE, -in_to_cm(ROBOT_AXIAL + 3)))
        done = True
    # Collector robots will wait a bit for parkers to park
    elif identity in COLLECTOR_ROBOTS:
        sleep(8)
        goal_direction = math.atan2(goal[1] - pose[1], goal[0] - pose[0])

    while not done:
        # Run vision on current FOV, set indicators
        src = camera.capture()

        drivers.LED3.on()
        objects, mask, cvxhull = mod.process(src)
        drivers.LED3.off()

        # Timekeeping
        time = (time.time() - start)
        iterations += 1

        """
        src = cv2.cvtColor(src, cv2.COLOR_BGR2RGB)
        draw(src, objects)
        if cvxhull is not None:
            cv2.drawContours(
                src, [cvxhull], -1, (255, 255, 255), 3, cv2.LINE_8)