Skip to content

Commit bace6d8

Browse files
committed
Initial Commit
0 parents  commit bace6d8

37 files changed

+4273
-0
lines changed

.gitignore

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Unit test / coverage reports
37+
htmlcov/
38+
.tox/
39+
.nox/
40+
.coverage
41+
.coverage.*
42+
.cache
43+
nosetests.xml
44+
coverage.xml
45+
*.cover
46+
*.py,cover
47+
.hypothesis/
48+
.pytest_cache/
49+
50+
# Virtual environments
51+
.env
52+
.venv
53+
env/
54+
venv/
55+
ENV/
56+
env.bak/
57+
venv.bak/
58+
59+
# IDEs and editors
60+
.vscode/
61+
.idea/
62+
*.swp
63+
*.swo
64+
*~
65+
.DS_Store
66+
67+
# ROS2 specific
68+
install/
69+
log/
70+
build/
71+
72+
# CMake
73+
CMakeLists.txt.user
74+
CMakeCache.txt
75+
CMakeFiles
76+
CMakeScripts
77+
Testing
78+
Makefile
79+
cmake_install.cmake
80+
install_manifest.txt
81+
compile_commands.json
82+
CTestTestfile.cmake
83+
_deps
84+
85+
# Backup files
86+
*.bak
87+
*.backup
88+
*~
89+
90+
# Temporary files
91+
*.tmp
92+
*.temp

.gitlab-ci.yml

