Skip to content

Commit 40b04cf

Browse files
apockillvelovix
andauthored
Migrate node_helpers code from private robot monorepo (#1)
Co-authored-by: Tyler Compton <xaviosx@gmail.com>
1 parent 87891e6 commit 40b04cf

224 files changed

Lines changed: 15743 additions & 71 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cruft.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"template": "git@github.com:UrbanMachine/create-ros-app.git",
3-
"commit": "92da06d68aabc5ba36e559b7fdd83cf7a54a997f",
3+
"commit": "5cbe2af623cd536fbb52420e3dc8e3205ff6c86e",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {
@@ -9,13 +9,14 @@
99
"dockerhub_username_or_org": "urbanmachine",
1010
"project_name": "node_helpers",
1111
"project_description": "An opinionated ROS2 framework that minimizes boilerplate while maximizing reliability. Features intuitive APIs for parameter management, action handling, and error-resilient RPC. Designed by Urban Machine for safe and scalable robotics.",
12-
"version": "1.0.0",
12+
"version": "0.5.0",
1313
"license": "MIT",
1414
"example_package_name": "node_helpers",
1515
"example_package_description": "An opinionated ROS2 framework that minimizes boilerplate while maximizing reliability. Features intuitive APIs for parameter management, action handling, and error-resilient RPC. Designed by Urban Machine for safe and scalable robotics.",
1616
"example_node_name": "ExampleNode",
1717
"example_launch_profile": "node_helpers_showcase",
18-
"example_package_version": "0.1.0",
18+
"example_package_version": "0.5.0",
19+
"__example_messages_package_name": "node_helpers_msgs",
1920
"_template": "git@github.com:UrbanMachine/create-ros-app.git"
2021
}
2122
},

