Skip to content

Commit bec9e17

Browse files
authored
Merge branch 'master' into fix-tile
2 parents 8a3300b + 3d4716f commit bec9e17

File tree

2 files changed

+123
-38
lines changed

2 files changed

+123
-38
lines changed

.github/workflows/config.yml

Lines changed: 65 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -142,66 +142,72 @@ jobs:
142142
DOCKER_IMAGE_JENKINS : ${{ matrix.DOCKER_IMAGE_JENKINS }}
143143
TIMEOUT_JENKINS : 180
144144

145-
# ROS-O setup https://github.com/v4hn/ros-o-builder/blob/jammy-one/README.md#install-instructions
145+
# ROS-O setup for v4hn https://github.com/v4hn/ros-o-builder/blob/jammy-one/README.md#install-instructions
146+
# ROS-O setup for techfak https://ros.packages.techfak.net/
147+
# note that v4hn uses ROS_DISTRO=one and techfak uses ROS_DISTRO
146148
ros-o:
147-
runs-on: ubuntu-latest
148-
149149
strategy:
150150
fail-fast: false
151151
matrix:
152-
include:
153-
- DISTRO: ubuntu:22.04
154-
ROS_REPOSITORY_URL: https://raw.githubusercontent.com/v4hn/ros-o-builder/jammy-one/repository
152+
DEB_DISTRO: [22.04, 24.04]
153+
ARCH: [x64]
154+
ROS_ONE_VARIANT: [techfak]
155+
BUILD_PKGS: ['jsk_recognition_msgs audio_to_spectrogram sound_classification', 'checkerboard_detector imagesift jsk_perception jsk_recognition_utils resized_image_transport', 'jsk_pcl_ros_utils jsk_pcl_ros']
155156

156-
container: ${{ matrix.DISTRO }}
157+
runs-on: ${{ matrix.ARCH == 'x64' && format('ubuntu-{0}', matrix.DEB_DISTRO) || (matrix.ARCH == 'arm64' && format('ubuntu-{0}-arm', matrix.DEB_DISTRO) || format('ubuntu-{0}', matrix.DEB_DISTRO)) }}
157158

158159
env:
159160
DEBIAN_FRONTEND : noninteractive
160161

161162
steps:
162-
- name: Install git on container
163-
run: |
164-
apt update && apt install -y -q -qq git
165-
166163
- name: Chcekout Source
167164
uses: actions/checkout@v3.0.2
168-
with:
169-
submodules: recursive
170165

171166
- name: Setup ROS-O deb repository
172167
run: |
173168
set -x
174-
apt update && apt install -qq -y ca-certificates
175-
echo "deb [trusted=yes] ${{ matrix.ROS_REPOSITORY_URL }}/ ./" | tee /etc/apt/sources.list.d/ros-o-builder.list
176-
apt update
177-
apt install -qq -y python3-rosdep2
178-
echo "yaml ${{ matrix.ROS_REPOSITORY_URL }}/local.yaml debian" | tee /etc/ros/rosdep/sources.list.d/1-ros-o-builder.list
169+
sudo apt update && sudo apt install -qq -y ca-certificates git
170+
if [[ "${{ matrix.DEB_DISTRO }}" == "22.04" ]]; then export CODE_NAME="jammy"; fi
171+
if [[ "${{ matrix.DEB_DISTRO }}" == "24.04" ]]; then export CODE_NAME="noble"; fi
172+
echo "deb [trusted=yes] https://ros.packages.techfak.net $CODE_NAME-testing main" | sudo tee /etc/apt/sources.list.d/ros-o-builder.list
173+
##
174+
# https://github.com/v4hn/ros-deb-builder-action/blob/b7c0ed93fde3a86b5b1027bf8f7145cad6067c90/prepare.sh#L27-L28
175+
# Canonical dropped the Debian ROS packages from 24.04 for political reasons. Wow.
176+
if [[ "${{ matrix.ROS_ONE_VARIANT }}" == "v4hn" && "${{ matrix.DISTRO }}" == "ubuntu:24.04" ]]; then apt install -y software-properties-common retry && retry -d 50,10,30,300 -t 12 add-apt-repository -y ppa:v-launchpad-jochen-sprickerhof-de/ros; fi
177+
##
178+
sudo apt update
179+
if [[ "${{ matrix.ROS_ONE_VARIANT }}" == "v4hn" ]]; then
180+
sudo apt install -qq -y python3-rosdep2
181+
fi
182+
if [[ "${{ matrix.ROS_ONE_VARIANT }}" == "techfak" ]]; then
183+
# Do not install python3-rosdep2, which is an outdated version of rosdep shipped via the Ubuntu repositories (instead of ROS)!
184+
sudo apt install -qq -y python3-rosdep
185+
sudo rosdep init
186+
fi
187+
if [[ "${{ matrix.ROS_ONE_VARIANT }}" == "v4hn" ]]; then
188+
export ROSDEP_PACKAGE_MAPPING="yaml https://raw.githubusercontent.com/v4hn/ros-o-builder/jammy-one/repository/local.yaml debian"
189+
fi
190+
if [[ "${{ matrix.ROS_ONE_VARIANT }}" == "techfak" ]]; then
191+
export ROSDEP_PACKAGE_MAPPING="yaml https://ros.packages.techfak.net/ros-one.yaml ubuntu"
192+
fi
193+
echo $ROSDEP_PACKAGE_MAPPING | sudo tee /etc/ros/rosdep/sources.list.d/1-ros-o-builder.list
179194
rosdep update
195+
shell: bash
180196

