Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

This page deals with configuring and launching applications via Trebuchet.

Contents


Table of Contents
maxLevel3
indent16px
excludeIntroduction|Contents

Configuring and Launching Apps

This section reviews two examples of adding an app to the configuration file: a Python script and an executable; both with arguments.

To begin, it is recommended that the relevant files be copied into Trebuchet’s executable directory, in a folder called Apps. To do this:

  1. Create a folder called Apps in the trebuchet_debug folder:

    image-20241120-103027.png

  2. Open the Apps folder and place the relevant applications that you wish to use via Trebuchet:

    image-20241120-103728.png

  3. Open the the file appConfiguration.json:

    image-20241120-104017.png

  4. and add a new entry to the TrebuchetApps list, in the following format:

    Code Block
    "TrebuchetApps": [
          <Current App list>,
        {
          "Name": "",
          "Description": "",
          "LaunchCommand": "",
          "ExePath": "",
          "ParameterGroups": [],
          "MutualExclusiveGroups": [],
          "ExecutionEnv": null
        }
    ]

Python File

Within the IASDK, there are several example scripts for connecting to the radar and retrieving some data.

For this example, they will be placed in <Trebuchet exe directory/Apps/Python/.

Open the apps appConfiguration.json, and add a new entry to the TrebuchetApps list, in the following format:

Code Block
"TrebuchetApps": [
      <Current App list>,
    {
      "Name": "",
      "Description": "",
      "LaunchCommand": "",
      "ExePath": "",
      "ParameterGroups": [],
      "MutualExclusiveGroups": [],
      "ExecutionEnv": null
    }
]

In this example, add the read_azimuth_of_fft_data.py script to the launcher. This is placed in Apps\Python\Python_radar_client\read_azimuth_of_fft_data.py. Set the name of the app to Read Single FFT Azimuth, and give an appropriate description. Since the “app” is a python script, we must provide a launch command. In this case, that command is python. Finally, set the ExePath field to Apps\\Python\\Python_radar_client\\read_azimuth_of_fft_data.py.

Note the double slash in the .exe path - this is required for Trebuchet to correctly parse the path.

The configuration entry will now look like this:

Code Block
     {
        "Name": "Read Single FFT Azimuth",
        "Description": "Connects to a radar and reads a single azimuth of data",
        "LaunchCommand": "python",
        "ExePath": "Apps\\Python\\Python_radar_client\\read_azimuth_of_fft_data.py",
        "ParameterGroups": [
          {
            "GroupName": "",
            "Parameters": [
              {
                "ShortForm": "i",
                "LongForm": "ip_address",
                "Required": false,
                "HasArguments": true,
                "DefaultValue": "192.168.0.1"
              },
              {
                "ShortForm": "p",
                "LongForm": "port",
                "Required": false,
                "HasArguments": true,
                "DefaultValue": "6317"
              }
            ]
          }
        ],
        "MutualExclusiveGroups": [],
        "ExecutionEnv": null
      }

When the app is next launched, there will be a corresponding entry in the Trebuchet Launcher, but with no arguments:

image-20241203-113221.png

You can add parameters (in parameter groups) to the ParameterGroups or MutaulExclusiveGroups lists, with the format:

Code Block
 “ParameterGroups”: [
…
        {
          "GroupName": "",
          "Parameters": [
           …
            {
              "ShortForm": "",
              "LongForm": "",
              "Required": false,
              "DefaultValue": "",
              "HasArguments": true
            }
]
        }
]

Where “…” indicates other elements that may be in the lists.

To find which parameters the script requires, you can run the script with the “-h” option, using python.

python

Apps\\Python\\python_radar_client\\usage_examples\\read_azimuth_of_fft_data.py

Alternatively, you can look inside the script to get the arguments:

image-20241106-112824.png

This script only takes two arguments: ip_address and port. These are both global options, and are represented by putting them in a group with a blank group name. For example:

Code Block
{
          "GroupName": "",
          "Parameters": [
            {
              "ShortForm": "i",
              "LongForm": "ip_address",
              "Required": false,
              "DefaultValue": "192.168.0.1",
              "HasArguments": true
            },
            {
              "ShortForm": "p",
              "LongForm": "port",
              "Required": false,
              "DefaultValue": "6317",
              "HasArguments": true
            }
]
        }

So, the final configuration entry for this app looks like this:

