Skip to content

Commit 1d3def5

Browse files
committed
Rebase from 'debian/noetic/opencv_apps'
1 parent f311e78 commit 1d3def5

File tree

96 files changed

+1929
-637
lines changed

Some content is hidden

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

96 files changed

+1929
-637
lines changed

.clang-format

Lines changed: 44 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,77 @@
11
---
22
BasedOnStyle: Google
3+
ColumnLimit: 120
4+
MaxEmptyLinesToKeep: 1
5+
SortIncludes: false
6+
7+
Standard: Auto
8+
IndentWidth: 2
9+
TabWidth: 2
10+
UseTab: Never
311
AccessModifierOffset: -2
412
ConstructorInitializerIndentWidth: 2
13+
NamespaceIndentation: None
14+
ContinuationIndentWidth: 4
15+
IndentCaseLabels: true
16+
IndentFunctionDeclarationAfterType: false
17+
518
AlignEscapedNewlinesLeft: false
619
AlignTrailingComments: true
20+
721
AllowAllParametersOfDeclarationOnNextLine: false
22+
ExperimentalAutoDetectBinPacking: false
23+
ObjCSpaceBeforeProtocolList: true
24+
Cpp11BracedListStyle: false
25+
26+
AllowShortBlocksOnASingleLine: true
827
AllowShortIfStatementsOnASingleLine: false
928
AllowShortLoopsOnASingleLine: false
1029
AllowShortFunctionsOnASingleLine: None
11-
AllowShortLoopsOnASingleLine: false
30+
AllowShortCaseLabelsOnASingleLine: false
31+
1232
AlwaysBreakTemplateDeclarations: true
1333
AlwaysBreakBeforeMultilineStrings: false
1434
BreakBeforeBinaryOperators: false
1535
BreakBeforeTernaryOperators: false
1636
BreakConstructorInitializersBeforeComma: true
37+
1738
BinPackParameters: true
18-
ColumnLimit: 120
1939
ConstructorInitializerAllOnOneLineOrOnePerLine: true
2040
DerivePointerBinding: false
2141
PointerBindsToType: true
22-
ExperimentalAutoDetectBinPacking: false
23-
IndentCaseLabels: true
24-
MaxEmptyLinesToKeep: 1
25-
NamespaceIndentation: None
26-
ObjCSpaceBeforeProtocolList: true
27-
PenaltyBreakBeforeFirstCallParameter: 19
28-
PenaltyBreakComment: 60
42+
43+
PenaltyExcessCharacter: 50
44+
PenaltyBreakBeforeFirstCallParameter: 30
45+
PenaltyBreakComment: 1000
46+
PenaltyBreakFirstLessLess: 10
2947
PenaltyBreakString: 100
30-
PenaltyBreakFirstLessLess: 1000
31-
PenaltyExcessCharacter: 1000
32-
PenaltyReturnTypeOnItsOwnLine: 70
48+
PenaltyReturnTypeOnItsOwnLine: 50
49+
3350
SpacesBeforeTrailingComments: 2
34-
Cpp11BracedListStyle: false
35-
Standard: Auto
36-
IndentWidth: 2
37-
TabWidth: 2
38-
UseTab: Never
39-
IndentFunctionDeclarationAfterType: false
4051
SpacesInParentheses: false
4152
SpacesInAngles: false
4253
SpaceInEmptyParentheses: false
4354
SpacesInCStyleCastParentheses: false
55+
SpaceAfterCStyleCast: false
4456
SpaceAfterControlStatementKeyword: true
4557
SpaceBeforeAssignmentOperators: true
46-
ContinuationIndentWidth: 4
47-
SortIncludes: false
48-
SpaceAfterCStyleCast: false
58+
59+
ReflowComments: false
4960

5061
# Configure each individual brace in BraceWrapping
5162
BreakBeforeBraces: Custom
5263

5364
# Control of individual brace wrapping cases
54-
BraceWrapping: {
55-
AfterClass: 'true'
56-
AfterControlStatement: 'true'
57-
AfterEnum : 'true'
58-
AfterFunction : 'true'
59-
AfterNamespace : 'true'
60-
AfterStruct : 'true'
61-
AfterUnion : 'true'
62-
BeforeCatch : 'true'
63-
BeforeElse : 'true'
64-
IndentBraces : 'false'
65-
}
65+
BraceWrapping:
66+
AfterCaseLabel: true
67+
AfterClass: true
68+
AfterControlStatement: true
69+
AfterEnum: true
70+
AfterFunction: true
71+
AfterNamespace: true
72+
AfterStruct: true
73+
AfterUnion: true
74+
BeforeCatch: true
75+
BeforeElse: true
76+
IndentBraces: false
6677
...

