Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Introduction

This page covers the Trebuchet Configuration File.

Contents



Configuration File

Trebuchet populates it's application list and creates a listener for discovery data based on a JSON configuration file. On start up, the launcher looks for this file, called appConfiguration.json in the same folder as the Trebuchet executable. On first start up, a blank config file will be created and written to disk (the blank config should allow radar discovery on most systems).

If the app cannot parse the config file (usually due to a syntax error, or if the file is empty), no data will be displayed in the app:

image-20241210-095117.png

A cause for this will usually be found in the log file, found in the Logs folder within the trebuchet_debug folder. The log file will usually indicate the exact location of any syntax errors. Another common error is to mistype the name of a field, resulting in an error message referencing a mis-matched constructor.

The config file itself consists of two sections: ConnectionConfig and TrebuchetApps, which are the Radar Discovery Connection Details and the App Configuration respectively.

Connection Details - ConnectionConfig

The first section of an appConfiguration.json file - ConnectionConfig, instructs the app how to listen for radar discovery data for the Radar Discovery section:

DiscoveryIPAddress: The multicast address from which to expect the messages.

DiscoveryInterface: The IP address of the receiving machine (i.e. the PC being used).

DiscoveryPublishPeriod: The time, in milliseconds, between publication of received discovery messages.

Port: The network port of the discovery radar units.

For example, a launcher used on a PC with the (auto generated) default config file:

 "ConnectionConfig": {
    "DiscoveryIPAddress": "239.69.69.69",
    "DiscoveryInterface": "0.0.0.0",
    "DiscoveryPublishPeriod": 5000,
    "Port": 6317
  }

App Configuration - TrebuchetApps

The second section of an appConfiguration.json file - TrebuchetApps, consists primarily of providing a name, description, app location, and parameters for the given app. At the top level, an app entry consists of the following fields:

Name: The name of the application.

Description: A short description of the application and what it does.

LaunchCommand: A command preceding the application, for example, Python3 to launch a Python3 file.

ExePath: The path to the executable or file to be executed.

ParameterGroups:  Named groups of parameters to be passed to the application. See Parameters and Parameter Groups below for a more detailed explanation.

MutualExclusiveGroups: Mutually exclusive parameter groups, where only one parameter group can be used from this collection at any one time.

ExecutionEnv: The execution environment (i.e. working directory) used when launching the app.

When an app is launched, Trebuchet will use this information to construct a call to the executable/file and launch it as a new process. The design of the configuration attempts to make this process as flexible as possible, enabling you to launch (theoretically) any application available on your PC.

Using the configuration and the user’s input, the construct command will be of the form:

<LaunchCommand> <ExePath> <Selected MutuallyExclusiveGroup and Parameters>” {ParameterGroup.Name ParameterGroup.Parameters…}

Which will launch in the selection ExecutionEnv. Curly braces indicate that multiple parameter groups and their parameters are passed as arguments.

Parameters and Parameter Groups

An individual parameter consists of short and long names, whether or not they are required by the app, a default argument, and whether or not they have arguments. For example:

{
  "ShortForm": "i",
  "LongForm": "ipaddress",
  "Required": true,
  "HasArguments": true,
  "DefaultValue": "192.168.0.180"
}

Parameter groups consist of a name (which may be blank i.e. for global options) and any number of parameters. They are designed to represent named groups of arguments that may be passed to the app.

For example, an app may require IP addresses for both a server and a client. The program could have one option called “—server_ipaddress” and another called “—client_ipaddress”, but a near solution might be to prefix an “—ipaddress” option with server and radar, respectively. The resulting call to the command-line may then take the form:

relay.exe server --ipaddress 192.168.0.1 client --ipaddress 127.0.0.1

In this scenario, the app configuration could be instructed to take two groups, called server and client. This is the design utilised by Trebuchet.

With parameters, a parameter group may look like this:

{
"GroupName": "server",
"Parameters": [
  {
    "ShortForm": "i",
    "LongForm": "ipaddress",
    "Required": false,
    "HasArguments": true,
    "DefaultValue": "127.0.0.1"
},
  {
    "ShortForm": "p",
    "LongForm": "port",
    "Required": false,
    "HasArguments": true,
    "DefaultValue": "6317"    
}
  ]
}
image-20241106-112615.png

When displayed in the launcher, parameters are separated by their group name. Only the long form of the parameter name is given, and the DefaultValue field sets the value of the entry on start up. If the value of Required is set to true, then the launch button is disabled until that parameter is given a value.

