Beispiel #1
0
def gen_evaluation(output_dir, bag_filename, task_filename):
    """Create a new evaluation object for a ROS bag."""
    if not os.path.isdir(output_dir):
        os.makedirs(output_dir)
    sim_eval = Evaluation(bag_filename, output_dir)
    sim_eval.save_evaluation()

    if os.path.isfile(task_filename):
        shutil.copy(task_filename, output_dir)

    del sim_eval
    def test_store_images(self):
        self.assertIn('recording.bag', os.listdir(ROOT_PATH),
                      'recording.bag cannot be found')

        sim_eval = Evaluation(ROSBAG, RESULTS_DIR)
        sim_eval.compute_kpis()
        sim_eval.save_evaluation()

        pdf_files = list()
        for f in os.listdir(RESULTS_DIR):
            if '.pdf' in f:
                pdf_files.append(f)
Beispiel #3
0
    def test_store_images(self):
        runner = SimulationRunner(PARAMS, TASK, RESULTS_DIR, True)
        runner.run(PARAMS)

        self.assertIn('recording.bag', os.listdir(runner.current_sim_results_dir),'recording.bag cannot be found')

        sim_eval = Evaluation(runner.recording_filename, runner.current_sim_results_dir)        
        sim_eval.compute_kpis()
        sim_eval.save_evaluation()

        pdf_files = list()
        for f in os.listdir(runner.current_sim_results_dir):
            if '.pdf' in f:
                pdf_files.append(f)

        self.assertGreater(len(pdf_files), 0, 'PDF files were not generated')
Beispiel #4
0
    try:
        runner = SimulationRunner(params, task, results_dir, record_all)

        runner.run(params)

        sim_eval = Evaluation(runner.recording_filename,
                              runner.current_sim_results_dir)
        output_path = deepcopy(runner.current_sim_results_dir)
        sim_eval.compute_kpis()

        if 'store_kpis_only' in opt_config:
            if opt_config['store_kpis_only']:
                sim_eval.save_kpis()
            else:
                sim_eval.save_evaluation()
        else:
            sim_eval.save_kpis()

        cost = 0.0
        for tag in opt_config['cost_fcn']:
            cost += sim_eval.get_kpi(tag) * opt_config['cost_fcn'][tag]

        status = 'SUCCESS'
        output = dict(status=status, cost=float(cost))

        with open(
                os.path.join(runner.current_sim_results_dir,
                             'smac_result.yaml'), 'w') as smac_file:
            yaml.dump(output, smac_file, default_flow_style=False)