URCap Generator

The URCap Generator can be used to generate a new URCap project. This URCap can contain a frontend, a backend or both. The frontend can container a number of contributions, which can be the following types: program-nodes application-node, smartskills, sidebarItem, operator-screen. The different frontend contributions, will contribute content to different parts of Polyscope X.

The backend contains a Docker contribution, which can be created with or without support for Ros 2.

Creating a new URCap

To create a new URCap run the follow script:

./newurcap.sh

A prompt will appear and query for the required information to build the new URCap.

The information required is:

  • Id of Vendor Id of company, like: com.my-company Will be written into the ‘manifest.yaml’ file and used as part of the path to the resource files

  • Name of Vendor Name of the Company creating the URCap, like: My Company Will be written into the ‘manifest.yaml’ file

  • Id of URCap URCap Id of URCap URCap, like: mygripper Used for creating the folder containing the sample. Will be written into the ‘manifest.yaml’ file and used as part of the path to the resource files

  • Name of URCap URCap name, like: My gripper Will be written into the ‘manifest.yaml’ file

  • Include a frontend Select ‘Y’ to include a Web frontend

  • Include a Docker Container (backend) Select ‘Y’ to include an empty Docker backend

  • ROS 2 Docker Support If ‘Y’ was answered to Include a Docker Container (backend), then choose if this Docker should be configured for ROS2 Support.

  • Contribution type If ‘Y’ was answered to include a frontend, select ‘Angular’ or ‘JavaScript’ by using arrow up/down keys. The samples included in the SDK are written in Angular.

  • Include Application Node Select ‘Y’ to include an application node contribution to the URCap

  • Include Program Node Select ‘Y’ to include a program node contribution to the URCap

  • Include Smartskill Select ‘Y’ to include a smartskill contribution to the URCap

  • Include Sidebar Select ‘Y’ to include a sidebar item contribution to the URCap

  • Include operator screen Select ‘Y’ to include a operator screen contribution to the URCap

  • For each contribution that was chosen to be included above (application node, program node, smartskill, sidebar item, operator screen), the following type of question will be shown: Provide one or more [contribution-type], in a comma-separated list e.g. my-xx1,my-xx2 Here a list of values separated by commas must be entered. Enter at least one element and up to as many as needed. While typing, a validator will tell if the names are valid. If not valid, an error will be shown like this example where an invalid underscore in “my_app3” is used:

  • Program node name If ‘Y’ was answered to include a program node then enter its name, like: my-prg Will be written into the ‘contribution.json’ and used in the ‘app.module.ts’ file in Angular

  • Application node name If ‘Y’ was answered to include an application node then enter its name, like: my-app Will be written into the ‘contribution.json’ and used in the ‘app.module.ts’ file in Angular

  • Smartskill / Sidebar / Operator Screen - name For those included in the contribution, give them a name. The name will be used in the same way as application and program nodes

A folder will be created with the same name as the entered Id of the new URCap and the selected template files will be copied into this folder.

For further details about ‘manifest.yaml’ and ‘contribution.json’ see How to configure, package and install a URCap.

Example of a folder structure if an Angular ‘mygripper’ sample is created. Only the important files are listed:

mygripper/
├── manifest.yaml
├── package.json
├── npm/
└── src/
    ├── contribution.json
    ├── environments/
    ├── app/
    │   ├── app.module.ts
    │   └── components/
    │       ├── my-app/
    │       │   ├── my-app.behavior.worker.ts
    │       │   ├── my-app.component.html
    │       │   ├── my-app.component.scss
    │       │   ├── my-app.component.ts
    │       │   └── my-app.node.ts
    │       └── my-prg/
    │           ├── my-prg.behavior.worker.ts
    │           ├── my-prg.component.html
    │           ├── my-prg.component.scss
    │           ├── my-prg.component.ts
    │           └── my-prg.node.ts
    └── assets/
        ├── i18n/
        └── icons/

Example of a folder structure if the ‘mygripper’ URCap contains a Docker backend and a JavaScript frontend. Only the important files are listed:

mygripper/
├── manifest.yaml
├── mygripper-backend/
│   ├── Dockerfile
│   └── package.json
├── mygripper-frontend/
│   ├── npm/
│   ├── package.json
│   ├── src/
│   │   ├── application/
│   │   │   ├── my-app.behavior.worker.js
│   │   │   └── my-app.component.js
│   │   ├── assets/
│   │   │   ├── i18n/
│   │   │   └── icons/
│   │   ├── contribution.json
│   │   └── program/
│   │       ├── my-prg.behavior.worker.js
│   │       └── my-prg.component.js
│   └── webpack.config.js
└── package.json

Note that the backend and frontend are located in their own sub-folders.

Modify the new URCap

Change directory into the newly created folder. Modify the selected nodes and/or add new nodes. See How to create a Frontend URCap.

Building the new URCap

Once the new URCap is done, it needs to be built. To build it, change directory into the newly created folder (where the package.json file is), and run the following commands:

npm install npm run build

The first command will download and install the required npm packages, this command is only required the first time or when package dependencies have changed in the ‘package.json’ file. The second command will build the new URCap, package it and place the final URCapX file in the target folder.

Testing URCap

Please consult the installation guide for the PolyScope X simulator for instruction on how to install and run the simulator.

Only relevant for development environments running on ARM64

If the URCap has a docker contribution, the container image produced by npm run build, will be an AMD64 image.

See section cpu-architecture for more about container compatibility here.