Code Block
    {
        "Name": "Read Single FFT Azimuth",
        "Description": "Connects to a radar and reads a single azimuth of data",
        "LaunchCommand": "python",
        "ExePath": "Apps\\Python\\Python_radar_client\\read_azimuth_of_fft_data.py",
        "ParameterGroups": [
          {
            "GroupName": "",
            "Parameters": [
              {
                "ShortForm": "i",
                "LongForm": "ip_address",
                "Required": false,
                "HasArguments": true,
                "DefaultValue": "192.168.0.1"
              },
              {
                "ShortForm": "p",
                "LongForm": "port",
                "Required": false,
                "HasArguments": true,
                "DefaultValue": "6317"
              }
            ]
          }
        ],
        "MutualExclusiveGroups": [],
        "ExecutionEnv": null
      }

This creates an entry in the Trebuchet app:

image-20241203-113733.pngImage Removedimage-20241203-120734.pngImage Added

As they are global fields, ip_address and port have been translated to Hostname and Port in the connection details pane. Their default values have also been ignored.

Pressing Launch on the app, with parameters filled out, will launch the python script in a new window.

Executable App

This example will go over adding the video_adjuster.exe application from the IASDK. First, copy the application executable into the Apps/Radar Utilities folder within the Trebuchet app directory.

In appConfiguration.json (also located in the trebuchet app directory), add a new, blank entry to the Trebuchet App List:

Code Block
"TrebuchetApps": [
      <Current App list>,
    {
      "Name": "",
      "Description": "",
      "LaunchCommand": "",
      "ExePath": "",
      "ParameterGroups": [],
      "MutualExclusiveGroups": [],
      "ExecutionEnv": null
    }
]

Name this app Radar Video Adjuster, and set the ExePath to the location of the copied executable. Unlike the python example, no launch command is required:     

Code Block
{
      "Name": "Radar Video Adjuster",
      "Description": "Relays incoming 16-bit FFT messages as 8-bit",
      "LaunchCommand": "",
      "ExePath": "Apps\\Radar Utilities\\video_adjuster.exe",
      "ParameterGroups": [],
      "MutualExclusiveGroups": [],
      "ExecutionEnv": null
    }
Info

 Note the “//” in the ExePath. This is so that Trebuchet’s config parser can correctly interpret the file path.

When Trebuchet is next launched, it will contain the new app, with no parameters:

image-20241111-082206.pngImage Removedimage-20241203-143732.pngImage Added

You can add parameters to the ParameterGroups or MutualExclusiveGroups lists in the configuration file for them to appear in the App Parameters panel. This will usually take the form:     

Code Block
“ParameterGroups”: [
  …
  {
    "GroupName": "",
    "Parameters": [
  …
  {
    "ShortForm": "",
    "LongForm": "",
    "Required": false,
    "DefaultValue": "",
    "HasArguments": true
      }
    ]
  }
]

Where “…” represents other entries that may be in the list.

The radar video adjuster has two parameter groups: radar and server, where each group contains ipaddress and port parameters. This is represented in the config as follows:

Code Block
"ParameterGroups": [
        {
          "GroupName": "radar",
          "Parameters": [
            {
              "ShortForm": "i",
              "LongForm": "ipaddress",
              "Required": false,
              "DefaultValue": "127.0.0.1",
              "HasArguments": true
            },
            {
              "ShortForm": "p",
              "LongForm": "port",
              "Required": false,
              "DefaultValue": "6317",
              "HasArguments": true
            }
          ]
        },
        {
          "GroupName": "server",
          "Parameters": [
            {
              "ShortForm": "i",
              "LongForm": "ipaddress",
              "Required": false,
              "DefaultValue": "127.0.0.1",
              "HasArguments": true
            },
            {
              "ShortForm": "p",
              "LongForm": "port",
              "Required": false,
              "DefaultValue": "6317",
              "HasArguments": true
            }
          ]
        }
      ],

When the launcher next starts, the new Radar Video Adjuster output will look like this:

image-20241106-154616.pngImage Removedimage-20241203-122241.pngImage Added

Note that the radar ipaddress and port parameters have been recognised as radar connection parameters, and so have been linked to the Hostname and Port fields.


Related Information

Filter by label (Content by label)
showLabelsfalse
max10
maxCheckboxfalse
reversefalse
cqllabel in ( "tool" , "trebuchet" )