Skip to content

Commit 8d74914

Browse files
committed
Port topic_monitor
1 parent 8809128 commit 8d74914

24 files changed

+768
-3
lines changed

.devcontainer/Dockerfile

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
ARG ROS_DISTRO=rolling
2+
FROM ros:$ROS_DISTRO-ros-base AS desktop
3+
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
WORKDIR /root/ws_ros
6+
7+
ENV PROJECT_NAME=topic_monitor
8+
9+
COPY . src/$PROJECT_NAME
10+
11+
# Install apt packages
12+
RUN apt-get -q update \
13+
&& apt-get -q -y upgrade \
14+
&& apt-get -q install --no-install-recommends -y \
15+
git \
16+
sudo \
17+
clang \
18+
python3-pip \
19+
python3-dev \
20+
python3-venv \
21+
apt-utils \
22+
software-properties-common \
23+
&& apt-get autoremove -y \
24+
&& apt-get clean -y \
25+
&& rm -rf /var/lib/apt/lists/*
26+
27+
# Configure the ubuntu non-root user
28+
ARG USERNAME=ubuntu
29+
ARG USER_UID=1000
30+
ARG USER_GID=$USER_UID
31+
32+
RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
33+
&& chmod 0440 /etc/sudoers.d/$USERNAME \
34+
&& usermod -a -G dialout $USERNAME \
35+
&& echo "source /usr/share/bash-completion/completions/git" >> /home/$USERNAME/.bashrc
36+
37+
# Switch to the ubuntu user
38+
USER $USERNAME
39+
ENV USER=$USERNAME
40+
41+
ENV USER_WORKSPACE=/home/$USERNAME/ws_ros
42+
WORKDIR $USER_WORKSPACE
43+
44+
COPY --chown=$USER_UID:$USER_GID . src/$PROJECT_NAME
45+
46+
# Create a new virtual environment for Python
47+
ENV VIRTUAL_ENV=$USER_WORKSPACE/.venv/$PROJECT_NAME
48+
RUN python3 -m venv --system-site-packages $VIRTUAL_ENV \
49+
&& echo "source ${VIRTUAL_ENV}/bin/activate" >> /home/$USERNAME/.bashrc \
50+
&& touch .venv/COLCON_IGNORE \
51+
&& echo "\n# Ensure colcon is run in the venv\nalias colcon='python3 -m colcon'" >> /home/$USERNAME/.bashrc
52+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
53+
54+
# Install all ROS dependencies
55+
# RUN vcs import src < src/$PROJECT_NAME/ros2.repos
56+
WORKDIR $USER_WORKSPACE
57+
RUN sudo apt-get -q update \
58+
&& sudo apt-get -q -y upgrade \
59+
&& rosdep update \
60+
&& rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} --skip-keys nlohmann_json \
61+
&& sudo apt-get autoremove -y \
62+
&& sudo apt-get clean -y \
63+
&& sudo rm -rf /var/lib/apt/lists/*
64+
65+
RUN . "/opt/ros/${ROS_DISTRO}/setup.sh" \
66+
&& colcon build \
67+
&& echo "source ${USER_WORKSPACE}/install/setup.bash" >> /home/$USERNAME/.bashrc \
68+
&& echo "if [ -f /opt/ros/${ROS_DISTRO}/setup.bash ]; then source /opt/ros/${ROS_DISTRO}/setup.bash; fi" >> /home/$USERNAME/.bashrc
69+
70+
# Install debugging/linting C++ packages
71+
RUN sudo apt-get -q update \
72+
&& sudo apt-get -q -y upgrade \
73+
&& sudo apt-get install -y \
74+
clang-format-18 \
75+
clang-tidy \
76+
clang-tools \
77+
&& sudo apt-get autoremove -y \
78+
&& sudo apt-get clean -y \
79+
&& sudo rm -rf /var/lib/apt/lists/*
80+
81+
WORKDIR $USER_WORKSPACE

.devcontainer/devcontainer.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "ROS 2 Dev Container",
3+
"dockerFile": "Dockerfile",
4+
"context": "..",
5+
"workspaceMount": "source=${localWorkspaceFolder},target=/home/ubuntu/ws_ros/src/topic_monitor,type=bind",
6+
"workspaceFolder": "/home/ubuntu/ws_ros/src/topic_monitor",
7+
"remoteUser": "ubuntu",
8+
"runArgs": [
9+
"--network=host",
10+
"--cap-add=SYS_PTRACE",
11+
"--security-opt=seccomp:unconfined",
12+
"--security-opt=apparmor:unconfined",
13+
"--volume=/dev:/dev",
14+
"--privileged"
15+
],
16+
"customizations": {
17+
"vscode": {
18+
"extensions": [
19+
"ms-azuretools.vscode-docker",
20+
"ms-python.python",
21+
"njpwerner.autodocstring",
22+
"ms-vscode.cpptools",
23+
"redhat.vscode-xml",
24+
"redhat.vscode-yaml",
25+
"DavidAnson.vscode-markdownlint",
26+
"esbenp.prettier-vscode",
27+
"xaver.clang-format",
28+
"charliermarsh.ruff",
29+
"ms-vscode.cmake-tools"
30+
]
31+
}
32+
}
33+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Bug Report
2+
description: Report a bug.
3+
title: "[BUG]: <Please write a descriptive title after the '[BUG]: ' prefix>"
4+
labels: [bug, needs triage]
5+
6+
body:
7+
- type: markdown
8+
attributes:
9+
value: >
10+
Thank you for taking the time to file a bug report! Before creating a new
11+
issue, please make sure to take a few minutes to check the issue tracker
12+
for existing issues about the bug.
13+
14+
- type: textarea
15+
attributes:
16+
label: "Issue Description"
17+
description: >
18+
Please provide a clear and concise description of what the bug is.
19+
validations:
20+
required: true
21+
22+
- type: textarea
23+
attributes:
24+
label: "Steps to Reproduce"
25+
description: >
26+
Please provide the steps that should be taken to reproduce the bug.
27+
validations:
28+
required: true
29+
30+
- type: textarea
31+
attributes:
32+
label: "Expected Behavior"
33+
description: >
34+
Please describe or show an example of the expected behavior.
35+
validations:
36+
required: true
37+
38+
- type: textarea
39+
attributes:
40+
label: "Error Message"
41+
description: >
42+
Please include the full error message, if any.
43+
placeholder: >
44+
<< Full traceback starting from `Traceback: ...` >>
45+
render: bash
46+
47+
- type: textarea
48+
attributes:
49+
label: "Runtime Environment"
50+
description: >
51+
Please provide a description of the environment in which the error
52+
occurred.
53+
placeholder: >
54+
Raspberry Pi 4 running Ubuntu 22.04 natively.
55+
validations:
56+
required: true
57+
58+
- type: textarea
59+
attributes:
60+
label: "Additional Context"
61+
description: >
62+
Please provide any additional context needed to understand the bug.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Documentation Improvement
2+
description: Report an issue related to the project documentation.
3+
title: "[DOC]: <Please write a descriptive title after the '[DOC]: ' prefix>"
4+
labels: [documentation, needs triage]
5+
6+
body:
7+
- type: markdown
8+
attributes:
9+
value: >
10+
Thank you for taking the time to report a documentation issue! Before creating
11+
a new issue, please make sure to take a few minutes to check the issue
12+
tracker for existing issues similar to that being reported.
13+
14+
- type: dropdown
15+
attributes:
16+
label: Documentation Change Type
17+
description: Please indicate what type of documentation issue you are reporting.
18+
options:
19+
- Adding new documentation to the project
20+
- Changing existing project documentation
21+
- Removing existing project documentation
22+
validations:
23+
required: true
24+
25+
- type: textarea
26+
attributes:
27+
label: Documentation Location
28+
description: >
29+
Please provide the location of the documentation that should be modified.
30+
31+
- type: textarea
32+
attributes:
33+
label: Documentation Problem
34+
description: >
35+
Please provide a description of how the documentation needs to be improved.
36+
validations:
37+
required: true
38+
39+
- type: textarea
40+
attributes:
41+
label: Suggested Change
42+
description: >
43+
Please provide a description of the proposed change and why the proposed change
44+
improves the upon the existing documentation.
45+
validations:
46+
required: true
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Feature Request
2+
description: Suggest a new idea for the project.
3+
title: "[FEATURE]: <Please write a descriptive title after the '[FEATURE]: ' prefix>"
4+
labels: [enhancement, needs triage]
5+
6+
body:
7+
- type: markdown
8+
attributes:
9+
value: >
10+
Thank you for taking the time to request a new feature! Before creating
11+
a new issue, please make sure to take a few minutes to check the issue
12+
tracker for existing issues similar to the proposed feature.
13+
14+
- type: dropdown
15+
attributes:
16+
label: Feature Type
17+
description: Please indicate what type of feature request you would like to propose.
18+
options:
19+
- Adding new functionality to the project
20+
- Changing existing functionality in the project
21+
- Removing existing functionality in the project
22+
validations:
23+
required: true
24+
25+
- type: textarea
26+
attributes:
27+
label: "Problem Description"
28+
description: >
29+
Please provide a clear and concise description of what problem
30+
the feature would solve.
31+
validations:
32+
required: true
33+
34+
- type: textarea
35+
attributes:
36+
label: "Feature Description"
37+
description: >
38+
Please provide a description of the proposed feature, using pseudocode
39+
if relevant.
40+
validations:
41+
required: true
42+
43+
- type: textarea
44+
attributes:
45+
label: "Alternative Solutions"
46+
description: >
47+
Please provide a description of any alternative solutions or features
48+
that would satisfy the feature request.
49+
validations:
50+
required: true
51+
52+
- type: textarea
53+
attributes:
54+
label: "Additional Context"
55+
description: >
56+
Please provide any additional context (e.g., relevant GitHub issues,
57+
code examples, or references) needed to understand the feature request.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## Changes Made
2+
3+
Please provide a description of all changes made in this PR and why the changes
4+
are needed.
5+
6+
## Associated Issues
7+
8+
Please provide a list of all open issues that this PR will close or contribute
9+
toward closing.
10+
11+
- Fixes # (issue)
12+
13+
## Testing
14+
15+
Please provide a clear and concise description of the testing performed.

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"

.github/workflows/format.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Formatting (pre-commit)
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
workflow_dispatch:
9+
10+
jobs:
11+
pre-commit:
12+
name: Format
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.12"
22+
23+
- name: Install clang-format-18
24+
run: sudo apt-get install clang-format-18
25+
26+
- name: Run pre-commit
27+
uses: pre-commit/action@v3.0.1
28+
id: precommit
29+
30+
- name: Upload pre-commit changes
31+
if: failure() && steps.precommit.outcome == 'failure'
32+
uses: rhaschke/upload-git-patch-action@main
33+
with:
34+
name: pre-commit

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# ROS 2
2+
build
3+
install
4+
log
5+
6+
# virtualenv
7+
.venv

0 commit comments

Comments
 (0)