Esempio n. 1
0
def main():

    # Initialize room object
    room = Room()

    # Filename for room
    filename = 'room2015-12-06.pckl'

    # Read in room object from text file
    room.load_room(filename)

    # Print out info
    print "Loading Room from: " + filename
    room.describe()

    # Initialize Figure
    fig, ax = plt.subplots()

    # Define plot parameters
    # plt.xlim(-5, 5)
    # plt.ylim(-5, 5)
    plt.xlabel('X')
    plt.xlabel('Y')

    # Plot the areas and moves within each room
    for area in room.areas:
        plot_area(area, ax)

    plt.show()
Esempio n. 2
0
def main():
    '''
        Runs main robot Sense-Plan-Act loop
    '''

    print "Importing functions ..."

    # from python_mysql_connect import connect, insert_current_pos, query_current_pos
    from motor import GPIOclean
    from Room import Room
    import navigation
    # from maptool import pull_map
    # from slam import slamfunc

    # print "Connecting to database ..."
    # connect()

    # print "Downloading map from database ..."
    # pull_map()

    room = Room()

    if len(sys.argv) > 1:
        print "Loading up Room: " + str(sys.argv[1])
        room.load_room()
    else:
        print "No Room specified, using empty Room ..."

    print "Starting main exploration loop ..."

    for i in range(0, params.p['MAX_ITER']):

        # Explore (Move to a new area)
        room = navigation.explore(room)

    print "Exited main exploration loop ..."

    print "Storing room to file..."
    room.store_room()

    # print "Pushing map to database ..."
    # push_map()

    print "Clean up motor GPIO ..."
    GPIOclean()