URCap contribution manifest
manifest.yaml
All URCap contribution URCapX files must provide a manifest.yaml file to identify itself as a URCap contribution. The metadata in the manifest file provides id and name for the contribution and one or more contributes artifacts.
All manifest.yaml files must contain the following Vendor and URCap fields in the metadata section:
vendorID : The id to identify the vendor or company.
vendorName : The name of the vendor or company.
urcapID : Is used to identify a URCap.
urcapName : Defines the name of a URCap.
version : The version of the contribution.
The fields vendorID
and urcapID
in combination uniquely defines an ID
for the URCap. They must only contain letters, digits and hyphens. The fields vendorName
,
urcapName
and version
are used for presentation.
Web Contributions
The following example is the manifest file for the “Grip Distance” contribution
metadata:
vendorID: universal-robots
vendorName: "Universal Robots"
urcapID: gripdistance
urcapName: "Grip Distance"
version: 1.0.0
artifacts:
webArchives:
- id: gripdistance
folder: gripdistance
Fields required for a web contribution artifact are:
webArchives : Specifies the type of artifacts. The artifacts are a list if web-archives.
id : The name to identify the artifact. All artifacts must have a name.
folder : Defines a contribution folder to this specific artifact and is part of a unique path to the artifact.
In this example the contribution is called `Grip Distance’ and it contains an artifact with the name ‘gripdistance’. Application nodes and program nodes are always of type “webArchives”. A manifest file could also contain more artifacts, each with its own artifact name.
Docker Container Contributions
If a Docker Container Contribution is included then an artifact entry for that needs to be added, like in this sample manifest.yaml file:
metadata:
vendorID: universal-robots
urcapID: sample-docker
version: 0.0.1
vendorName: Universal Robots
urcapName: Sample Docker Contribution
contactInfo: Energivej 25, 5260 Odense S, Denmark
description: Daemon Sample URCap
copyright: Copyright (c) 2009-2021 Universal Robots. All rights reserved.
licenseType: Sample license
artifacts:
containers:
- id: sample-docker-backend
image: sample-docker-backend
ingress:
- id: rest-api
containerPort: 5000
protocol: http
proxyUrl: /
volumeMounts:
- mountPath: /mount
devices:
- device: ttytool:/dev/ur-ttylink
containers
Specifies a list of container contributions. Container contributions have the following fields:
id : The name to identify the artifact. All artifacts must have a name.
image : The name of the docker image.
ingress : A list of container network configurations, each configuration consists of: name, port, protocol and proxyUrl. The service configured in the ingress will be reachable at a URL defined using this template: <vendorID>/<urcapID>/<container-name>/<ingress-name>. In the above example the REST endpoint can be accessed at: universal-robots/sample-docker/sample-docker-backend/rest-api. The docker container will receive the requests on port 5000 at location “/”.
* id: Used to reach the service or websocket.
* containerPort: Container port of the http server in the container.
* protocol: Specifies the communication protocol. Supported values are "http" (default), "https" or "websocket".
* proxyUrl: Specifies the URL being forwarded to.
volumeMounts
: List of volumes (mountPath
) that will be available in the docker container.
devices
: Mapping a list of host devices (device
) to docker container device. This example will make the tool serial port
“/dev/ur-ttylink” available inside the contributed docker container.
ROS2 Contributions
If a ROS2 contribution is included it will have to reside in a container. Therefore, the artifact type must be
containers
and all the container yaml parameters can be used as described above.
Program and Application nodes
Contributed program and application nodes are of type web-archive. Any contributed program and application node in a web-archive must identify itself as a node using a file called ‘contribution.json’ that must be placed in the ‘src’ folder. The contribution.json files syntax is defined below.
As an example is here a ‘contribution.json’ file for the gripdistance sample. This sample defines both an application node and a program node.
{
"applicationNodes": [
{
"translationPath": "assets/i18n/",
"behaviorURI": "gripdistance-application.worker.js",
"presenterURI": "main.js",
"componentTagName": "ur-sample-gripdistance-application"
}
],
"programNodes": [
{
"excludeFromToolbox": false,
"translationPath": "assets/i18n/",
"iconURI": "assets/icons/gripdistance.svg",
"behaviorURI": "gripdistance-program.worker.js",
"presenterURI": "main.js",
"componentTagName": "ur-sample-gripdistance-program"
}
]
}
The “programNodes” part contains the fields:
excludeFromToolbox : This method is used to control if the contributed program node should be visible in the tool box.
translationPath : Points to the folder with the translation files. These are json files for all languages supported, like ‘en.json’ for english. All program nodes that is to be shown in the program tree should at least provide translations for the program node name. This is done using the key: “program.tree.nodes”. In this example the full key would be “program.tree.nodes.ur-sample-gripdistance-program”. Application contributions use the key: “application.nodes”, like “application.nodes.ur-sample-gripdistance-application”, and consists of an object with “title” and “supportiveText” properties to be shown when presenting the node. Translation keys should also be used in the frontend presenters and translations for these keys should be added as well.
iconURI : The URI to the icon for the program tree node. The icon should be a svg file for scalability, but other formats are also supported like png, jpg etc.
behaviorURI : The URI to behavior for the program contribution. The behavior file is a javascript file containing the factory of the node and behaviors like urscript generation, rules and validation.
presenterURI : The URI to presenters for this contribution. This is a javascript file containing the custom web components for the user interface.
getComponentTagName: : The tag name of the custom web component contributed.
See How to create a Frontend Contribution for examples of the translation files, pointed to by the getTranslationPath.
The “applicationNodes” part is very similar except that an application node does not provide an icon and does not have the option “excludeFromToolbox”.
Note
The web frontend contribution must also contain a custom web component (here called ‘gripdistance-program’) and register that using the method:
window.customElements.define('ur-sample-gripdistance-program', GripDistanceProgramComponent);
if javascript is used. If using Angular then the following is needed to register a program component:
ngDoBootstrap() {
const gripDistanceProgramComponent = createCustomElement(GripDistanceProgramComponent, { injector: this.injector });
customElements.define('ur-sample-gripdistance-program', gripDistanceProgramComponent);
}
Installing/Uninstalling contributions
The SDK comes with a sdk-utils npm package, containing various helper functionalities for
URCaps. This enables you to install and uninstall URCaps using NPM commandline tools. To
use the NPM package, add the following to devDependencies
element in package.json (it is
included by default in URCaps created with the URPlus Contribution Generator)
"@universal-robots/urcap-utils": "file:npm/universal-robots-urcap-utils-0.0.11.tgz",
Building
When building your URCap for the first time or if any package dependencies have changed you need to run
npm install
Then afterward you can build the URCap with
npm run build
And now you are ready to test the URCap either in the simulator or on a robot.
Installing
To install a URCap, use the following command
npm run install-urcap -- [--host <HOST_IP>] [--port <PORT>] [--force-replace]
This will install the URCap in PolyScope X. If you are running the simulator on a different port,
you can specify it by using the -- --port <PORT>
parameter (NB: notice the --
in front of the
--host/--port/--force-replace
parameters; this is NPM’s way of adding parameters to an npm run
command).
If a URCap with the same VendorId and URCapId exists this will be updated, thus preserving any persisted data. If you
wish to completely remove the existing URCap before installing the new version, use the --force-replace
flag.
To see the changes in PolyScope X, it is necessary to refresh the browser, once the URCap is installed.
If no --host
parameter is given to install-urcap
or delete-urcap
, it will default to the Docker gateway IP which means it will be
installed/deleted in the currently running simulator.
Example DevContainer
You have started the simulator and created a URCap named my-urcap
and built it so a
target/my-urcap.urcapx
file exists. Then the command would be
npm run install-urcap
Example Robot
You have a robot with the IP address 192.168.2.80
, and have created a URCap named my-urcap
and built it so a
target/my-urcap.urcapx
file exists. Then the command would be
npm run install-urcap -- --host 192.168.2.80
### Uninstalling
Uninstalling a URCap is similar to installing; simply use the following command
npm run delete-urcap <VENDOR_ID> <URCAP_ID> [– –host <HOST_IP>] [– –port
As when installing, it is necessary to refresh the browser to see the changes in PolyScope X.
**Example**
The simulator has a URCap installed, with `vendorID: my-vendor` and `urcapID: my-urcap`.
Then the command would be
npm run delete-urcap my-vendor my-urcap