This monorepo contains our custom Foxglove development tools and extensions.
For initial setup instructions, follow the root SETUP.md file.
Important
The foxglove.py CLI should be run inside the Docker container. For more details see SETUP.md.
The foxglove.py CLI provides a unified interface to manage our custom extensions. It integrates commands from the foxglove, foxglove-extension, and npm CLIs. Extensions can be installed locally or published to our organization.
To run the CLI you can use python3 foxglove.py (inside of the foxglove directory) or its alias fox (declared in ros_bashrc.sh).
There are two steps in the installation process:
- Build: Prepares an extension for installation or publishing.
- Install: Locally installs an extension.
Therefore, to install all extensions, run:
fox build
fox installTo clean up the Foxglove monorepo and uninstall local extensions, run:
fox clean
fox uninstallClean and uninstall will revert the changes made by build and install respectively.
fox [SUBCOMMAND]b, build- Build all necessary dependencies for Foxglove development.i, install- Install Foxglove extensions locally.w, watch- Automatically reinstall a Foxglove extension after changes.l, lint- Lint the Foxglove monorepo.p, publish- Publish Foxglove extensions to an organization.c, clean- Remove build files from the Foxglove monorepo.u, uninstall- Uninstall all local Foxglove extensions.d, doctor- Troubleshoot the Foxglove development environment.
You can also run fox [SUBCOMMAND] -h to view a help message.
Important
Building must be performed before local installing or publishing custom extensions. Additionally, building is a prerequisite for fox lint (eslint) and other Foxglove developer tools.
To build, run:
fox build [OPTIONS]
--skip-ci: Use existing node_modules instead of clean installing external dependencies.
By default, fox build does several things:
- Install external dependencies to
node_modulesusingnpm ci. - Patch external dependencies using
patch-package. - Build local dependencies in
foxglove/shared/. - Build per-extension dependencies by running
npm run build.
Tip
After building once, you only need to rebuild after changes are made to the extension dependencies (e.g., package.json, anything in foxglove/shared/, etc.).
To perform a local install, run:
fox install [extensions ...]extensions: A list of extensions to install. If no extensions are given, all extensions are installed.
This will execute the command npm run local-install for each extension specified.
Note
Extensions are installed at ~/.foxglove-studio/extensions/ and will have the prefix dukerobotics.ros-jazzy-.
To watch an extension for changes, run:
fox watch extensionThis will automatically execute npm run local-install upon .ts or .tsx file changes in the src directory.
To lint the Foxglove monorepo, run:
fox lint [files ...]files: A list of files to lint. If no files are given, the entire Foxglove monorepo is linted.-f, --fix: Attempt to autofix linting errors by modifying files in place.
Important
To publish extensions, you must set up the .foxgloverc file. See SETUP.md for more details.
When you are ready to publish custom extensions to your organization, run:
fox publish [extensions ...]
extensions: A list of extensions to publish. If no extensions are given, all extensions are published.-v, --version: Version to publish extensions under. If no version is given, the short (length 7) HEAD commit hash is used. A version is required if therobosub-ros2git reposititory is dirty.-f, --force: Publish extensions even if the repository is dirty.--github-action: Append-prodto the publish version (to avoid version collisions).
To clean up the Foxglove monorepo, run:
fox clean
This launches an interactive session where you can remove files generated during fox build.
To uninstall all Duke Robotics extensions, run:
fox uninstallThis removes all files generated during fox install.
To troubleshoot the Foxglove development environment, run:
fox doctor
This command will exit with a non-zero status if any potential problems are found.
Note
When testing local extensions, the desktop version of Foxglove Studio must be used.
- Run the following command to start the Foxglove bridge:
fg-ws
- This is an alias that starts the Foxglove bridge, which enables Foxglove Studio to connect to the ROS 2 network.
- The bridge opens a WebSocket on port
28765. This port is mapped to port28765on the host machine, so you can connect to the WebSocket from your host machine.
- Open Foxglove Studio and connect to the WebSocket at
ws://IP_ADDRESS:28765.- Replace
IP_ADDRESSwith the IP address of the host machine. If you are running the Docker container locally, you can uselocalhostas the IP address.
- Replace
publish-topic-panel- Panel to publish topicstoggle-controls-panel- Panel to toggle controls on/offsystem-status-panel- Panel that displays system usage of the onboard computersensors-status-panel- Panel that displays the connected/disconnected status of sensorsthruster-allocs-panel- Panel that displays the current thruster allocs and publishes desired thruster allocstoggle-joystick-panel- Panel to toggle joystick control on/off, as well as publish transformed joystick inputs as a desired powertoggle-keyboard-panel- Panel to toggle keyboard control on/off, as well as publish transformed keyboard inputs as a desired powerpid-panel- Panel to read/set PID gainsdiscrete-servos-panel- Panel to control discrete servos
Local dependencies are located in the shared/ directory.
defs- Exports Foxglove datatype maps and TypeScript interfaces/enums for both ROS 2 and Duke Robotics message definitionstheme- Exports the Duke Robotics MUI Themerobot-name- Exports theRobotenum and related utilities used for implementing robot-specific behaviorutils- Exports shared utility functions used across Foxglove extensions
Patches to external node modules are located in the patches/ directory.
Running fox build will automatically apply these patches.
create-foxglove-extension+1.0.4.patch- No longer require
README.mdorCHANGELOG.mdwhen installing an extension - Before installing an extension, only remove
dist/extension.js(instead of cleaning the entiredistdirectory)
- No longer require
eslint.config.mjs- Configuration file for ESLint.eslintignore- Ignore file for ESLint.npmrc- Configuration file for npm.prettierrc.yaml- Configuration file for Prettiertsconfig.jsonConfiguration file for TypeScriptpackage.json- Metadata file for the Foxglove monorepopackage-lock.json- The npm dependency tree of the Foxglove monorepo, generated usingnpm i
Copy an existing Duke Robotics extension as a starting point. This ensures that all of our extensions have the same code structure and use the same core set of dependencies.
All local dependencies must expose an npm run build command in package.json. During build, foxglove.py will compile each local dependency to node_modules where they can be consumed by an extension.
See the Foxglove documentation for more details on extension development.