.github/workflows/ci.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
on: [push, pull_request]
2+
3+
jobs:
4+
ci:
5+
runs-on: ubuntu-latest
6+
name: ci
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
include:
11+
- CHECK_PYTHON3_COMPILE : true
12+
- TEST : catkin_lint
13+
DOCKER_IMAGE : ubuntu:focal
14+
- TEST : clang-format
15+
- TEST : clang-tidy
16+
ROS_DISTRO : melodic
17+
DOCKER_IMAGE : ubuntu:bionic
18+
- ROS_DISTRO : hydro
19+
DOCKER_IMAGE : ubuntu:precise
20+
- OPENCV_VERSION : 2
21+
ROS_DISTRO : indigo
22+
DOCKER_IMAGE : ubuntu:trusty
23+
- OPENCV_VERSION : 3
24+
ROS_DISTRO : indigo
25+
DOCKER_IMAGE : ubuntu:trusty
26+
- ROS_DISTRO : kinetic
27+
DOCKER_IMAGE : ubuntu:xenial
28+
- ROS_DISTRO : melodic
29+
DOCKER_IMAGE : ubuntu:bionic
30+
- ROS_DISTRO : noetic
31+
DOCKER_IMAGE : ubuntu:focal
32+
- ROS_DISTRO : one
33+
DOCKER_IMAGE : ubuntu:jammy
34+
- ROS_DISTRO : one
35+
DOCKER_IMAGE : ubuntu:noble
36+
- TEST : debian-unstable
37+
DOCKER_IMAGE : debian:unstable
38+
steps:
39+
- name: Setup OS
40+
run: |
41+
sudo apt-get update -y
42+
sudo apt-get upgrade -y
43+
- name: Setup Git
44+
run: |
45+
sudo apt-get install -y git
46+
- name: Chcekout
47+
uses: actions/checkout@v2
48+
with:
49+
fetch-depth: 0
50+
submodules: recursive
51+
# python3_check
52+
- name: python3_check
53+
if: matrix.CHECK_PYTHON3_COMPILE == true
54+
run: python3 -m compileall .
55+
# catkin_lint
56+
- name: catkin_lint setup
57+
if: matrix.TEST == 'catkin_lint' && matrix.DOCKER_IMAGE == ''
58+
run: |
59+
sudo apt-get install -y -q python3-pip
60+
# See https://github.com/ros-perception/opencv_apps/pull/143
61+
# In catkin_lint > 1.6.18, cmake_minimum_required >= 2.8.12
62+
sudo pip3 install catkin_lint==1.6.18 rosdep
63+
sudo rosdep init
64+
rosdep update
65+
- name: catkin_lint test
66+
if: matrix.TEST == 'catkin_lint' && matrix.DOCKER_IMAGE == ''
67+
run: |
68+
ROS_DISTRO=melodic catkin_lint --resolve-env --strict $PWD
69+
# clang-format
70+
- name: clang-format setup
71+
if: matrix.TEST == 'clang-format'
72+
run: |
73+
sudo apt-get install -y -q clang-format git
74+
- name: clang-format test
75+
if: matrix.TEST == 'clang-format'
76+
run: |
77+
find $PWD -name '*.h' -or -name '*.hpp' -or -name '*.cpp' | xargs clang-format -i -style=file
78+
git -C $PWD --no-pager diff
79+
git -C $PWD diff-index --quiet HEAD -- .
80+
- name: script
81+
if: matrix.DOCKER_IMAGE
82+
run: |
83+
docker run --rm -i -v $PWD:$PWD -e "CI_SOURCE_PATH=$PWD" -e "HOME=$HOME" -e "ROS_DISTRO=${{ matrix.ROS_DISTRO }}" -e "OPENCV_VERSION=${{ matrix.OPENCV_VERSION }}" -e "TEST=${{ matrix.TEST }}" -e "DOCKER_IMAGE=${{ matrix.DOCKER_IMAGE }}" ${{ matrix.DOCKER_IMAGE }} sh -c "cd $PWD; /bin/bash .travis.sh"

