motion-tools aims to provide a visualization interface for any spatial information using Viam's APIs. This typically means motion-related monitoring, testing, and debugging.
To run the app, you will need to set your project up by installing the app dependencies and ensuring you can connect to your machines if required.
The easiest way to get started is using our automated setup script:
make setupThis single command will:
- Install and configure nvm (Node Version Manager)
- Install the latest Node.js LTS version via nvm
- Install pnpm package manager
- Install bun runtime
- Install all project dependencies
If the above does not work for you, or if you prefer to install dependencies manually:
- Install nvm
- Install Node.js LTS:
nvm install --lts && nvm use --lts - Install pnpm
- Install bun
- Install dependencies:
pnpm i
To add a list of connection configs in an .env.local file, use the following format:
VITE_CONFIGS='
{
"fleet-rover-01": {
"host": "fleet-rover-01-main.ve4ba7w5qr.viam.cloud",
"partId": "myPartID",
"apiKeyId": "myApiKeyId",
"apiKeyValue": "MyApiKeyValue",
"signalingAddress": "https://app.viam.com:443"
}
}
'
After setup completes, you can start a local app server with:
make upThis starts the app as a static site. The build part of the process will only run if you have not built the app yet as a part of make up, or your build is out of date.
If you want to be able to run multiple versions of the app, you can configure how the servers run. The make up command can accept two options:
STATIC_PORTis the port for the static file server, and defaults to5173WS_PORTis the port for the websocket server used to communicate with the draw client API
Note
The WS_PORT is not fully configurable at the moment, so passing it will only affect where the frontend listens for the websocket server, but calls with the draw client API are currently hardcoded to point to "http://localhost:3000/". If this is a feature you require, please submit a request to the viz team!
To run two apps using the same web socket server, run:
# in one terminal
make up
# in another terminal
make up STATIC_PORT=5174
The apps should be available on http://localhost:5173/ and http://localhost:5174/, and calls to the draw client API should render in both.
If you are contributing to motion-tools, you should just run the development web server with:
pnpm dev
To visit the visualizer, go to http://localhost:5173/
Open the machine config page (bottom right) and enter in connection details to visualize a specific machine. You can also add machine configs from an env file (see below).
The visualizer includes a golang package that allows executing commands to the visualizer.
The list of available commands can be found here.
It is possible to programmatically move the viewer camera and even modify the camera settings during runtime.
To do this, open the Javascript console while using the visualizer and call methods or set properties on the cameraControls object.
The following APIs are available: https://github.com/yomotsu/camera-controls?tab=readme-ov-file#properties