Lines changed: 288 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,288 @@
1+
# GitLab CI configuration for ros2_monitor_node
2+
# Tests compatibility across multiple ROS 2 distributions
3+
4+
stages:
5+
- test
6+
- debian
7+
- smoke
8+
9+
variables:
10+
ROS_LOCALHOST_ONLY: 1
11+
ROS_AUTOMATIC_DISCOVERY_RANGE: LOCALHOST
12+
GIT_SUBMODULE_STRATEGY: recursive
13+
14+
# Template for all ROS2 distribution tests
15+
.ros2_template: &ros2_template
16+
before_script:
17+
- source /opt/ros/${ROS_DISTRO}/setup.bash
18+
- apt-get update -qq && apt-get install -y build-essential python3-pip
19+
- |
20+
if [[ "${ROS_DISTRO}" == "jazzy" || \
21+
"${ROS_DISTRO}" == "kilted" || \
22+
"${ROS_DISTRO}" == "rolling" ]]; then
23+
pip3 install --break-system-packages -I pygments -r requirements.txt
24+
else
25+
pip3 install -r requirements.txt
26+
fi
27+
script:
28+
- echo "Building and testing on ROS2 ${ROS_DISTRO}"
29+
- colcon build --packages-up-to r2s_gw
30+
- colcon test --event-handlers console_direct+ --return-code-on-test-failure --packages-up-to r2s_gw
31+
artifacts:
32+
when: always
33+
paths:
34+
- build/
35+
- install/
36+
- log/
37+
expire_in: 1 week
38+
reports:
39+
junit: log/test_results/*/junit.xml
40+
rules:
41+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
42+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
43+
- if: $CI_PIPELINE_SOURCE == "push"
44+
45+
# Template for Debian package generation
46+
.debian_template: &debian_template
47+
before_script:
48+
- source /opt/ros/${ROS_DISTRO}/setup.bash
49+
- apt-get update -qq && apt-get install -y build-essential python3-pip python3-bloom python3-rosdep git lsb-release devscripts debhelper fakeroot
50+
- |
51+
if [[ "${ROS_DISTRO}" == "jazzy" || \
52+
"${ROS_DISTRO}" == "kilted" || \
53+
"${ROS_DISTRO}" == "rolling" ]]; then
54+
pip3 install --break-system-packages -I pygments -r requirements.txt
55+
else
56+
pip3 install -r requirements.txt
57+
fi
58+
- |
59+
if [[ "${ROS_DISTRO}" == "jazzy" || \
60+
"${ROS_DISTRO}" == "kilted" || \
61+
"${ROS_DISTRO}" == "rolling" ]]; then
62+
python3 -m pip install -U --break-system-packages bloom
63+
else
64+
python3 -m pip install -U bloom
65+
fi
66+
67+
script:
68+
- set -eo pipefail
69+
- echo "Generating Debian packages for ROS2 ${ROS_DISTRO}"
70+
- mkdir -p debian_packages/${ROS_DISTRO}
71+
# First build the workspace to ensure dependencies are resolved
72+
- colcon build --packages-up-to r2s_gw
73+
- source install/setup.bash
74+
# Add local rosdep rules so bloom can resolve keys to apt names
75+
- echo "Adding local rosdep mappings..."
76+
- mkdir -p /root/.ros/rosdep
77+
- |
78+
cat >/root/.ros/rosdep/local.yaml <<EOF
79+
greenwave_monitor_interfaces:
80+
ubuntu:
81+
jammy: [ros-${ROS_DISTRO}-greenwave-monitor-interfaces]
82+
noble: [ros-${ROS_DISTRO}-greenwave-monitor-interfaces]
83+
greenwave_monitor:
84+
ubuntu:
85+
jammy: [ros-${ROS_DISTRO}-greenwave-monitor]
86+
noble: [ros-${ROS_DISTRO}-greenwave-monitor]
87+
EOF
88+
- mkdir -p /etc/ros/rosdep/sources.list.d
89+
- echo "yaml file:///root/.ros/rosdep/local.yaml" > /etc/ros/rosdep/sources.list.d/99-local.list
90+
- rosdep init || true
91+
- rosdep update --include-eol-distros
92+
# Generate debian packages for greenwave_monitor_interfaces
93+
- echo "Generating debian for greenwave_monitor_interfaces..."
94+
- cd greenwave_monitor_interfaces
95+
- bloom-generate rosdebian --ros-distro ${ROS_DISTRO} && sudo apt-get build-dep . -y && fakeroot debian/rules binary
96+
- cp ../ros-${ROS_DISTRO}-greenwave-monitor-interfaces_*.deb ../debian_packages/${ROS_DISTRO}/
97+
- cd ..
98+
# Make the locally built interfaces package available to satisfy downstream deps
99+
- echo "Installing greenwave_monitor_interfaces to satisfy deps..."
100+
- apt-get update && apt-get install -y ros-${ROS_DISTRO}-greenwave-monitor-interfaces || apt-get install -y ./debian_packages/${ROS_DISTRO}/ros-${ROS_DISTRO}-greenwave-monitor-interfaces_*.deb
101+
# Generate debian packages for greenwave_monitor
102+
- echo "Generating debian for greenwave_monitor..."
103+
- cd greenwave_monitor
104+
- bloom-generate rosdebian --ros-distro ${ROS_DISTRO} && sudo apt-get build-dep . -y && fakeroot debian/rules binary
105+
- cp ../ros-${ROS_DISTRO}-greenwave-monitor_*.deb ../debian_packages/${ROS_DISTRO}/
106+
- cd ..
107+
- apt-get update && apt-get install -y ./debian_packages/${ROS_DISTRO}/ros-${ROS_DISTRO}-greenwave-monitor*.deb
108+
# Generate debian packages for r2s
109+
- echo "Generating debian for r2s..."
110+
- cd r2s_gw
111+
- bloom-generate rosdebian --ros-distro ${ROS_DISTRO} && sudo apt-get build-dep . -y && fakeroot debian/rules binary
112+
- cp ../ros-${ROS_DISTRO}-r2s-gw_*.deb ../debian_packages/${ROS_DISTRO}/
113+
- cd ..
114+
# List what we generated
115+
- echo "Generated debian packages:"
116+
- ls -la debian_packages/${ROS_DISTRO}/
117+
artifacts:
118+
when: always
119+
paths:
120+
- debian_packages/
121+
expire_in: 1 week
122+
rules:
123+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
124+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
125+
126+
# Template for smoke tests that install generated debs in a clean container
127+
.smoke_template: &smoke_template
128+
before_script:
129+
- apt-get update -qq
130+
script:
131+
- set -eo pipefail
132+
- echo "Smoke testing install on ROS2 ${ROS_DISTRO}"
133+
- ls -la debian_packages/${ROS_DISTRO}/
134+
- apt-get install -y ./debian_packages/${ROS_DISTRO}/ros-${ROS_DISTRO}-greenwave-monitor-interfaces_*.deb ./debian_packages/${ROS_DISTRO}/ros-${ROS_DISTRO}-greenwave-monitor_*.deb ./debian_packages/${ROS_DISTRO}/ros-${ROS_DISTRO}-r2s-gw_*.deb
135+
- dpkg -s ros-${ROS_DISTRO}-r2s-gw ros-${ROS_DISTRO}-greenwave-monitor ros-${ROS_DISTRO}-greenwave-monitor-interfaces
136+
- apt-get install -y python3-pip || true
137+
- |
138+
if [[ "${ROS_DISTRO}" == "jazzy" || \
139+
"${ROS_DISTRO}" == "kilted" || \
140+
"${ROS_DISTRO}" == "rolling" ]]; then
141+
python3 -m pip install -I pygments -r r2s_gw/requirements.txt --break-system-packages
142+
else
143+
python3 -m pip install -r r2s_gw/requirements.txt
144+
fi
145+
- source /opt/ros/${ROS_DISTRO}/setup.bash
146+
- timeout 10s bash -lc "script -qfec 'ros2 run r2s_gw r2s_gw' /dev/null <<< \$'q'"
147+
- ros2 run greenwave_monitor greenwave_monitor & echo $! > /tmp/gwm.pid
148+
- sleep 3
149+
- ros2 node list | tee /tmp/nodes.txt
150+
- grep -q greenwave_monitor /tmp/nodes.txt
151+
- kill -TERM "$(cat /tmp/gwm.pid)" || true
152+
- wait "$(cat /tmp/gwm.pid)" || true
153+
rules:
154+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
155+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
156+
157+
# Test on ROS2 Humble
158+
test-humble:
159+
<<: *ros2_template
160+
stage: test
161+
image: ros:humble-ros-base-jammy
162+
variables:
163+
ROS_DISTRO: humble
164+
165+
# Test on ROS2 Iron
166+
test-iron:
167+
<<: *ros2_template
168+
stage: test
169+
image: ros:iron-ros-base-jammy
170+
variables:
171+
ROS_DISTRO: iron
172+
173+
# Test on ROS2 Jazzy
174+
test-jazzy:
175+
<<: *ros2_template
176+
stage: test
177+
image: ros:jazzy-ros-base-noble
178+
variables:
179+
ROS_DISTRO: jazzy
180+
181+
# Test on ROS2 Kilted
182+
test-kilted:
183+
<<: *ros2_template
184+
stage: test
185+
image: ros:kilted-ros-base-noble
186+
variables:
187+
ROS_DISTRO: kilted
188+
189+
# Test on ROS2 Rolling (development)
190+
test-rolling:
191+
<<: *ros2_template
192+
stage: test
193+
image: ros:rolling-ros-base-noble
194+
variables:
195+
ROS_DISTRO: rolling
196+
allow_failure: true # Rolling can be unstable
197+
198+
# Debian package generation for ROS2 Humble
199+
debian-humble:
200+
<<: *debian_template
201+
stage: debian
202+
image: ros:humble-ros-base-jammy
203+
variables:
204+
ROS_DISTRO: humble
205+
needs: ["test-humble"]
206+
207+
# Debian package generation for ROS2 Iron
208+
debian-iron:
209+
<<: *debian_template
210+
stage: debian
211+
image: ros:iron-ros-base-jammy
212+
variables:
213+
ROS_DISTRO: iron
214+
needs: ["test-iron"]
215+
216+
# Debian package generation for ROS2 Jazzy
217+
debian-jazzy:
218+
<<: *debian_template
219+
stage: debian
220+
image: ros:jazzy-ros-base-noble
221+
variables:
222+
ROS_DISTRO: jazzy
223+
needs: ["test-jazzy"]
224+
225+
# Debian package generation for ROS2 Kilted
226+
debian-kilted:
227+
<<: *debian_template
228+
stage: debian
229+
image: ros:kilted-ros-base-noble
230+
variables:
231+
ROS_DISTRO: kilted
232+
needs: ["test-kilted"]
233+
234+
# Debian package generation for ROS2 Rolling
235+
debian-rolling:
236+
<<: *debian_template
237+
stage: debian
238+
image: ros:rolling-ros-base-noble
239+
variables:
240+
ROS_DISTRO: rolling
241+
needs: ["test-rolling"]
242+
allow_failure: true # Rolling can be unstable
243+
244+
# Smoke test on ROS2 Humble
245+
smoke-humble:
246+
<<: *smoke_template
247+
stage: smoke
248+
image: ros:humble-ros-base-jammy
249+
variables:
250+
ROS_DISTRO: humble
251+
needs: ["debian-humble"]
252+
253+
# Smoke test on ROS2 Iron
254+
smoke-iron:
255+
<<: *smoke_template
256+
stage: smoke
257+
image: ros:iron-ros-base-jammy
258+
variables:
259+
ROS_DISTRO: iron
260+
needs: ["debian-iron"]
261+
262+
# Smoke test on ROS2 Jazzy
263+
smoke-jazzy:
264+
<<: *smoke_template
265+
stage: smoke
266+
image: ros:jazzy-ros-base-noble
267+
variables:
268+
ROS_DISTRO: jazzy
269+
needs: ["debian-jazzy"]
270+
271+
# Smoke test on ROS2 Kilted
272+
smoke-kilted:
273+
<<: *smoke_template
274+
stage: smoke
275+
image: ros:kilted-ros-base-noble
276+
variables:
277+
ROS_DISTRO: kilted
278+
needs: ["debian-kilted"]
279+
280+
# Smoke test on ROS2 Rolling
281+
smoke-rolling:
282+
<<: *smoke_template
283+
stage: smoke
284+
image: ros:rolling-ros-base-noble
285+
variables:
286+
ROS_DISTRO: rolling
287+
needs: ["debian-rolling"]
288+
allow_failure: true # Rolling can be unstable

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "r2s_gw"]
2+
path = r2s_gw
3+
url = ../r2s.git
4+
branch = sgillen/monitor

0 commit comments

Comments
 (0)