PiPS Configuration

Updated: April 19, 2023

PiPS is configured through JSON files that specify which providers to load, the library files that implement data types, and the available topics and their properties such as Quality of Service (QOS). Depending on your setup, you may have a global configuration file and/or one or more files that configure individual providers.

Global PiPS configuration file

Any global PiPS configuration file should be stored at the default path of /etc/system/config/pips.cfg on the target, or the path specified in the PIPS_CONFIG environment variable. At a minimum, this file should load all required providers by naming their library files, and specify the default provider. For example, the following configuration loads only the QNX Neutrino Message Passing (QNMP) provider, and sets it as the default:
{
    "providers":[ "pips-qnmp-provider.so" ],
    "default-provider":"QNMP",
}

If the PiPS framework can't find the global file, it uses default settings in which the QNMP provider is assumed to be the only one available and is loaded from pips-qnmp-provider.so. Essentially, it uses just the first line from the above sample configuration.

In addition to loading the providers, the global file is meant to configure the elements of PiPS that are common to all provider implementations. The file can therefore have these fields:
Field Purpose
default-provider The provider to be used as the default one; this provider must be listed in the providers array.

If this option is not specified, the first provider that is successfully registered will be set as the default (i.e., the first one in the array whose registration succeeds).

default-separator The symbol used to delineate the components in a PiPS entity's name. If this field isn't specified, PiPS uses a default separator of a period (.).
domain-id ID of the publish-subscribe domain that the client application is joining. Domains allow PiPS to segment data onto different communication planes, so data samples broadcast on one domain aren't visible on other domains.
providers An array that lists the library files implementing the providers. The PiPS framework attempts to load and register each listed provider.
topics An array of multi-field objects that configure individual topics available to all providers. Each object contains a name field and a type field. The latter field must specify the name of a type defined for the provider, either as a built-in type or through the typedefs option.
typedefs A multi-field object containing arrays that list the library files defining available data types. Each array's name reflects the provider for which data types are being defined, and each array item specifies the name of a library file containing data types.
verbosity The verbosity setting to use when logging messages through slogger2.
The PiPS framework fails to initialize if the configuration file is malformed, and issues a warning when any of the following less serious issues occurs (but it continues to parse the file):
  • A filename in the providers array is malformed.
  • A provider's library file couldn't be opened.
  • The provider indicated in default-provider isn't listed in providers (and hence, isn't loaded and registered).
The following is an example of a well-formed global configuration file:
{
    "verbosity":4,
    "domain-id":123,
    "providers":["pips-qnmp-provider.so","pips-fastrtps-provider.so"],
    "default-provider":"QNMP",
    "default-separator":".",
    "typedefs":{
        "QNMP":["NavMgr-plugin-qnmp.so","gal-plugin-qnmp.so","cp-plugin-qnmp.so"],
        "FASTRTPS":["NavMgr-plugin-fastrtps.so","gal-plugin-fastrtps.so","cp-plugin-fastrtps.so"],
    },
    "topics":[
        {"name":"example.quantity",   "type":"Number"},
        {"name":"example.toggle",     "type":"Boolean"},
        {"name":"example.text",       "type":"String"},
        {"name":"example.structured", "type":"JSON"},
        {"name":"example.opaque",     "type":"BLOB"},
        {"name":"example.mixed",      "type":"MultiMap"},
    ],
}

Provider configuration file

A provider configuration file defines parameters for the underlying middleware service (i.e., settings specific to the provider). Some of the supported fields are the same as those in the global file. When a field is defined in both places, the union of the settings is used for that provider only. You can define the following fields at either the global or provider level:
  • domain-id
  • topics
  • typedefs (for Fast RTPS only)

Other fields are supported depending on the provider. These fields are explained in the next subsections.

QNMP provider configuration files

For the QNMP provider, you can configure each publish-subscribe domain by setting the following fields within a domain-id object:
Field Purpose
randomize-ids A boolean field (true or false) controlling whether the provider assigns random IDs to PiPS entities. This option is enabled by default, which prevents someone from predicting the GUIDs that will be assigned to endpoints. You should disable this option only if you need predictable IDs.
resource-limits
A nested object that lets you limit the PiPS framework's memory footprint by specifying some maximum limits. This object supports these fields:
  • max-participants — the maximum number of participants that can use the provider. Participants are working groups of publishers and subscribers. The default maximum is 1024.
  • max-publications — the maximum number of publications allowed for a participant; the default is 512
The following is an example of a QNMP provider configuration file:
{
    "domain-id:123":{
        "randomize-ids": false,
        "resource-limits":{
            "max-participants":256,
            "max-publications":256,
        }
    }
}

Fast RTPS provider configuration files

The Fast RTPS provider implements a subset of the Data Distribution Service (DDS) specification. The provider-specific fields that you can configure in PiPS are also described in the DDS specification from the Object Management Group (OMG). For convenience, in our own descriptions of these fields given in the table below, we list the DDS specification sections that describe them. Note that this specification may have different names for some fields; for example, kind instead of policy.

In configuration files, you can define topics specific to the Fast RTPS provider and/or set non-default resource limits and QoS settings for topics defined at the global level.