181197
- name: Setup catkin-tools
182198
run: |
183199
set -x
184200
# setup catkin tools
185-
apt install -qq -y python3-pip
186-
pip3 install catkin-tools
201+
sudo apt install -qq -y python3-pip
202+
if [[ "${{ matrix.ROS_ONE_VARIANT }}" == "v4hn" ]]; then
203+
pip3 install catkin-tools==0.9.4
204+
sudo apt install -qq -y catkin
205+
fi
206+
if [[ "${{ matrix.ROS_ONE_VARIANT }}" == "techfak" ]]; then
207+
sudo apt install -qq -y ros-one-catkin python3-catkin-tools
208+
fi
187209
# setup build tools
188-
apt install -qq -y cmake build-essential catkin ros-one-rosbash
189-
190-
- name: Download unreleased files
191-
run: |
192-
source /opt/ros/one/setup.bash
193-
set -x
194-
apt install -qq -y git wget
195-
mkdir -p ~/ws/src
196-
cd ~/ws/src
197-
# rosinstall_generator libsiftfast --rosdistro noetic
198-
git clone https://github.com/tork-a/jsk_3rdparty-release.git -b release/noetic/libsiftfast/2.1.28-1
199-
wget https://github.com/jsk-ros-pkg/jsk_3rdparty/commit/cafbff6dd2bd7869eb4f989bedd0a322a7c35d50.diff -O 1.patch
200-
wget https://github.com/jsk-ros-pkg/jsk_3rdparty/commit/c8eb21e211d1a8f803cd55549a5b2bdc87e6ff9f.diff -O 2.patch
201-
patch -d jsk_3rdparty-release -p3 < 1.patch
202-
patch -d jsk_3rdparty-release -p3 < 2.patch
203-
# rosinstall_generator jsk_topic_tools --rosdistro noetic
204-
git clone https://github.com/tork-a/jsk_common-release.git -b release/noetic/jsk_topic_tools/2.2.15-4
210+
sudo apt install -qq -y cmake build-essential ros-one-rosbash
205211
shell: bash
206212

207213
- name: Setup Workspace
@@ -213,13 +219,34 @@ jobs:
213219
cd ~/ws/src
214220
ln -sf $GITHUB_WORKSPACE .
215221
rosdep install -qq -r -y --from-path . --ignore-src || echo "OK"
222+
# check all system packages are able to install, because ROS-O build deb files that needs all packages
223+
PIP_BREAK_SYSTEM_PACKAGES=1 rosdep install -qq --simulate -y --from-path . --ignore-src -t exec -t buildtool_export -t buildtool -t build -t build_export | tee rosdep-install.sh
224+
# catkin_tools is not available on v4hn/jammy
225+
if [[ "${{ matrix.ROS_ONE_VARIANT }}" == "v4hn" ]]; then sed -i '/python3-catkin-tools/s/^/#/' rosdep-install.sh; fi
226+
sed 's/apt-get install/apt-get -y install/;/install ros-one/s/^/#/;/pip3 install/s/^/#/' rosdep-install.sh | bash -xe
227+
shell: bash
228+
229+
- name: Check local installed python
230+
run: |
231+
set -x
232+
pip freeze --local | cut -d= -f1 | xargs -n1 pip show | grep -E '^(Name|Location|Version)' || echo "OK"
233+
shell: bash
234+
235+
- name: Clean Disk space
236+
run: |
237+
set -x
238+
df -h
239+
ls -al /opt/
240+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc || true
241+
sudo apt clean
242+
df -h
216243
shell: bash
217244

