Skip to content

Available Modules

common.py

Contains common functions like get_grpc_channel() and some functions for passing into boltons.iterutils.remap.

The source is located here.

fb_helper.py

This is a module provided through the seerep_grpc package. It provides functions to construct a subset of the SEEREP flatbuffers message in one function call. Most of the functions only return the component for further composition into another datatype. If the component itself should be serialized builder.Finish() as well as builder.Output() need to be called, on the from the function retrieved value.

The source is located here.

service_manager.py

Contains a class ServiceManager which when instantiated can be used to instantly call the services with the return values of the fb_helper.py functions, i.e. the builder.Finish() and builder.Output() calls are done in the ServiceManager methods. Example usage can be found in msg_abs/msgs.py , e.g.:

                EnumFbQueryInstance.QUERY,
                lambda: query_builder.datatype_instance,
            )
            query_inst_builder.assemble_datatype_instance()
            query_instance = query_inst_builder.datatype_instance

            serv_man = ServiceManager(channel)
            uuids_pp = serv_man.call_get_instances_fb(builder, query_instance)

            uuids_by_proj = [
                uuids_pp.UuidsPerProject(i)
                for i in range(uuids_pp.UuidsPerProjectLength())
            ]

            uuids = []
            if len(uuids_by_proj) > 0:
                # return every second uuid
                uuids = sorted(
                    [
                        uuids_by_proj[0].Uuids(i).decode()
                        for i in range(0, uuids_by_proj[0].UuidsLength())
                    ]
                )
                uuids = [uuids[i] for i in range(0, len(uuids), 2)]

            return uuids

        @classmethod
        def datauuid(cls, builder: Builder, channel: Channel) -> List[int]:
            query_fb = FbQuery(channel).datatype_instance
            serv_man = ServiceManager(channel)
            images = serv_man.call_get_images_fb(builder, query_fb)
            points = serv_man.call_get_points_fb(builder, query_fb)
            pcl2s = serv_man.call_get_pointcloud2_fb(builder, query_fb)

            image_uuids = sorted(

The source is located here.

Note: This module is currently incomplete and contains only a subset of the available service calls.

fb_to_dict.py

fb_flatc_dict()

The fb_flatc_dict function can be used to convert serialized flatbuffers objects to a python dictionary. More information can be found by looking at the docstring:

    Converts a binary flatbuffers object to a python dictionary using it's IDL
    file.

    This function should only be used for debugging or testing purposes, as it
    alleviates the advantage of flatbuffers lessening the amount of copied data.

    This implementation uses temporary files in /tmp for conversion.

    Args:
        fb_obj: The bytearray object as returned by builder.Output().
        schema_file_name: The to `fb_obj` corresponding datatype in the
        `SchemaFileNames` format

    Returns:
        A python dictionary containing the objects attribute information.

catkin_find_schema_dir()

Looking at the docstring should reveal everything to know about this function:

    Tries to find the schema directory on the system using `catkin locate`.

    Args:
        ros_pkg_name: The name of the ros package containing the relevant
        schema files
        sub_dir: The name of the subdir of the package dir containing the
        relevant schema files

    Returns:
        The schema directory on the system if found.

    Raises:
        FileNotFoundError: If the path on the system is not present.
        ChildProcessError: If `catkin locate` returns something on stderr
        or failed otherwise

SchemaFileNames

A enum type class, to map the available flatbuffers type schema file names. Only used as a type specifier for fb_flatc_dict.