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 fnm (Fast Node Manager) and Node.js 22
- Install pnpm package manager
- Install bun runtime
- Install Go and buf (for protobuf generation)
- Install all project dependencies
- Generate protobuf code
After setup completes, add the shell configuration it prints to your shell config file (~/.zshrc or ~/.bashrc), then restart your terminal.
If the above does not work for you, or if you prefer to install dependencies manually:
- Install fnm:
curl -fsSL https://fnm.vercel.app/install | bash - Install Node.js:
fnm install 22 && fnm use 22 - Install pnpm:
curl -fsSL https://get.pnpm.io/install.sh | sh - - Install bun:
curl -fsSL https://bun.sh/install | bash - Install Go
- Install buf: download from GitHub releases
- Install Go tools:
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest - Install dependencies:
pnpm install - Generate protobufs:
make proto
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