Mutually Exclusive Groups

Some apps will have different parameters available depending on a keyword passed at the command-line.

For example, the Witness NavDataCapture Tool can be used to capture navigation data or set the range gain and offset of a radar. It cannot do both in the same instance, and modes are switched based on a keyword argument; each keyword has a different set of command-line options:

Witness.NavDataCapture.exe capture –ipaddress <ip address> --port <port> --rotations

or

Witness.NavDataCapture.exe setrange –gain <gain> --offset <offset> --ipaddress <ip address> --port <port>

Mutually exclusive parameter groups ensure that only one of these modes can be selected for a given instance. Within the configuration file, they are treated as a separate list to ParameterGroups.

When viewed in the UI, mutually exclusive groups are represented by a drop-down menu:

image-20241106-112711.png

Once a group is selected, its constituent parameters are displayed:

image-20241106-112730.png

Special Treatment of Ipaddress and Port Parameters

Above the App Parameters panel in Trebuchet is the Connection Details panel, which contains the Hostname and Port fields. In some cases an Ip Port Override option is also available. The fields have some special characteristics unique to themselves.

If an app takes in parameters named ipaddress/ip_address and port as either global parameters (i.e. a blank group name) or as part of a Radar Group, then they will be translated to Hostname and Port in the radar. In other words, the values of Hostname and Port will always represent the radar’s connection details.

If you enter ipaddress and port as global options and do not see those options appear in the side panel, you should check to see if Hostname and Port are enabled in the connection panel. If the app cannot find these parameters in the config under the blank or Radar Group names, then these options will be greyed out.

This does not mean that all apps that connect to the radar may make use of this feature. For example, the Colossus Record and Playback tool only connects to the radar if it is taking a recording, so the ipaddress option is only available within the group Playback. Trebuchet will not recognise this as an app that can connect to the radar.

Example appConfiguration.json file:

{
    "ConnectionConfig": {
      "DiscoveryIPAddress": "239.69.69.69",
      "DiscoveryInterface": "0.0.0.0",
      "DiscoveryPublishPeriod": 5000,
      "Port": 6317
    },
    "TrebuchetApps": [
      {
        "Name": "Radar Utilities",
        "Description": "Manage radars and onboard trackers",
        "LaunchCommand": "",
        "ExePath": "C:\\Local\\Tools\\RadarUtilities-1.2.0.88\\RadarUtilities.exe",
        "ParameterGroups": [
          {
            "GroupName": "radar",
            "Parameters": [
              {
                "ShortForm": "i",
                "LongForm": "ipaddress",
                "Required": true,
                "HasArguments": true,
                "DefaultValue": "192.168.0.180"
              }
            ]
          }
        ],
        "MutualExclusiveGroups": [
          {
            "GroupName": "versioninfo",
            "Parameters": [
              {
                "ShortForm": null,
                "LongForm": "versioninfo",
                "Required": true,
                "HasArguments": false,
                "DefaultValue": ""
              }
            ]
          },
          {
            "GroupName": "reboot",
            "Parameters": [
              {
                "ShortForm": null,
                "LongForm": "reboot",
                "Required": true,
                "HasArguments": false,
                "DefaultValue": ""
              }
            ]
          }
        ],
        "ExecutionEnv": null
      },
      {
        "Name": "Radar Utilities 2",
        "Description": "Manage radars and onboard trackers",
        "LaunchCommand": "",
        "ExePath": "C:\\Local\\Tools\\RadarUtilities-1.2.0.88\\RadarUtilities.exe",
        "ParameterGroups": [
          {
            "GroupName": "radar",
            "Parameters": [
              {
                "ShortForm": "i",
                "LongForm": "ipaddress",
                "Required": true,
                "HasArguments": true,
                "DefaultValue": "10.77.5.233"
              }
            ]
          }
        ],
        "MutualExclusiveGroups": [
          {
            "GroupName": "versioninfo",
            "Parameters": [
              {
                "ShortForm": null,
                "LongForm": "versioninfo",
                "Required": true,
                "HasArguments": false,
                "DefaultValue": ""
              }
            ]
          },
          {
            "GroupName": "reboot",
            "Parameters": [
              {
                "ShortForm": null,
                "LongForm": "reboot",
                "Required": true,
                "HasArguments": false,
                "DefaultValue": ""
              }
            ]
          }
        ],
        "ExecutionEnv": null
      }
    ]
  }

Related Information

  • No labels