How to configure ODS

A basic JSON

The configuration example uses the following JSON for a simple configuration. This configuration expects at least one Head (3D imager) at port 2.

{
  "ports": {
    "port2": {
      "processing": {
        "extrinsicHeadToUser": {
          "rotX": 0,
          "rotY": 1.57,
          "rotZ": -1.57,
          "transX": 0,
          "transY": 0,
          "transZ": 0.35
        }
      }
    }
  },
  "applications": {
    "instances": {
      "app0": {
        "class": "ods",
        "name": "Standard ODS app",
        "ports": ["port2", "port6"],
        "state": "CONF",
        "configuration": {
          "vo": {
            "voPorts": ["port2"]
          },
          "activePorts": ["port2"],
          "zones": {
            "zoneCoordinates": [
              [
                [0, 1],
                [1, 1],
                [1, -1],
                [0, -1]
              ],
              [
                [1, 1],
                [2, 1],
                [2, -1],
                [1, -1]
              ],
              [
                [2, 1],
                [3, 1],
                [3, -1],
                [2, -1]
              ]
            ]
          }
        }
      }
    }
  }
}

Note

port6 is always part of the “ports” configuration. It refers to the IMU and is needed for the ODS algorithm to work properly.

JSON validation

This example show how to use the nlohmann_json_schema_validator package to validate configurations before setting them. Validating the configuration is something that is done under-the-hood by the O3R before the configuration is set, but it does not provide a verbose error handling. The nlohmann_json_schema_validator package will tell the user exactly where the error is in the provided JSON. It also allows us to display the use of the O3R schema.

The dependency to nlohmann_json_schema_validator is set as optional in the examples, and if the package is not found on the user’s machine, the validation will be ignored. To enable the use of this package, install it following the instructions here. Note that you will also need to install or upgrade the package nlohmann-json to version >=3.8, as it is used as a dependency by nlohmann_json_schema_validator.

The configuration example