def make_config_yaml()

in service/app/engine.py [0:0]


def make_config_yaml(topics_to_extract, local_dir):

    topics_to_extract = topics_to_extract.split(",")

    local_file = os.path.join(local_dir, "config.yaml")

    acceptable_topics = [
        "/gps",
        "/gps_time",
        "/imu",
        "/pose_ground_truth",
        "/pose_localized",
        "/pose_raw",
        "/tf",
        "/velocity_raw",
    ]

    topics_to_extract = list(set([str(x) for x in topics_to_extract]))
    for t in topics_to_extract:
        assert t in acceptable_topics, t + " not in topic whitelist: {ts}".format(
            ts=acceptable_topics
        )

    dict_file = {
        "topicsToBeAdded": topics_to_extract,
        "topicsToBeExcluded": [
            t for t in acceptable_topics if t not in topics_to_extract
        ],
    }

    with open(local_file, "w") as file:
        documents = yaml.dump(dict_file, file)

    logging.warning(documents)

    return local_file