def process_fish_image(image):
    """ process the fisheye lens image """

    trace_line(image)
    if CURRENT_STATE == 'intersection':
        if sign_intersection == 'left':
            TURTLE.set_speed_by_percentage(0.5)
            TURTLE.set_angular(TURTLE._angular + 0.2)
        elif sign_intersection == 'right':
            TURTLE.set_speed_by_percentage(0.5)
            TURTLE.set_angular(TURTLE._angular - 0.2)
    elif CURRENT_STATE == 'stop_sign':
        if left_detected > right_detected :
            TURTLE.set_speed_by_percentage(0.5)
            TURTLE.set_angular(TURTLE._angular + 0.2)
        elif right_detected < left_detected :
            TURTLE.set_speed_by_percentage(0.5)
            TURTLE.set_angular(TURTLE._angular - 0.2)
    TURTLE.move()
示例#2
0
if __name__ == '__main__':
    try:
        RUN_TYPE = 'run_' + sys.argv[1]

        # NOTE: publisher to stop viewers
        PUBLISHER_PACKAGE = rospy.Publisher(PATH_GALAPAGOS_STATE, String, queue_size=5)
        MSG = String()
        MSG.data = RUN_TYPE
        PUBLISHER_PACKAGE.publish(MSG)

        rospy.loginfo("executing: %s" % RUN_TYPE)
        __import__('%s' % (RUN_TYPE), fromlist=[RUN_TYPE])
        rospy.loginfo("Galapagos package started.")
        
        while not rospy.is_shutdown():
            TURTLE.move()
            rospy.Rate(5).sleep()
        
        #rospy.spin() # ! Deprecated
    # NOTE: The codes below will never be worked
    # except rospy.ROSInterruptException:
    #     rospy.loginfo('exception occurred')
    #     rospy.signal_shutdown("bye")
    #     pass
    except KeyboardInterrupt:
        print("\r", end='')

    TURTLE.disable()
    MSG.data = "view"
    print(str(PUBLISHER_PACKAGE.publish(MSG)))
    
示例#3
0
def gogo():
    print("running")
    TURTLE.set_speed_by_percentage(0.5)
    TURTLE.set_angular(0)
    TURTLE.move()