Skip to content

Commit

Permalink
Merge branch 'ci'
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBowman committed Oct 17, 2024
2 parents 606fddf + 2b92820 commit 1dac858
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 13 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
os: [ubuntu-22.04, ubuntu-24.04]
robotology:
- { yarp: yarp-3.8, cmake: 3.16.x }
- { yarp: yarp-3.9, cmake: 3.16.x }
Expand Down Expand Up @@ -70,9 +70,6 @@ jobs:
ref: ${{matrix.robotology.yarp}}
path: .deps/yarp

# - name: Install dependencies via apt
# run: apt-get update && apt-get upgrade -qqy

- name: Set up CMake
uses: jwlawson/actions-setup-cmake@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

strategy:
matrix:
ubuntu: ['20.04', '22.04']
ubuntu: ['22.04', '24.04']
opencv: ['4.x']

steps:
Expand Down
23 changes: 17 additions & 6 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
ARG UBUNTU_TAG
FROM ubuntu:${UBUNTU_TAG}

ARG CORES=1
ARG SWIG_TAG=4.2.1
ARG OPENCV_TAG

RUN DEBIAN_FRONTEND=noninteractive \
apt-get update && \
ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -y \
g++ \
clang \
Expand All @@ -13,18 +16,26 @@ RUN DEBIAN_FRONTEND=noninteractive \
unzip \
ccache \
libpcl-dev \
swig \
googletest && \
bison \
googletest \
python3-setuptools && \
wget -O swig.zip https://github.com/swig/swig/archive/v${SWIG_TAG}.zip && \
wget -O opencv.zip https://github.com/opencv/opencv/archive/${OPENCV_TAG}.zip && \
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/${OPENCV_TAG}.zip && \
unzip swig.zip && \
unzip opencv.zip && \
unzip opencv_contrib.zip && \
cmake -S swig-${SWIG_TAG} -B swig-${SWIG_TAG}/build && \
cmake --build swig-${SWIG_TAG}/build -- -j$CORES && \
cmake --install swig-${SWIG_TAG}/build && \
cmake -S opencv-${OPENCV_TAG} -B opencv-${OPENCV_TAG}/build \
-DOPENCV_EXTRA_MODULES_PATH=opencv_contrib-${OPENCV_TAG}/modules \
-DBUILD_TESTS=OFF \
-DBUILD_PERF_TESTS=OFF \
-DOPENCV_ENABLE_NONFREE=ON && \
cmake --build opencv-${OPENCV_TAG}/build && \
cmake --build opencv-${OPENCV_TAG}/build -- -j$CORES && \
cmake --install opencv-${OPENCV_TAG}/build && \
rm -rf opencv.zip opencv_contrib.zip opencv-${OPENCV_TAG} opencv_contrib-${OPENCV_TAG} && \
rm swig.zip opencv.zip opencv_contrib.zip && \
rm -rf swig-${SWIG_TAG} opencv-${OPENCV_TAG} opencv_contrib-${OPENCV_TAG} && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean
35 changes: 35 additions & 0 deletions libraries/YarpCloudUtils/YarpCloudUtils-pcl-traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ struct pcl_xyzi_types_tag {}; // XYZI(+Normal)

struct pcl_normal_types_tag {};

// special cases for pcl::MovingLeastSquares, see:
// https://github.com/PointCloudLibrary/pcl/pull/5764
struct pcl_mls_types_tag : public pcl_all_xyz_types_tag {};
struct pcl_mls_normal_types_tag : public pcl_normal_types_tag {};

// map PCL type according to selected tag

template <typename T, typename tag>
Expand Down Expand Up @@ -130,6 +135,36 @@ template <>
struct pcl_decay<pcl::InterestPoint, pcl_normal_types_tag>
{ typedef pcl::PointNormal type; };

// mappings for pcl::MovingLeastSquares (special case, less precompiled instantiations)

template <typename T>
struct pcl_decay<T, pcl_mls_types_tag>
{ typedef T type; };

template <>
struct pcl_decay<pcl::InterestPoint, pcl_mls_types_tag>
{ typedef pcl::PointXYZ type; };

template <typename T>
struct pcl_decay<T, pcl_mls_normal_types_tag>
{ typedef T type; };

template <>
struct pcl_decay<pcl::PointXYZ, pcl_mls_normal_types_tag>
{ typedef pcl::PointNormal type; };

template <>
struct pcl_decay<pcl::PointXYZRGB, pcl_mls_normal_types_tag>
{ typedef pcl::PointXYZRGBNormal type; };

template <>
struct pcl_decay<pcl::PointXYZI, pcl_mls_normal_types_tag>
{ typedef pcl::PointNormal type; };

template <>
struct pcl_decay<pcl::InterestPoint, pcl_mls_normal_types_tag>
{ typedef pcl::PointNormal type; };

// register allowed conversions

template <typename T1, typename T2>
Expand Down
6 changes: 4 additions & 2 deletions libraries/YarpCloudUtils/YarpCloudUtils-pcl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ namespace
using rgb_t = typename pcl_decay<T, pcl_rgb_types_tag>::type;
using xyzi_t = typename pcl_decay<T, pcl_xyzi_types_tag>::type;
using normal_t = typename pcl_decay<T, pcl_normal_types_tag>::type;
using mls_t = typename pcl_decay<T, pcl_mls_types_tag>::type;
using mls_normal_t = typename pcl_decay<T, pcl_mls_normal_types_tag>::type;

if (!options.check("algorithm"))
{
Expand Down Expand Up @@ -142,9 +144,9 @@ namespace
break;
case "MovingLeastSquares"_hash:
if (options.check("computeNormals", yarp::os::Value(false)).asBool())
doMovingLeastSquares<any_xyz_t, normal_t>(prev.getCloud<any_xyz_t>(), curr.setCloud<normal_t>(), options);
doMovingLeastSquares<mls_t, mls_normal_t>(prev.getCloud<mls_t>(), curr.setCloud<mls_normal_t>(), options);
else
doMovingLeastSquares<any_xyz_t>(prev.getCloud<any_xyz_t>(), curr.setCloud<any_xyz_t>(), options);
doMovingLeastSquares<mls_t>(prev.getCloud<mls_t>(), curr.setCloud<mls_t>(), options);
break;
case "NormalEstimation"_hash:
pcl::copyPointCloud(*prev.getCloud<any_xyz_t>(), *curr.setCloud<normal_t>());
Expand Down

0 comments on commit 1dac858

Please sign in to comment.