def create_camera_launch(filename,
                         camera_assignment,
                         frame_rate='default',
                         trigger=False):
    """
    Generates a camera launch file based on the current camera assignment.

    Note, if camera assignment is given it assumes that the camera yaml files
    have been added to the camera assignment.
    """
    template_name = 'camera_launch.xml'
    machine_file = faa_utilities.file_tools.machine_launch_file
    frame_rate_dict = faa_introspection.get_frame_rates()
    frame_rate_value = frame_rate_dict[frame_rate]

    jinja2_env = jinja2.Environment(
        loader=jinja2.FileSystemLoader(template_dir))
    template = jinja2_env.get_template(template_name)
    xml_str = template.render(
        machine_file=machine_file,
        camera_assignment=camera_assignment,
        trigger=trigger,
        frame_rate=frame_rate_value,
    )

    with open(filename, 'w') as f:
        f.write(xml_str)
def create_inspector_camera_launch(filename, camera_dict):
    """
    Creates camera launch file which will called from the camera inspector node.

    Note, assumes that the yaml files for the cameras have been added to the
    info dict for each camera.
    """
    template_name = 'inspector_camera_launch.xml'
    machine_file = faa_utilities.file_tools.machine_launch_file
    frame_rate_dict = faa_introspection.get_frame_rates()
    frame_rate = frame_rate_dict['camera_driver']

    jinja2_env = jinja2.Environment(loader=jinja2.FileSystemLoader(template_dir))
    template = jinja2_env.get_template(template_name)
    xml_str = template.render(
            machine_file=machine_file,
            camera_dict=camera_dict,
            frame_rate=frame_rate,
            )

    with open(filename,'w') as f:
        f.write(xml_str)
def create_camera_launch(filename, camera_assignment, frame_rate='default', trigger=False):
    """
    Generates a camera launch file based on the current camera assignment.

    Note, if camera assignment is given it assumes that the camera yaml files
    have been added to the camera assignment.
    """
    template_name = 'camera_launch.xml'
    machine_file = faa_utilities.file_tools.machine_launch_file
    frame_rate_dict = faa_introspection.get_frame_rates()
    frame_rate_value = frame_rate_dict[frame_rate]

    jinja2_env = jinja2.Environment(loader=jinja2.FileSystemLoader(template_dir))
    template = jinja2_env.get_template(template_name)
    xml_str = template.render(
            machine_file=machine_file,
            camera_assignment=camera_assignment,
            trigger=trigger,
            frame_rate=frame_rate_value,
            )

    with open(filename,'w') as f:
        f.write(xml_str)
def create_inspector_camera_launch(filename, camera_dict):
    """
    Creates camera launch file which will called from the camera inspector node.

    Note, assumes that the yaml files for the cameras have been added to the
    info dict for each camera.
    """
    template_name = 'inspector_camera_launch.xml'
    machine_file = faa_utilities.file_tools.machine_launch_file
    frame_rate_dict = faa_introspection.get_frame_rates()
    frame_rate = frame_rate_dict['camera_driver']

    jinja2_env = jinja2.Environment(
        loader=jinja2.FileSystemLoader(template_dir))
    template = jinja2_env.get_template(template_name)
    xml_str = template.render(
        machine_file=machine_file,
        camera_dict=camera_dict,
        frame_rate=frame_rate,
    )

    with open(filename, 'w') as f:
        f.write(xml_str)