def simSleepTwentyHz(duration):
    i = 0
    [status, framesize] = t.get(tim, wait=True, last=True)
    next = tim.sim[0] + 0.05
    while i < duration:
        [status, framesize] = t.get(tim, wait=True, last=True)
        while tim.sim[0] < next:
            [status, framesize] = t.get(tim, wait=True, last=True)
            if status == ach.ACH_OK or status == ach.ACH_MISSED_FRAME or status == ach.ACH_STALE_FRAMES:
                pass
            else:
                raise ach.AchException(v.result_string(status))
        next = tim.sim[0] + 0.05
        [status, framesize] = t.get(tim, wait=True, last=True)
        i += 1
예제 #2
0
print '========== Daniel M. Lofaro =========='
print '========= [email protected] =========='
print '======================================'
while True:
    # Get Frame
    img = np.zeros((newx,newy,3), np.uint8)
    c_image = img.copy()
    vid = cv2.resize(c_image,(newx,newy))
    [status, framesize] = v.get(vid, wait=False, last=True)
    if status == ach.ACH_OK or status == ach.ACH_MISSED_FRAME or status == ach.ACH_STALE_FRAMES:
        vid2 = cv2.resize(vid,(nx,ny))
        img = cv2.cvtColor(vid2,cv2.COLOR_BGR2RGB)
        cv2.imshow("wctrl", img)
        cv2.waitKey(10)
    else:
        raise ach.AchException( v.result_string(status) )


    [status, framesize] = t.get(tim, wait=False, last=True)
    if status == ach.ACH_OK or status == ach.ACH_MISSED_FRAME or status == ach.ACH_STALE_FRAMES:
        pass
        #print 'Sim Time = ', tim.sim[0]
    else:
        raise ach.AchException( v.result_string(status) )

#-----------------------------------------------------
#--------[ Do not edit above ]------------------------
#-----------------------------------------------------
    # Def:
    # ref.ref[0] = Right Wheel Velos
    # ref.ref[1] = Left Wheel Velos