.github/lint/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
LINTERS = {
2222
PYTHON_LANGUAGE: [
2323
# Run linters from fastest to slowest
24-
lint_ruff_check,
2524
lint_ruff_format,
25+
lint_ruff_check,
2626
lint_darglint,
2727
lint_mypy,
2828
],

.github/lint/paths.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ def required_path(path_str: str) -> Path:
1111

1212
ROS_PATH = required_path("pkgs")
1313
LINT_PATH = required_path(".github/lint")
14-
JS_PATH = Path(".")
15-
FIRMWARE_PATH = Path(".")
14+
JS_PATH = Path()
15+
FIRMWARE_PATH = Path()
1616
LAUNCH_PATH = required_path("launch-profiles")
1717

1818

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,32 @@ An opinionated ROS2 framework that minimizes boilerplate while maximizing reliab
1515
## Running This Project
1616

1717
For in-depth documentation on the repository features, read the [About Template](docs/about_template.md) documentation.
18+
This project is a collection of ROS utilities that play nicely together. It's
19+
recommended to start by reading the highlights in ``docs/``. For smaller utilities, they
20+
will be documented in READMEs in their respective modules.
1821

19-
### Dependencies
22+
For example, ``node_helpers.timing`` has a README describing the API's in that module.
23+
However ``node_helpers.parameters`` has a page under ``docs/`` that describes the
24+
philosophy and usage of the module in depth.
2025

21-
This project depends on [Docker](https://docs.docker.com/get-docker/), and can be accelerated using [Nvidia Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html). Install both before proceeding.
26+
### Dependencies
2227

23-
The linting tooling requires [Poetry](https://python-poetry.org/docs/) to run.
28+
This project depends on [Docker](https://docs.docker.com/get-docker/). The linting tooling requires [Poetry](https://python-poetry.org/docs/) to run.
2429

2530
### Running the Project
2631

32+
This project is intended to be used as a library, however there is a showcase
33+
launch-profile that demonstrates some of the library's features.
34+
2735
To run the project, use the following command:
2836

2937
```shell
3038
docker/launch node_helpers_showcase
3139
```
3240

41+
Take a look at the nodes under `pkgs/node_helpers/nodes`, and the launch file under
42+
`launch-profiles` to get an idea of some of the libraries features.
43+
3344
Then, open http://localhost/ on your browser to view the project logs.
3445

3546

docker-compose.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,17 @@ services:
2626
- "./launch-profiles/${LAUNCH_PROFILE:- 'set in docker/_shared'}:/robot/launch-profile/"
2727
# Necessary for display passthrough
2828
- "/tmp/.X11-unix:/tmp/.X11-unix:rw"
29+
# Necessary for PulseAudio passthrough
30+
- "/run/user/${USER_ID:-1000}/pulse/native:/pulse-socket"
2931
# Build cache, used by `save-build-cache` and `restore-build-cache` docker scripts
3032
- type: volume
3133
source: ros-nodes-build-cache
3234
target: /robot/build
3335
environment:
3436
# Necessary for display passthrough
3537
DISPLAY: $DISPLAY
38+
# Necessary for PulseAudio passthrough
39+
PULSE_SERVER: "unix:/pulse-socket"
3640
# Gives the container access to kernel capabilities, useful for most robots
3741
network_mode: host
3842
cap_add:

docker/Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,6 @@ RUN echo "/opt/ros/${ROS2_DISTRO}/lib/${PYTHON_VERSION}/site-packages" >> /usr/l
108108
RUN echo "/opt/ros/${ROS2_DISTRO}/local/lib/${PYTHON_VERSION}/dist-packages" >> /usr/local/lib/${PYTHON_VERSION}/dist-packages/ros2.pth
109109
RUN make-pth-file-from-workspace "$(pwd)/install" /usr/local/lib/${PYTHON_VERSION}/dist-packages/robot.pth
110110
111-
# Copy in useful runtime scripts
112-
COPY docker/utils/runtime/* /usr/local/bin/
113-
114111
# Move the build cache from a Docker cache mount to a place where our build
115112
# system can see it. This helps make `colcon build` faster between runs.
116113
RUN --mount=type=cache,target="${BUILD_CACHE}" restore-build-cache

docker/utils/environment/make-pth-file-from-workspace

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# make-pth-file-from-workspace {workspace install dir} {.pth file destination}
99
#
1010
# Example:
11-
# make-pth-file-from-workspace /robot/install /usr/local/lib/python3.8/dist-packages/robot.pth
11+
# make-pth-file-from-workspace /robot/install /usr/local/lib/pythonX.XX/dist-packages/robot.pth
1212

1313
set -o errexit
1414
set -o pipefail

docs/about_template.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Using `create-ros-app`
22

33
This repository was initialized by the [create-ros-app](https://github.com/UrbanMachine/create-ros-app) template.
4-
This template is a everything-but-the-robot-code starter for ROS projects. It includes a Dockerfile for building ROS packages, a GitHub Actions workflow for linting and autoformatting, and a few other goodies.
4+
This template is a everything-but-the-robot-code starter for ROS projects. It includes a Dockerfile for building ROS packages, a GitHub Actions workflow for linting and autoformatting, and many other goodies.
55

66
This documentation walks through the features of the template, and how to use them.
77

@@ -56,15 +56,15 @@ Here's a quick guide on the features of this template
5656

5757
The packages directory contains all the packages that are used in the project. Each package is added in the `Dockerfile`, and any new packages should be added there as well.
5858

59-
#### Package structure
60-
Each package is made up of:
59+
#### Python Package structure
60+
Each python package is made up of:
6161
- A `resource` directory, which is a colcon requirement
6262
- A `package.xml` file, which is a colcon requirement
6363
- A `pyproject.toml`, because this project uses [colcon-poetry-ros](https://github.com/UrbanMachine/colcon-poetry-ros) to install project dependencies. Most ROS python packages use `setup.py`, but by using this plugin, we can use a modern python tool called [Poetry](https://python-poetry.org/) to manage dependencies.
6464
- A directory for code
6565
- A directory for tests
6666

67-
#### Test directories
67+
##### Test directories
6868

6969
As (arbitrary) best practice, the example node uses a test directory that follows the following structure
7070

@@ -84,6 +84,12 @@ package_name/
8484

8585
Essentially, tests exist in a parallel directory to the package, and are split into `unit` and `integration` tests. The directories within `unit` and `integration` mirror the structure of the package itself, except that module names are prefixed with `test_`.
8686

87+
#### Message Package Structure
88+
89+
The template will generate a message package for you with an `ExampleAction`, `ExampleService`, and `ExampleMessage`. You can add more messages by adding them to the `msg` directory and updating the `CMakeLists.txt` and `package.xml` files.
90+
91+
This can be used as a place for you to store your messages used just for this project. It follows standard ROS2 message package structure.
92+
8793
### `.github/`
8894

8995
This project uses poetry for linting, and has some code for running linting and autoformatting under `.github/lint`.

0 commit comments

Comments
 (0)