Within a topics array entry, in addition to the mandatory name and type fields, you can specify the resource limits and QoS settings in a hierarchy of JSON objects, as follows:
Field     Purpose
qos history   The history settings for data samples. These apply to both publishers and subscribers. (See section 2.2.3.18 of the DDS specification.)
depth When policy is last, this field sets the number of previous samples kept for a given instance (see max-instances for details).
policy Whether to keep all samples (when set to all) or just a fixed number (when set to last).
reader   QoS settings for readers (subscribers).
durability The durability of the samples, either local or volatile. The default for readers is volatile, which means when a reader joins the topic, it receives samples sent only after the moment it joined. For an explanation of local durability, see the writer durability option. (See section 2.2.3.4 of the DDS specification.)
reliability The reliability level expected by the reader, either best-effort or reliable. With the first setting, the reader can read samples from writers with either level. But with the second setting, it can read samples only from writers that also have the reliable level. (See section 2.2.3.14 of the DDS specification.)
writer   QoS settings for writers (publishers).
durability The durability of the samples, either local or volatile. The default for writers is local, which means each writer saves some of the last samples (up to max-samples) it sent and so, when a reader joins the topic, it receives some sample history. For an explanation of volatile durability, see the reader durability option. (See section 2.2.3.4 of the DDS v1.4 specification.)
reliability The reliability level used by the writer, either best-effort or reliable. With the first setting, the writer's samples can be read only by readers that also have the best-effort level. But with the second setting, the samples can be read by readers with either level. (See section 2.2.3.14 of the DDS specification.)
resource-limits     These fields control the resources that the provider can use to meet the QoS settings. (See section 2.2.3.19 of the DDS specification.)
allocated-samples   The total number of allocated samples. This must be less than or equal to max-samples.
max-instances   The maximum number of instances, which are local copies of topic data, the provider will keep for the topic. An instance represents an endpoint's current view of the topic.
max-samples   The maximum number of samples (updates) the provider will keep for the topic.
max-samples-per-instance   The maximum number of samples that can belong to a particular instance.
Note: The resource-limits object (and all fields previously described for it) can be defined outside the topics array, to specify provider-wide resource limit settings. Any topic named in the same file but without its own resource limit settings inherits the provider-wide settings.
You can configure the transport layer used by the Fast RTPS provider by defining the transport object at the top level in the configuration file. This object can contain the following fields:
Field   Purpose
locators   An array defining the locators, which are network interfaces on which the participant (i.e., client process) can receive samples and provider metadata.
type The locator's type, one of multicast or unicast.
protocol The locator's protocol, one of TCPv4, TCPv6, UDPv4, or UDPv6.
address The locator's IP address. This is either an IPv4 or IPv6 address, depending on the protocol.
port   An object containing values used to calculate the port numbers of the participant's locators.
base The base port number, which is the starting value used in the port numbers calculations.
gain The gain (scaling) values used in calculating the port numbers for different domains and participants. This object has two fields: domain-id, which has a default value of 250, and participant-id, which has a default value of 2. For details on how these values are used in the calculations, see the offsets description.
offsets

The offsets used in calculating the port numbers for different domains and participants.

The first two fields of d0 and d1 apply to the port numbers of metatraffic locators, which the PiPS framework doesn't use, so the configuration can use the default values 0 and 10. The last two fields of d2 and d3 apply to the port numbers of user data locators, which the framework does use. Their default values are 1 and 11.

The locator port numbers are calculated as follows:

user_multicast_port = base + domain_id_gain * domain-id + d2
user_unicast_port = base + domain_id_gain * domain-id + d3 + participant_id_gain * participant-id

peers   An array defining the network peers of the participant. Each entry configures a single peer.
protocol The peer's protocol, one of TCPv4, TCPv6, UDPv4, or UDPv6.
address The peer's IP address. This is either an IPv4 or IPv6 address, depending on the protocol.
The following is an example of a Fast RTPS provider configuration file:
{
    "domain-id":0,
    "transport":{
        "port":{
            "base":7400,
            "gain":{
                "domain-id":250,
                "participant-id":2,
            },
            "offsets":{
                "d0": 0,
                "d1": 10,
                "d2": 1,
                "d3": 11,
            },
        },
        "locators":[
            {"type":"multicast", "protocol":"UDPv4", "address":"10.122.41.111"},
            {"type":"multicast", "protocol":"UDPv4", "address":"192.168.0.1"},
            {"type":"multicast", "protocol":"UDPv4", "address":"127.0.0.1"},
        ],
        "peers":[
            {"protocol":"UDPv4", "address":"192.168.0.2"},
        ],
    },
    "typedefs":[],
    "topics":[
        {
            "name":"qnxcar.drivetrain.propulsion_mode",
            "type":"String",
            "qos":{
                "history":{
                    "depth":1,
                    "policy":"last"
                },
                "reader":{
                    "durability":"volatile",
                    "reliability":"best-effort"
                },
                "writer":{
                    "durability":"local",
                    "reliability":"reliable"
                }
            },
        },
        {
            "name":"qnxcar.drivetrain.transmission.temperature",
            "type":"Number",
            "qos":{
                "history":{
                    "depth":3,
                    "policy":"last"
                }
            },
            "resource-limits":{
                "max-samples": 50,
                "max-instances": 2,
                "max-samples-per-instance": 50,
                "allocated-samples": 20
            },
        },
    ],
}