Beispiel #1
0
def findTape():
    link.camera_update()
    if link.get_object_area(c.chanPink, 0) >= c.blobSize:
        tape = 1
    else:
        tape = 0
    return tape
Beispiel #2
0
def lookForGreen() :
    print "cameraTrack"
    link.camera_update()
    time.sleep (0.5)
    
    #$####################
    print "waiting until we see something"
    for i in range(15):
        print "i: ", i
        greenArea = link.get_object_area( c.chanGreen, 0 )
        redArea = link.get_object_area( c.chanRed, 0 )
        print "green: ", greenArea
        print "red: ", redArea
        if greenArea > c.blobSize:
            break
        elif redArea > c.blobSize:
            break
        link.camera_update()
        time.sleep( 0.02 )
    
    ######################
    
    if link.get_object_area( c.chanGreen, 0 ) >= c.blobSize:
        print "green"
        print link.get_object_area( c.chanGreen, 0 )  
        return True
    print "green not seen"
    return False
Beispiel #3
0
def findTape():
    link.camera_update()
    if link.get_object_area( c.chanPink, 0 ) >= c.blobSize:
        tape = 1
    else:
        tape = 0
    return tape
Beispiel #4
0
def getCoordinateOfFoamBall(pingPongBallNumber):
    """Returns the coordinate of the biggest red ball the camera sees"""
    camera_update()
    sleep(.1)
    x = get_object_center_x(CHANNEL_GREEN,pingPongBallNumber)
    y = get_object_center_y(CHANNEL_GREEN,pingPongBallNumber)
    cood = Coordinate(x,y)
    return cood
Beispiel #5
0
def sortTribble() :
    print "sortTribble"
    link.camera_update()
    time.sleep(.15)
    link.camera_update()
    print "camera updated"
    found = 1
    if link.get_object_area( c.chanGreen, 0 ) >= c.blobSize:
        print "green, y=", link.get_object_center_y(c.chanGreen, 0)
        if link.get_object_center_y(c.chanGreen, 0) >= 90:
            drive.withStop(30, 30, .5)
            link.camera_update()
            print "*******new y=", link.get_object_center_y(c.chanGreen, 0)
            #act.DEBUG("bad green alignment")\
        print link.get_object_area( c.chanGreen, 0 )
        print "moveSorter"
        sortAndKick( c.sorterLeft)
        
        
    elif link.get_object_area(c.chanRed, 0 ) >= c.blobSize or link.get_object_area(c.chanGold, 0 ) >= c.blobSize:
        print "red/gold"
        print "red, y=", link.get_object_center_y(c.chanRed, 0)
        if link.get_object_center_y(c.chanRed, 0) >= 90:
            drive.withStop(30, 30, .5)
            link.camera_update()
            print "*******new y=", link.get_object_center_y(c.chanRed, 0)
        print link.get_object_area( c.chanRed, 0 )
        print "moveSorter"  
        sortAndKick( c.sorterRight)
        
    else:
        print "nothing found"
        found = 0
    return found
Beispiel #6
0
def sortTribble():
    print "sortTribble"
    link.camera_update()
    time.sleep(.15)
    link.camera_update()
    print "camera updated"
    found = 1
    if link.get_object_area(c.chanGreen, 0) >= c.blobSize:
        print "green, y=", link.get_object_center_y(c.chanGreen, 0)
        if link.get_object_center_y(c.chanGreen, 0) >= 90:
            drive.withStop(30, 30, .5)
            link.camera_update()
            print "*******new y=", link.get_object_center_y(c.chanGreen, 0)
            #act.DEBUG("bad green alignment")\
        print link.get_object_area(c.chanGreen, 0)
        print "moveSorter"
        sortAndKick(c.sorterLeft)

    elif link.get_object_area(c.chanRed,
                              0) >= c.blobSize or link.get_object_area(
                                  c.chanGold, 0) >= c.blobSize:
        print "red/gold"
        print "red, y=", link.get_object_center_y(c.chanRed, 0)
        if link.get_object_center_y(c.chanRed, 0) >= 90:
            drive.withStop(30, 30, .5)
            link.camera_update()
            print "*******new y=", link.get_object_center_y(c.chanRed, 0)
        print link.get_object_area(c.chanRed, 0)
        print "moveSorter"
        sortAndKick(c.sorterRight)

    else:
        print "nothing found"
        found = 0
    return found
Beispiel #7
0
def testCamera():
    servo.moveShutter(c.shutterOpen)
    for i in range(5):
        link.camera_update()
        area = link.get_object_area(c.chanRed, 0)
        print i, area
Beispiel #8
0
def cameraTest():
    print "testing camera"
    link.camera_update()
    time.sleep(.1)
    link.camera_update()   
Beispiel #9
0
def takePicture():
    link.camera_update()
Beispiel #10
0
def camTakePicture():
    link.camera_update()
Beispiel #11
0
def cameraTest():
    print "testing camera"
    link.camera_update()
    time.sleep(.1)
    link.camera_update()
Beispiel #12
0
def getNumVisibleFoamBalls():
    """Returns the number of red balls in the camera's frame"""
    camera_update()
    count = get_object_count(CHANNEL_RED);
    return count