218245
- name: Compile Packages
219246
run: |
220247
source /opt/ros/one/setup.bash
221248
set -x
222249
cd ~/ws/
223-
catkin build --no-status -sv ${{ matrix.CATKIN_OPTIONS }} --cmake-args -DCATKIN_ENABLE_TESTING=OFF -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ${{ matrix.CMAKE_OPTIONS }}
250+
catkin build ${{ matrix.BUILD_PKGS }} ${{ matrix.DEB_DISTRO == '22.04' && '-j4' || '' }} --no-status -sv ${{ matrix.CATKIN_OPTIONS }} --cmake-args -DCATKIN_ENABLE_TESTING=OFF -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ${{ matrix.CMAKE_OPTIONS }}
224251
shell: bash
225252

jsk_recognition_utils/python/jsk_recognition_utils/CMakeLists.txt

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,59 @@
1+
# Get NumPy and Cython versions
2+
execute_process(
3+
COMMAND python$ENV{ROS_PYTHON_VERSION} -c "import numpy; print(numpy.__version__)"
4+
OUTPUT_VARIABLE NUMPY_VERSION
5+
OUTPUT_STRIP_TRAILING_WHITESPACE
6+
)
7+
8+
execute_process(
9+
COMMAND python$ENV{ROS_PYTHON_VERSION} -c "import Cython; print(Cython.__version__)"
10+
OUTPUT_VARIABLE CYTHON_VERSION
11+
OUTPUT_STRIP_TRAILING_WHITESPACE
12+
)
13+
14+
message(STATUS "NumPy version: ${NUMPY_VERSION}")
15+
message(STATUS "Cython version: ${CYTHON_VERSION}")
16+
17+
# --- Parse version strings safely ---
18+
# --- Compatibility logic (CMake 3.5+) ---
19+
function(version_to_number ver_str out_var)
20+
string(REPLACE "." ";" _parts ${ver_str})
21+
list(LENGTH _parts _len)
22+
list(GET _parts 0 _major)
23+
if(_len GREATER 1)
24+
list(GET _parts 1 _minor)
25+
else()
26+
set(_minor 0)
27+
endif()
28+
if(_len GREATER 2)
29+
list(GET _parts 2 _patch)
30+
else()
31+
set(_patch 0)
32+
endif()
33+
math(EXPR _version_num "${_major} * 10000 + ${_minor} * 100 + ${_patch}")
34+
set(${out_var} ${_version_num} PARENT_SCOPE)
35+
endfunction()
36+
37+
# Compare versions
38+
# This noexcept modifier was added in newer versions of Cython, and support for it is required when compiling with newer versions of NumPy (1.26+).
39+
# Update your Cython to a recent version (>= 0.29.30 or 3.0+ recommended):
40+
41+
42+
# Simulate GREATER_EQUAL using GREATER or EQUAL
43+
set(SKIP_NMS FALSE)
44+
version_to_number("${NUMPY_VERSION}" NUMPY_VER)
45+
if(NUMPY_VER GREATER 12600 OR NUMPY_VER EQUAL 12600)
46+
version_to_number("${CYTHON_VERSION}" CYTHON_VER)
47+
if(CYTHON_VER LESS 2930)
48+
set(SKIP_NMS TRUE)
49+
endif()
50+
endif()
51+
52+
if(SKIP_NMS)
53+
message(WARNING "NumPy >= 1.26.0 requires newer version of Cython >= 0.29.30, skip compile nms.pyx")
54+
else()
55+
# Your normal logic here
56+
157
if(NOT DEFINED Numpy_INCLUDE_DIRS)
258
# Get Numpy include directories
359
execute_process(
@@ -16,3 +72,5 @@ install(TARGETS nms
1672
ARCHIVE DESTINATION ${CATKIN_PACKAGE_PYTHON_DESTINATION}
1773
LIBRARY DESTINATION ${CATKIN_PACKAGE_PYTHON_DESTINATION}
1874
)
75+
76+
endif()

0 commit comments

Comments
 (0)