Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ jobs:
runs-on: ubuntu-latest
name: ci
strategy:
fail-fast: false
matrix:
include:
- CHECK_PYTHON3_COMPILE : true
- TEST : catkin_lint
DOCKER_IMAGE : ubuntu:focal
- TEST : clang-format
- TEST : clang-tidy
ROS_DISTRO : melodic
Expand All @@ -27,6 +29,10 @@ jobs:
DOCKER_IMAGE : ubuntu:bionic
- ROS_DISTRO : noetic
DOCKER_IMAGE : ubuntu:focal
- ROS_DISTRO : one
DOCKER_IMAGE : ubuntu:jammy
- ROS_DISTRO : one
DOCKER_IMAGE : ubuntu:noble
- TEST : debian-unstable
DOCKER_IMAGE : debian:unstable
steps:
Expand All @@ -48,7 +54,7 @@ jobs:
run: python3 -m compileall .
# catkin_lint
- name: catkin_lint setup
if: matrix.TEST == 'catkin_lint'
if: matrix.TEST == 'catkin_lint' && matrix.DOCKER_IMAGE == ''
run: |
sudo apt-get install -y -q python3-pip
# See https://github.com/ros-perception/opencv_apps/pull/143
Expand All @@ -57,7 +63,7 @@ jobs:
sudo rosdep init
rosdep update
- name: catkin_lint test
if: matrix.TEST == 'catkin_lint'
if: matrix.TEST == 'catkin_lint' && matrix.DOCKER_IMAGE == ''
run: |
ROS_DISTRO=melodic catkin_lint --resolve-env --strict $PWD
# clang-format
Expand All @@ -74,4 +80,4 @@ jobs:
- name: script
if: matrix.DOCKER_IMAGE
run: |
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 }}" ${{ matrix.DOCKER_IMAGE }} sh -c "cd $PWD; /bin/bash .travis.sh"
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"
77 changes: 64 additions & 13 deletions .travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,18 @@ function setup {
travis_time_start setup.before_install
#before_install:
# Install ROS
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"
if [[ "$ROS_DISTRO" == "one" ]]; then
UBUNTU_DISTRO=$(echo "$DOCKER_IMAGE" | cut -d':' -f2)
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
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC sudo -E apt install -y software-properties-common
[[ "$UBUNTU_DISTRO" == "noble" ]] && sudo -E add-apt-repository -y ppa:v-launchpad-jochen-sprickerhof-de/ros
[[ "$UBUNTU_DISTRO" == "jammy" ]] && sudo -E add-apt-repository -y ppa:k-okada/python3-catkin-tools
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC sudo -E apt install -y python3-rosdep2
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
rosdep update
else
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"
fi
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
# Setup EoL repository
if [[ "$ROS_DISTRO" == "hydro" || "$ROS_DISTRO" == "jade" || "$ROS_DISTRO" == "lunar" ]]; then
Expand All @@ -41,20 +52,41 @@ function setup {
fi
###
# Install ROS
if [[ "$ROS_DISTRO" == "noetic" ]]; then
if [[ "$ROS_DISTRO" == "one" ]]; then
if [[ "$UBUNTU_DISTRO" == "jammy" ]]; then
sudo apt-get install -y -q python3-catkin-pkg python3-wstool python3-rosinstall-generator python3-osrf-pycommon
sudo apt-get install -y -q python3-catkin-tools
else
sudo apt-get install -y -q python3-pip python3-zombie-imp
pip3 install --user --break-system-packages vcstool
pip3 install --user --break-system-packages rosinstall-generator
export PATH="$PATH:~/.local/bin"
sudo apt-get install -y -q python3-catkin-pkg python3-osrf-pycommon
sudo apt-get install -y -q catkin-tools
fi
elif [[ "$ROS_DISTRO" == "noetic" ]]; then
sudo apt-get install -y -q python3-catkin-pkg python3-catkin-tools python3-rosdep python3-wstool python3-rosinstall-generator python3-osrf-pycommon
else
sudo apt-get install -y -q python-catkin-pkg python-catkin-tools python-rosdep python-wstool python-rosinstall-generator
fi
sudo apt-get install -y -q ros-$ROS_DISTRO-catkin
if [[ "$ROS_DISTRO" == "one" ]]; then
sudo apt-get install -y -q catkin
sudo apt-get install -y -q ros-$ROS_DISTRO-rosbash ros-$ROS_DISTRO-ros-environment
else
sudo apt-get install -y -q ros-$ROS_DISTRO-catkin
fi
export ROS_DISTRO=$_ROS_DISTRO
source /opt/ros/$ROS_DISTRO/setup.bash
# Setup for rosdep
sudo rosdep init
[ -e /etc/ros/rosdep/sources.list.d ] || sudo rosdep init
# use snapshot of rosdep list
# https://github.com/ros/rosdistro/pull/31570#issuecomment-1000497517
if [[ "$ROS_DISTRO" =~ "hydro"|"indigo"|"jade"|"kinetic"|"lunar" ]]; then
sudo rm /etc/ros/rosdep/sources.list.d/20-default.list
sudo wget https://gist.githubusercontent.com/cottsay/b27a46e53b8f7453bf9ff637d32ea283/raw/476b3714bb90cfbc6b8b9d068162fc6408fa7f76/30-xenial.list -O /etc/ros/rosdep/sources.list.d/30-xenial.list
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
elif [[ "$ROS_DISTRO" =~ "melodic" ]]; then
sudo rm /etc/ros/rosdep/sources.list.d/20-default.list
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
fi
rosdep update --include-eol-distros
travis_time_end
Expand All @@ -75,14 +107,17 @@ function setup {
#before_script:
# source dependencies: install using wstool.
cd ~/catkin_ws/src
wstool init
wstool init || echo "OK"
#if [[ -f $ROSINSTALL_FILE ]] ; then wstool merge $ROSINSTALL_FILE ; fi
if [ "$OPENCV_VERSION" == 3 ]; then rosinstall_generator image_pipeline --upstream >> .rosinstall.opencv3; fi # need to recompile image_proc
if [ "$OPENCV_VERSION" == 3 ]; then rosinstall_generator compressed_image_transport --upstream >> .rosinstall.opencv3; fi # need to recompile compressed_image_transport
if [ "$OPENCV_VERSION" == 3 ]; then rosinstall_generator vision_opencv --upstream >> .rosinstall.opencv3; fi # need to recompile visoin_opencv
if [ "$OPENCV_VERSION" == 3 ]; then wstool merge .rosinstall.opencv3; fi # need to recompile visoin_opencv
wstool up
wstool info
if [ "$ROS_DISTRO" == "indigo" ]; then ROS_DISTRO=kinetic rosinstall_generator roslaunch >> .rosinstall.opencv3; fi # face_detection.launch requires roslaunch-check >= 1.12.1
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
git config --global --add safe.directory $CI_SOURCE_PATH
git config --global --add safe.directory ~/catkin_ws/src || echo "OK"
wstool up || vcs pull
wstool info || vcs branch
if [ "$OPENCV_VERSION" == 3 ]; then sed -i 's@libopencv-dev@opencv3@' */*/package.xml ; fi


Expand All @@ -93,6 +128,7 @@ function setup {
}

function build {
export ROS_DISTRO=$_ROS_DISTRO
travis_time_start build.script
source /opt/ros/$ROS_DISTRO/setup.bash
cd ~/catkin_ws
Expand All @@ -101,6 +137,7 @@ function build {
}

function run_test {
export ROS_DISTRO=$_ROS_DISTRO
travis_time_start run_test.script
source /opt/ros/$ROS_DISTRO/setup.bash
cd ~/catkin_ws
Expand All @@ -110,6 +147,7 @@ function run_test {
}

function build_install {
export ROS_DISTRO=$_ROS_DISTRO
travis_time_start build_install.script
source /opt/ros/$ROS_DISTRO/setup.bash
cd ~/catkin_ws
Expand All @@ -119,20 +157,25 @@ function build_install {
travis_time_end
}

# setup.bash override ROS_DISTRO...
export _ROS_DISTRO=$ROS_DISTRO

travis_time_start apt.before_install
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
apt-get install -y -q wget sudo lsb-release gnupg # for docker
apt-get install -y -q wget sudo lsb-release gnupg ca-certificates git # for docker
# set DEBIAN_FRONTEND=noninteractive
echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections
travis_time_end

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

travis_time_start catkin_lint.script
apt-get install -y -q python-pip
pip install catkin_lint rosdep
apt-get install -y -q python3-pip
# See https://github.com/ros-perception/opencv_apps/pull/143
# In catkin_lint > 1.6.18, cmake_minimum_required >= 2.8.12
sudo pip3 install catkin_lint==1.6.18 rosdep
rosdep init
rosdep update
rosdep update --include-eol-distros
travis_time_end
ROS_DISTRO=melodic catkin_lint --resolve-env --strict $CI_SOURCE_PATH

Expand Down Expand Up @@ -173,6 +216,14 @@ elif [ "$TEST" == "debian-unstable" ]; then
apt update
apt-get -y build-dep ros-opencv-apps

# rebuild cv-bridge to fix '/usr/bin/ld: cannot find -lopencv_barcode: No such file or directory'
travis_time_start rebuild_cv_bridge_deb.script
apt source ros-vision-opencv
apt-get -y build-dep $(find -type d -iname "ros-vision-opencv*")
(cd $(find -type d -iname "ros-vision-opencv*") && dpkg-buildpackage -b -us -uc)
dpkg -i *.deb
travis_time_end

travis_time_start build_debian_unstable.script
cd $CI_SOURCE_PATH
mkdir build
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "7")
else ()
message(FATAL_ERROR "C++11 needed. Therefore a gcc compiler with a version higher than 4.3 is needed.")
endif()
endif(CMAKE_COMPILER_IS_GNUCXX)
endif()

find_package(catkin REQUIRED COMPONENTS cv_bridge dynamic_reconfigure message_generation image_transport nodelet roscpp sensor_msgs std_msgs std_srvs class_loader)

Expand Down
11 changes: 9 additions & 2 deletions launch/face_detection.launch
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,16 @@
<arg if="$(arg use_opencv4)"
name="eyes_cascade_name" default="/usr/share/opencv4/haarcascades/haarcascade_eye_tree_eyeglasses.xml" doc="Eye dtection cascade Filename" />

<arg unless="$(arg use_opencv3)"
<!-- if all use_opencv3 is true, but all other variable is false, then use /usr/share/opencv -->
<!-- eval requires roslaunch >= 1.12.1 -->
<arg if="$(eval use_opencv3 and not use_opencv3_1 and not use_opencv3_2 and not use_opencv3_3 and not use_opencv4)"
name="face_cascade_name" default="/usr/share/opencv/haarcascades/haarcascade_frontalface_alt.xml" doc="Face dtection cascade Filename" />
<arg unless="$(arg use_opencv3)"
<arg if="$(eval use_opencv3 and not use_opencv3_1 and not use_opencv3_2 and not use_opencv3_3 and not use_opencv4)"
name="eyes_cascade_name" default="/usr/share/opencv/haarcascades/haarcascade_eye_tree_eyeglasses.xml" doc="Eye dtection cascade Filename" />
<!-- if all use_opencv* variable is false, then use /usr/share/opencv -->
<arg unless="$(eval use_opencv3 or use_opencv3_1 or use_opencv3_2 or use_opencv3_3 or use_opencv4)"
name="face_cascade_name" default="/usr/share/opencv/haarcascades/haarcascade_frontalface_alt.xml" doc="Face dtection cascade Filename" />
<arg unless="$(eval use_opencv3 or use_opencv3_1 or use_opencv3_2 or use_opencv3_3 or use_opencv4)"
name="eyes_cascade_name" default="/usr/share/opencv/haarcascades/haarcascade_eye_tree_eyeglasses.xml" doc="Eye dtection cascade Filename" />

<!-- face_detection.cpp -->
Expand Down
21 changes: 21 additions & 0 deletions src/nodelet/face_recognition_nodelet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ namespace filesystem3
namespace filesystem
{
#endif
#if BOOST_VERSION < 108300
template <>
path& path::append<typename path::iterator>(typename path::iterator lhs, typename path::iterator rhs,
const codecvt_type& cvt)
Expand All @@ -97,9 +98,18 @@ path& path::append<typename path::iterator>(typename path::iterator lhs, typenam
*this /= *lhs;
return *this;
}
#endif
path user_expanded_path(const path& p)
{
#if BOOST_VERSION < 108300
path::const_iterator it(p.begin());
#else
if (p.size() < 2)
return p;

auto it = p.begin();
// Replace the tilda with the home directory
#endif
std::string user_dir = (*it).string();
if (user_dir.length() == 0 || user_dir[0] != '~')
return p;
Expand All @@ -121,8 +131,19 @@ path user_expanded_path(const path& p)
return p;
homedir = pw->pw_dir;
}

// Append the rest of path
ret = path(std::string(homedir));
#if BOOST_VERSION < 108300
return ret.append(++it, p.end(), path::codecvt());
#else
++it;
for (; it != p.end(); ++it)
{
ret /= *it;
}
return ret;
#endif
}
} // namespace filesystem
} // namespace boost
Expand Down
5 changes: 4 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@ elseif(OpenCV_VERSION VERSION_LESS "3.2")
elseif(OpenCV_VERSION VERSION_LESS "3.3")
add_rostest(test-face_detection.test ARGS gui:=false use_opencv3:=true use_opencv3_2:=true)
add_rostest(test-face_recognition.test ARGS gui:=false use_opencv3:=true use_opencv3_2:=true)
else()
elseif(OpenCV_VERSION VERSION_LESS "3.4")
add_rostest(test-face_detection.test ARGS gui:=false use_opencv3:=true use_opencv3_3:=true)
add_rostest(test-face_recognition.test ARGS gui:=false use_opencv3:=true use_opencv3_3:=true)
else()
add_rostest(test-face_detection.test ARGS gui:=false use_opencv4:=true)
add_rostest(test-face_recognition.test ARGS gui:=false use_opencv4:=true)
endif()
add_rostest(test-goodfeature_track.test ARGS gui:=false)
add_rostest(test-corner_harris.test ARGS gui:=false)
Expand Down