Пример #1
0
def initialize():
    """ initialize processing """
    EYE.calibrate()
    TURTLE.set_speed('normal')
    if CURRENT_STATE is "traffic_light":
        TURTLE.disable()
    else:
        TURTLE.enable()
Пример #2
0
        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)))
    
    # TODO: change time function to "await"
    for i in [1]:
        print("Turning off in %d s...\r" % i, end='')
        sleep(1)
    print("See you.                        ")