Ejemplo n.º 1
0
def main():
    args = cmd_line.parse_args()

    util.init(args)
    util.pre_problem = 'CV RC circle'

    logger = logging.getLogger()
    log.configure_logger(logger, "RaceCar")
    logger.setLevel(logging.DEBUG)
Ejemplo n.º 2
0
def test():

    args = cmd_line.parse_args()

    util.prefix_init(args)
    util.pre_problem = 'RC'

    logger = logging.getLogger()
    log.configure_logger(logger, "Test RaceCar FS rectangle")
    logger.setLevel(logging.DEBUG)

    points = [(120, 40), (210, 40), (210, 180), (30, 180), (30, 40)]
    NUM_JUNCTURES = 50
    NUM_MILESTONES = 50
    NUM_LANES = 5
    MAX_SPEED = NUM_SPEEDS = 3
    NUM_DIRECTIONS = 20

    NUM_STEER_POSITIONS = 3
    NUM_ACCEL_POSITIONS = 3

    WIDTH = 20
    track = LineTrack(points, WIDTH, NUM_JUNCTURES, NUM_MILESTONES, NUM_LANES)
    #track.draw()

    NUM_SPEEDS = 3
    car = Car(NUM_DIRECTIONS, NUM_SPEEDS)

    MY_IDEAL_A = [
        (1, 2),
        (1, 2),
        (1, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        #(1, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        #(1, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
    ]
    #     logger.debug("About to drive manual")

    driver = ManualDriver(NUM_JUNCTURES, NUM_LANES, NUM_SPEEDS, NUM_DIRECTIONS,
                          NUM_STEER_POSITIONS, NUM_ACCEL_POSITIONS, MY_IDEAL_A)

    total_R, environment = driver.run_episode(track, car)
    logger.debug("Total_R: %s", total_R)
    environment.report_history()
    environment.play_movie(save=False, pref="bestmovie")
Ejemplo n.º 3
0
def test():

    args = cmd_line.parse_args()

    util.prefix_init(args)
    util.pre_problem = 'RC'

    logger = logging.getLogger()
    log.configure_logger(logger, "Test RaceCar FS")
    logger.setLevel(logging.DEBUG)
    
    NUM_JUNCTURES = 28
    NUM_MILESTONES = 27
    NUM_LANES = 5
    MAX_SPEED = NUM_SPEEDS = 3
    NUM_DIRECTIONS = 20
    
    NUM_STEER_POSITIONS = 3
    NUM_ACCEL_POSITIONS = 3

    RADIUS = 98
    track = CircleTrack((0, 0), RADIUS, 20, NUM_JUNCTURES,
                        NUM_MILESTONES, NUM_LANES)
    NUM_SPEEDS = 3
    car = Car(NUM_DIRECTIONS, NUM_SPEEDS)

    MY_IDEAL_A = [
            (0, 2),
            (1, 2),
            (0, 1),
            (0, 1),
            (1, 1),
            (0, 1),
            (0, 1),
            (1, 1),
            (0, 1),
            (0, 1),
            (1, 1),
            (0, 1),
            (0, 1),
            (0, 1),
            (0, 1),
            (1, 1),
            (0, 1),
            (1, 1),
            (0, 1),
            (0, 1),
            (0, 1),
            (0, 1),
            (1, 1),
            (0, 1),
            (1, 1),
            (0, 1),
            (0, 1),
            (0, 1),
        ]

    environment = Environment(track, car, NUM_JUNCTURES,
                              should_record=True)
    driver = ManualDriver(
        NUM_JUNCTURES,
        NUM_LANES,
        NUM_SPEEDS,
        NUM_DIRECTIONS,
        NUM_STEER_POSITIONS,
        NUM_ACCEL_POSITIONS,
        MY_IDEAL_A)
    total_R, environment = driver.run_episode(track, car)
    logger.debug("Total_R: %s", total_R)
    environment.report_history()
    environment.play_movie(save=False, pref="bestmovie")