Example #1
0
def move_til_sample(u, precached):
    u.arm_target("X", 0)
    u.arm_target("Y", u.arm_max("Y"))
    while u.arm_should_be_moving("X") or u.arm_should_be_moving("Y"): pass
    u.motor_right(0.1)
    u.motor_left(0.1)
    while not rospy.is_shutdown():
       curr_crotch_img = new_crotch_img2
       xy = None
       while xy is None:
           curr_crotch_img = new_crotch_img2
           if precached:
               xy = grab.identify_precached(curr_crotch_img)
           else:
               xy = grab.identify_easy_sample(curr_crotch_img)
       time.sleep(1)
       u.motor_right(0.0)
       u.motor_left(0.0)
       break
Example #2
0
def move_til_sample(u, precached):
    u('arm_target', 2, 'X 0', rospy.Time.now())
    params = 'Y ' + str(u('arm_max', 2, 'Y', rospy.Time.now()))
    u('arm_target', 2, params, rospy.Time.now())
    while u('arm_should_be_moving', 2, 'X', rospy.Time.now()) or u('arm_should_be_moving', 2, 'Y', rospy.Time.now()): pass
    u('motor_left', 2, '0.1', rospy.Time.now())
    u('motor_right', 2, '0.1', rospy.Time.now())
    while not rospy.is_shutdown():
       curr_crotch_img = new_crotch_img2
       xy = None
       while xy is None:
           curr_crotch_img = new_crotch_img2
           if precached:
               xy = grab.identify_precached(curr_crotch_img)
           else:
               xy = grab.identify_easy_sample(curr_crotch_img)
       time.sleep(1)
       u('motor_left', 2, '0.0', rospy.Time.now())
       u('motor_right', 2, '0.0', rospy.Time.now())
       break