Boostrapping a project with LPM

Objective

After working through the steps outlined in this document, you will have bootstrapped a project with the following features:

  • An Automation Studio project with Piper, FirstInitProg, and LuxProg that includes a single hardware configuration, with all modules deployed and running in sim.
  • An HMI based on Loupe UX, with basic tab navigation and generic content.

Background

LPM lets you pull in modules stored in Loupe’s Github package registry, and use these to quickly spin up a software project from scratch. This document will not cover the full breadth of the tool. Instead, it is intended as a how-to guide that provides a simple path to getting up and running with some of the most relevant packages that LPM provides.

Getting started

You’ll need to download the LPM installer first, and install it in Windows. Consult the Getting started with LPM page.

If you already have LPM installed, make sure it’s updated to the latest version.  If you have an older version, you may need to update it by installing the latest version.  You can check your LPM version with:

lpm --version

After the installation is complete, open up a command prompt and log in to LPM:

lpm login

You’ll be prompted to enter valid Github credentials: the requested personal access token should at a minimum have the read:packages scope. You can use a generic token associated with the default-user by copying and pasting the following when logging in: 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.

You can verify that you are logged in with the following command:

lpm status

For this tutorial, we’ll assume you already have an empty root directory, and we’ll use Loupe’s standard folder structure for AS + HMI projects. From your root directory, create two subdirectories that will be used for the AS and HMI portions of the project, respectively:

mkdir asProject
mkdir hmi

Bootstrapping the Automation Studio project

Jump into your newly created asProject directory, and initialize it with a bare-bones Automation  Studio project:

cd asProject
lpm init

When prompted, select Y[es] to create a starter AS project in this directory. Follow the prompts to select your default AS configuration and Git client.

Next, install several packages into your newly minted project. Check out the ‘Available Packages’ page for a list of available packages. Some of these are libraries, others are pkg folders (i.e. folders for AS’s Logical View), and other packages are entire projects. For this tutorial, you’ll be installing several pkg folders that will also bring in libraries that they depend upon:

lpm install firstinitprog piperprog luxprog revinfoprog

Once this completes, you can open up the AS project that LPM has prepared:

lpm as

The project should be ready to build - ensure simulation is active, build, and transfer.

That’s it for the backend!

Bootstrapping the HMI project

Now you’ll move into your empty hmi folder, and use LPM in there to add a new package corresponding to a template HMI. First, you need to initialize the folder as a stand-alone package manager by answering “No” when prompted after the init command:

cd ../hmi
lpm init

Next, install the starter HMI package:

lpm install tmplit-template

After running this command you will find a package.json and package-template.json. If you are working with an existing package.json, you should merge the dependencencies from the package-template.json into the package.json. If this is a brand new HMI project, you can just replace the package.json with package-template.json.

After this completes, you’ll need to install all of the HMI’s dependencies via NPM:

npm install

Now you’re ready to launch the HMI. We recommend the live-server VSCode extension. Opening live server in the HMI folder should automatically open the index.html.

If your AS project is running in sim, you should see a meaningful Piper state displayed on the main page of the HMI (likely STOPPED or ABORTED).

Congratulations! You have successfully bootstrapped a project with LPM.