.travis.sh

Lines changed: 88 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,18 @@ function setup {
2626
travis_time_start setup.before_install
2727
#before_install:
2828
# Install ROS
29-
sudo sh -c "echo \"deb http://packages.ros.org/ros-shadow-fixed/ubuntu `lsb_release -cs` main\" > /etc/apt/sources.list.d/ros-latest.list"
29+
if [[ "$ROS_DISTRO" == "one" ]]; then
30+
UBUNTU_DISTRO=$(echo "$DOCKER_IMAGE" | cut -d':' -f2)
31+
echo "deb [trusted=yes] https://raw.githubusercontent.com/k-okada/ros-o-builder/$UBUNTU_DISTRO-one-unstable/repository/ ./" | sudo tee /etc/apt/sources.list.d/ros-o-builder.list
32+
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC sudo -E apt install -y software-properties-common
33+
[[ "$UBUNTU_DISTRO" == "noble" ]] && sudo -E add-apt-repository -y ppa:v-launchpad-jochen-sprickerhof-de/ros
34+
[[ "$UBUNTU_DISTRO" == "jammy" ]] && sudo -E add-apt-repository -y ppa:k-okada/python3-catkin-tools
35+
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC sudo -E apt install -y python3-rosdep2
36+
echo "yaml https://raw.githubusercontent.com/k-okada/ros-o-builder/$UBUNTU_DISTRO-one-unstable/repository/local.yaml debian" | sudo tee /etc/ros/rosdep/sources.list.d/1-ros-o-builder.list
37+
rosdep update
38+
else
39+
sudo sh -c "echo \"deb http://packages.ros.org/ros-shadow-fixed/ubuntu `lsb_release -cs` main\" > /etc/apt/sources.list.d/ros-latest.list"
40+
fi
3041
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
3142
# Setup EoL repository
3243
if [[ "$ROS_DISTRO" == "hydro" || "$ROS_DISTRO" == "jade" || "$ROS_DISTRO" == "lunar" ]]; then
@@ -41,15 +52,42 @@ function setup {
4152
fi
4253
###
4354
# Install ROS
44-
if [[ "$ROS_DISTRO" == "noetic" ]]; then
55+
if [[ "$ROS_DISTRO" == "one" ]]; then
56+
if [[ "$UBUNTU_DISTRO" == "jammy" ]]; then
57+
sudo apt-get install -y -q python3-catkin-pkg python3-wstool python3-rosinstall-generator python3-osrf-pycommon
58+
sudo apt-get install -y -q python3-catkin-tools
59+
else
60+
sudo apt-get install -y -q python3-pip python3-zombie-imp
61+
pip3 install --user --break-system-packages vcstool
62+
pip3 install --user --break-system-packages rosinstall-generator
63+
export PATH="$PATH:~/.local/bin"
64+
sudo apt-get install -y -q python3-catkin-pkg python3-osrf-pycommon
65+
sudo apt-get install -y -q catkin-tools
66+
fi
67+
elif [[ "$ROS_DISTRO" == "noetic" ]]; then
4568
sudo apt-get install -y -q python3-catkin-pkg python3-catkin-tools python3-rosdep python3-wstool python3-rosinstall-generator python3-osrf-pycommon
4669
else
4770
sudo apt-get install -y -q python-catkin-pkg python-catkin-tools python-rosdep python-wstool python-rosinstall-generator
4871
fi
49-
sudo apt-get install -y -q ros-$ROS_DISTRO-catkin
72+
if [[ "$ROS_DISTRO" == "one" ]]; then
73+
sudo apt-get install -y -q catkin
74+
sudo apt-get install -y -q ros-$ROS_DISTRO-rosbash ros-$ROS_DISTRO-ros-environment
75+
else
76+
sudo apt-get install -y -q ros-$ROS_DISTRO-catkin
77+
fi
78+
export ROS_DISTRO=$_ROS_DISTRO
5079
source /opt/ros/$ROS_DISTRO/setup.bash
5180
# Setup for rosdep
52-
sudo rosdep init
81+
[ -e /etc/ros/rosdep/sources.list.d ] || sudo rosdep init
82+
# use snapshot of rosdep list
83+
# https://github.com/ros/rosdistro/pull/31570#issuecomment-1000497517
84+
if [[ "$ROS_DISTRO" =~ "hydro"|"indigo"|"jade"|"kinetic"|"lunar" ]]; then
85+
sudo rm /etc/ros/rosdep/sources.list.d/20-default.list
86+
sudo wget https://raw.githubusercontent.com/jsk-ros-pkg/jsk_travis/refs/heads/master/rosdep_snapshots/30-xenial.list -O /etc/ros/rosdep/sources.list.d/30-xenial.list
87+
elif [[ "$ROS_DISTRO" =~ "melodic" ]]; then
88+
sudo rm /etc/ros/rosdep/sources.list.d/20-default.list
89+
sudo wget https://raw.githubusercontent.com/jsk-ros-pkg/jsk_travis/refs/heads/master/rosdep_snapshots/30-bionic.list -O /etc/ros/rosdep/sources.list.d/30-bionic.list
90+
fi
5391
rosdep update --include-eol-distros
5492
travis_time_end
5593

@@ -69,14 +107,17 @@ function setup {
69107
#before_script:
70108
# source dependencies: install using wstool.
71109
cd ~/catkin_ws/src
72-
wstool init
110+
wstool init || echo "OK"
73111
#if [[ -f $ROSINSTALL_FILE ]] ; then wstool merge $ROSINSTALL_FILE ; fi
74112
if [ "$OPENCV_VERSION" == 3 ]; then rosinstall_generator image_pipeline --upstream >> .rosinstall.opencv3; fi # need to recompile image_proc
75113
if [ "$OPENCV_VERSION" == 3 ]; then rosinstall_generator compressed_image_transport --upstream >> .rosinstall.opencv3; fi # need to recompile compressed_image_transport
76114
if [ "$OPENCV_VERSION" == 3 ]; then rosinstall_generator vision_opencv --upstream >> .rosinstall.opencv3; fi # need to recompile visoin_opencv
77-
if [ "$OPENCV_VERSION" == 3 ]; then wstool merge .rosinstall.opencv3; fi # need to recompile visoin_opencv
78-
wstool up
79-
wstool info
115+
if [ "$ROS_DISTRO" == "indigo" ]; then ROS_DISTRO=kinetic rosinstall_generator roslaunch >> .rosinstall.opencv3; fi # face_detection.launch requires roslaunch-check >= 1.12.1
116+
if [[ "$OPENCV_VERSION" == 3 || "$ROS_DISTRO" == "indigo" ]]; then wstool merge .rosinstall.opencv3 || [ ! -s .rosinstall.opencv3 ] || vcs import . < .rosinstall.opencv3 ; fi # need to recompile visoin_opencv
117+
git config --global --add safe.directory $CI_SOURCE_PATH
118+
git config --global --add safe.directory ~/catkin_ws/src || echo "OK"
119+
wstool up || vcs pull
120+
wstool info || vcs branch
80121
if [ "$OPENCV_VERSION" == 3 ]; then sed -i 's@libopencv-dev@opencv3@' */*/package.xml ; fi
81122

82123

@@ -87,6 +128,7 @@ function setup {
87128
}
88129

89130
function build {
131+
export ROS_DISTRO=$_ROS_DISTRO
90132
travis_time_start build.script
91133
source /opt/ros/$ROS_DISTRO/setup.bash
92134
cd ~/catkin_ws
@@ -95,15 +137,17 @@ function build {
95137
}
96138

97139
function run_test {
140+
export ROS_DISTRO=$_ROS_DISTRO
98141
travis_time_start run_test.script
99142
source /opt/ros/$ROS_DISTRO/setup.bash
100143
cd ~/catkin_ws
101-
catkin run_tests -p1 -j1 --no-status opencv_apps --no-deps
144+
catkin run_tests -p1 -j1 --no-status -i opencv_apps --no-deps
102145
catkin_test_results --verbose build || catkin_test_results --all build
103146
travis_time_end
104147
}
105148

106149
function build_install {
150+
export ROS_DISTRO=$_ROS_DISTRO
107151
travis_time_start build_install.script
108152
source /opt/ros/$ROS_DISTRO/setup.bash
109153
cd ~/catkin_ws
@@ -113,28 +157,34 @@ function build_install {
113157
travis_time_end
114158
}
115159

160+
# setup.bash override ROS_DISTRO...
161+
export _ROS_DISTRO=$ROS_DISTRO
162+
116163
travis_time_start apt.before_install
117-
apt-get update -qq && apt-get install -y -q wget sudo lsb-release gnupg # for docker
164+
apt-get -y -qq update || if [ $? -eq 100 ]; then sed -i 's/archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list; apt-get -y -qq update; fi
165+
apt-get install -y -q wget sudo lsb-release gnupg ca-certificates git # for docker
118166
# set DEBIAN_FRONTEND=noninteractive
119167
echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections
120168
travis_time_end
121169

122170
if [ "$TEST" == "catkin_lint" ]; then
123171

124172
travis_time_start catkin_lint.script
125-
apt-get install -y -q python-pip
126-
pip install catkin_lint rosdep
173+
apt-get install -y -q python3-pip
174+
# See https://github.com/ros-perception/opencv_apps/pull/143
175+
# In catkin_lint > 1.6.18, cmake_minimum_required >= 2.8.12
176+
sudo pip3 install catkin_lint==1.6.18 rosdep
127177
rosdep init
128-
rosdep update
178+
rosdep update --include-eol-distros
129179
travis_time_end
130180
ROS_DISTRO=melodic catkin_lint --resolve-env --strict $CI_SOURCE_PATH
131181

132182

133183
elif [ "$TEST" == "clang-format" ]; then
134184

135185
travis_time_start clang_format.script
136-
apt-get install -y -q clang-format-3.9 git
137-
find $CI_SOURCE_PATH -name '*.h' -or -name '*.hpp' -or -name '*.cpp' | xargs clang-format-3.9 -i -style=file
186+
apt-get install -y -q clang-format git
187+
find $CI_SOURCE_PATH -name '*.h' -or -name '*.hpp' -or -name '*.cpp' | xargs clang-format -i -style=file
138188
travis_time_end
139189
git -C $CI_SOURCE_PATH --no-pager diff
140190
git -C $CI_SOURCE_PATH diff-index --quiet HEAD -- .
@@ -156,9 +206,32 @@ elif [ "$TEST" == "clang-tidy" ]; then
156206
run-clang-tidy -fix -p $(dirname $file)
157207
done
158208
travis_time_end
209+
sudo chown -R $(whoami) $CI_SOURCE_PATH
159210
git -C $CI_SOURCE_PATH --no-pager diff
160211
git -C $CI_SOURCE_PATH diff-index --quiet HEAD -- .
161212

213+
elif [ "$TEST" == "debian-unstable" ]; then
214+
215+
sed -i 's/Types: deb/Types: deb deb-src/' /etc/apt/sources.list.d/debian.sources
216+
apt update
217+
apt-get -y build-dep ros-opencv-apps
218+
219+
# rebuild cv-bridge to fix '/usr/bin/ld: cannot find -lopencv_barcode: No such file or directory'
220+
travis_time_start rebuild_cv_bridge_deb.script
221+
apt source ros-vision-opencv
222+
apt-get -y build-dep $(find -type d -iname "ros-vision-opencv*")
223+
(cd $(find -type d -iname "ros-vision-opencv*") && dpkg-buildpackage -b -us -uc)
224+
dpkg -i *.deb
225+
travis_time_end
226+
227+
travis_time_start build_debian_unstable.script
228+
cd $CI_SOURCE_PATH
229+
mkdir build
230+
cd build
231+
cmake ..
232+
make VERBOSE=1
233+
travis_time_end
234+
162235
else
163236
# Compile and test.
164237
setup

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ language: generic
44
env:
55
- CHECK_PYTHON3_COMPILE=true
66
- TEST=catkin_lint DOCKER_IMAGE=ubuntu:bionic
7-
- TEST=clang-format DOCKER_IMAGE=ubuntu:bionic
7+
- TEST=clang-format DOCKER_IMAGE=ubuntu:focal
88
- TEST=clang-tidy ROS_DISTRO=melodic DOCKER_IMAGE=ubuntu:bionic
99
- ROS_DISTRO=hydro DOCKER_IMAGE=ubuntu:precise
1010
- OPENCV_VERSION=2 ROS_DISTRO=indigo DOCKER_IMAGE=ubuntu:trusty

0 commit comments

Comments
 (0)