Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build tutorials on Azure Pipelines #2696

Merged
merged 10 commits into from
Dec 12, 2018
1 change: 1 addition & 0 deletions .ci/azure-pipelines/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
-DPCL_ONLY_CORE_POINT_TYPES=ON \
-DPCL_QT_VERSION=5 \
-DBUILD_simulation=ON \
-DBUILD_surface_on_nurbs=ON \
-DBUILD_global_tests=ON \
-DBUILD_examples=ON \
-DBUILD_tools=ON \
Expand Down
3 changes: 2 additions & 1 deletion .ci/azure-pipelines/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
vmImage: 'Ubuntu 16.04'
container: env1604
variables:
BUILD_DIR: '$(Agent.WorkFolder)/build'
BUILD_DIR: '$(Agent.BuildDirectory)/build'
CMAKE_CXX_FLAGS: '-Wall -Wextra -Wabi -O2'
steps:
- script: |
Expand All @@ -21,6 +21,7 @@ jobs:
-DPCL_ONLY_CORE_POINT_TYPES=ON \
-DPCL_QT_VERSION=5 \
-DBUILD_simulation=ON \
-DBUILD_surface_on_nurbs=ON \
-DBUILD_global_tests=ON \
-DBUILD_examples=ON \
-DBUILD_tools=ON \
Expand Down
4 changes: 2 additions & 2 deletions .ci/azure-pipelines/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
vmImage: 'Ubuntu 16.04'
container: doc
variables:
BUILD_DIR: '$(Agent.WorkFolder)/build'
DOC_DIR: '$(Agent.WorkFolder)/documentation'
BUILD_DIR: '$(Agent.BuildDirectory)/build'
DOC_DIR: '$(Agent.BuildDirectory)/documentation'
steps:
- task: InstallSSHKey@0
inputs:
Expand Down
45 changes: 45 additions & 0 deletions .ci/azure-pipelines/tutorials.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
resources:
containers:
- container: env1604
image: pointcloudlibrary/env:16.04

jobs:
- job: tutorials
displayName: Tutorials
timeoutInMinutes: 0
pool:
vmImage: 'Ubuntu 16.04'
container: env1604
variables:
BUILD_DIR: '$(Agent.BuildDirectory)/build'
INSTALL_DIR: '$(Agent.BuildDirectory)/install'
CMAKE_CXX_FLAGS: '-Wall -Wextra -Wabi -O2'
EXCLUDE_TUTORIALS: 'davidsdk,ensenso_cameras,gpu'
steps:
- script: |
mkdir $BUILD_DIR && cd $BUILD_DIR
cmake $(Build.SourcesDirectory) \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
-DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" \
-DPCL_ONLY_CORE_POINT_TYPES=ON \
-DPCL_NO_PRECOMPILE=ON \
-DPCL_QT_VERSION=5 \
-DBUILD_surface_on_nurbs=ON \
-DBUILD_global_tests=OFF \
-DBUILD_tools=OFF \
-DBUILD_examples=OFF \
-DBUILD_outofcore=OFF \
-DBUILD_stereo=OFF \
-DBUILD_simulation=OFF
displayName: 'CMake Configuration'
- script: |
cd $BUILD_DIR
cmake --build . -- -j2
displayName: 'Build Library'
- script: |
cd $BUILD_DIR
cmake --build . -- install
displayName: 'Install PCL'
- script: |
$(Build.SourcesDirectory)/.ci/scripts/build_tutorials.sh -k -s -e $EXCLUDE_TUTORIALS $INSTALL_DIR/share/pcl-1.9 $(Build.SourcesDirectory) $BUILD_DIR/tutorials
displayName: 'Build Tutorials'
123 changes: 123 additions & 0 deletions .ci/scripts/build_tutorials.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#!/usr/bin/env bash

show_help() {
cat << EOF
Usage: ${0##*/} [OPTIONS] INSTALL_DIR SOURCE_DIR BUILD_DIR

This script builds source code projects of PCL tutorials.

Options:

-h Dispaly this help and exit.
-k Keep going after a configuration/build error.
-s Print summary in the end.
-e NAMES Exclude tutorials from the build.
NAMES is a comma-separated list of tutorial names.

Arguments:

INSTALL_DIR Path to the directory where PCLConfig.cmake in installed.
SOURCE_DIR Path to the root of PCL repository.
BUILD_DIR Path to the directory where the tutorials should be built.
EOF
}

while getopts "hkse:" option; do
case "${option}" in
h) show_help
exit 0
;;
k) KEEP_GOING=1
;;
s) SUMMARY=1
;;
e) EXCLUDE=${OPTARG}
;;
*) show_help
exit 1
;;
esac
done

shift $((OPTIND-1))

if [[ $# -ne 3 ]]; then
show_help
exit 1
fi

INSTALL_DIR=$1
SOURCE_DIR=$2/doc/tutorials/content/sources
BUILD_DIR=$3

if [[ ! -f "$INSTALL_DIR/PCLConfig.cmake" ]]; then
echo "Invalid install directory"
exit 2
fi

if [[ ! -d "$SOURCE_DIR" ]]; then
echo "Invalid source directory"
exit 3
fi

mkdir -p "$BUILD_DIR"

TUTORIALS=()

for DIRECTORY in "$SOURCE_DIR"/*/ ; do
NAME=$(basename "$DIRECTORY")
if [[ "$EXCLUDE" == *$NAME* ]]; then
STATUS="excluded"
elif [[ -z ${SKIP+x} ]]; then
TUTORIAL_SOURCE_DIR=$(realpath "$DIRECTORY")
TUTORIAL_BUILD_DIR="$BUILD_DIR/$NAME"
mkdir -p "$TUTORIAL_BUILD_DIR" && cd "$TUTORIAL_BUILD_DIR" || exit
echo "Configuring tutorial: $NAME"
if ! cmake "$TUTORIAL_SOURCE_DIR" -DPCL_DIR="$INSTALL_DIR" -DCMAKE_CXX_FLAGS="-Werror"; then
STATUS="cmake error"
else
echo "Building tutorial: $NAME"
if ! cmake --build . -- -j2; then
STATUS="build error"
fi
fi
if [[ -n $STATUS ]]; then
FAILED=1
if [[ $KEEP_GOING -ne 1 ]]; then
SKIP=1
fi
fi
cd - || exit
else
STATUS="skipped"
fi
TUTORIALS+=("$NAME")
STATUSES+=("$STATUS")
unset STATUS
done

if [[ $SUMMARY -eq 1 ]]; then
echo ""
echo "Tutorial build summary"
echo "----------------------"
echo ""
SUCCEEDED=0
EXCLUDED=0
for i in "${!TUTORIALS[@]}"; do
if [[ "${STATUSES[$i]}" == "" ]]; then
MARK="🗸"
SUCCEEDED=$((SUCCEEDED+1))
elif [[ "${STATUSES[$i]}" == *error* ]]; then
MARK="𐄂"
else
MARK="-"
EXCLUDED=$((EXCLUDED+1))
fi
printf "%-46s %s %s\\n" "${TUTORIALS[$i]}" "$MARK" "${STATUSES[$i]}"
done
echo ""
echo "Succeeded building $SUCCEEDED out of ${#TUTORIALS[@]} tutorials"
echo "Excluded or skipped $EXCLUDED tutorials"
fi

exit $FAILED
8 changes: 4 additions & 4 deletions doc/tutorials/content/conditional_removal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ Then, we create the condition which a given point must satisfy so that it remain

.. literalinclude:: sources/conditional_removal/conditional_removal.cpp
:language: cpp
:lines: 28-39
:lines: 28-40

This last bit of code just applies the filter to our original PointCloud, and removes all of the points that do not satisfy the conditions we specified. Then it outputs all of the points remaining in the PointCloud.

.. literalinclude:: sources/conditional_removal/conditional_removal.cpp
:language: cpp
:lines: 41-48
:lines: 42-50

Compiling and running the program
---------------------------------
Expand All @@ -54,11 +54,11 @@ You will see something similar to::

Cloud before filtering:
0.352222 -0.151883 -0.106395
-0.397406 -0.473106 0.292602
-0.397406 -0.473106 0.292602
-0.731898 0.667105 0.441304
-0.734766 0.854581 -0.0361733
-0.4607 -0.277468 -0.916762
Cloud after filtering:
Cloud after filtering:
-0.397406 -0.473106 0.292602
-0.731898 0.667105 0.441304

2 changes: 1 addition & 1 deletion doc/tutorials/content/don_segmentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ In this example we will do a simple magnitude threshold, looking for objects of

.. literalinclude:: sources/don_segmentation/don_segmentation.cpp
:language: cpp
:lines: 131-145
:lines: 131-146

After we apply the filter we are left with a reduced pointcloud consisting of the points with a strong response with the given scale parameters.

Expand Down
22 changes: 11 additions & 11 deletions doc/tutorials/content/ground_based_rgbd_people_detection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Here it is the code:

.. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp
:language: cpp
:lines: 48-242
:lines: 48-243


The explanation
Expand All @@ -35,13 +35,13 @@ maximum (``max_h``) height of people can be set. If no parameter is set, the def

.. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp
:language: cpp
:lines: 66-77
:lines: 67-78

Here, the callback used for grabbing pointclouds with OpenNI is defined.

.. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp
:language: cpp
:lines: 79-86
:lines: 80-87

The people detection algorithm used makes the assumption that people stand/walk on a planar ground plane.
Thus, it requires to know the equation of the ground plane in order to perform people detection.
Expand All @@ -52,7 +52,7 @@ the structure used to pass arguments to this callback.

.. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp
:language: cpp
:lines: 88-109
:lines: 89-110

Main:
*****
Expand All @@ -61,9 +61,9 @@ The main program starts by initializing the main parameters and reading the comm

.. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp
:language: cpp
:lines: 111-129
:lines: 112-130

Ground initialization:
Ground initialization:
**********************

Then, the :pcl:`pcl::Grabber <pcl::Grabber>` object is initialized in order to acquire RGB-D pointclouds and the program waits for
Expand All @@ -74,7 +74,7 @@ After this, ``Q`` must be pressed in order to close the visualizer and let the p

.. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp
:language: cpp
:lines: 131-164
:lines: 132-165

.. image:: images/ground_based_rgbd_people_detection/Screen_floor.jpg
:align: center
Expand All @@ -89,7 +89,7 @@ written to the command window.

.. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp
:language: cpp
:lines: 166-174
:lines: 167-175

In the following lines, we can see the initialization of the SVM classifier by loading the pre-trained parameters
from file.
Expand All @@ -101,7 +101,7 @@ setSensorPortraitOrientation should be used to enable the vertical mode in :pcl:

.. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp
:language: cpp
:lines: 180-190
:lines: 181-191

Main loop:
**********
Expand All @@ -113,7 +113,7 @@ This procedure allows to adapt to small changes which can occur to the ground pl

.. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp
:language: cpp
:lines: 196-209
:lines: 197-210

The last part of the code is devoted to visualization. In particular, a green 3D bounding box is drawn for every
person with HOG confidence above the ``min_confidence`` threshold. The width of the bounding box is fixed, while
Expand All @@ -123,7 +123,7 @@ Please note that this framerate includes the time necessary for grabbing the poi

.. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp
:language: cpp
:lines: 211-237
:lines: 212-238

Compiling and running the program
---------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ int
pcl::FieldComparison<pcl::PointXYZ> ("z", pcl::ComparisonOps::LT, 0.8)));

// build the filter
pcl::ConditionalRemoval<pcl::PointXYZ> condrem (range_cond);
pcl::ConditionalRemoval<pcl::PointXYZ> condrem;
condrem.setCondition (range_cond);
condrem.setInputCloud (cloud);
condrem.setKeepOrganized(true);
condrem.setKeepOrganized (true);

// apply filter
condrem.filter (*cloud_filtered);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ main (int argc, char *argv[])
new pcl::FieldComparison<PointNormal> ("curvature", pcl::ComparisonOps::GT, threshold))
);
// Build the filter
pcl::ConditionalRemoval<PointNormal> condrem (range_cond);
pcl::ConditionalRemoval<PointNormal> condrem;
condrem.setCondition (range_cond);
condrem.setInputCloud (doncloud);

pcl::PointCloud<PointNormal>::Ptr doncloud_filtered (new pcl::PointCloud<PointNormal>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include <pcl/io/openni_grabber.h>
#include <pcl/sample_consensus/sac_model_plane.h>
#include <pcl/people/ground_based_people_detection_app.h>
#include <pcl/common/time.h>

typedef pcl::PointXYZRGBA PointT;
typedef pcl::PointCloud<PointT> PointCloudT;
Expand Down Expand Up @@ -186,7 +187,7 @@ int main (int argc, char** argv)
people_detector.setVoxelSize(voxel_size); // set the voxel size
people_detector.setIntrinsics(rgb_intrinsics_matrix); // set RGB camera intrinsic parameters
people_detector.setClassifier(person_classifier); // set person classifier
people_detector.setHeightLimits(min_height, max_height); // set person classifier
people_detector.setPersonClusterLimits(min_height, max_height, 0.1, 8.0); // set person classifier
// people_detector.setSensorPortraitOrientation(true); // set sensor orientation to vertical

// For timing:
Expand Down
4 changes: 2 additions & 2 deletions doc/tutorials/content/sources/iccv2011/src/tutorial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ void ICCVTutorial<FeatureType>::filterCorrespondences ()
}

pcl::registration::CorrespondenceRejectorSampleConsensus<pcl::PointXYZI> rejector;
rejector.setInputCloud(source_keypoints_);
rejector.setTargetCloud(target_keypoints_);
rejector.setInputSource(source_keypoints_);
rejector.setInputTarget(target_keypoints_);
rejector.setInputCorrespondences(correspondences_);
rejector.getCorrespondences(*correspondences_);
cout << "OK" << endl;
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorials/content/sources/pcl_painter2D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable(pcl_painter2D_demo pcl_painter2D_demo.cpp)
target_link_libraries(pcl_painter2D_demo ${PCL_COMMON_LIBRARIES} ${PCL_VISUALIZATION_LIBRARIES})
target_link_libraries(pcl_painter2D_demo ${PCL_LIBRARIES})
2 changes: 1 addition & 1 deletion doc/tutorials/content/sources/pcl_plotter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable(pcl_plotter pcl_plotter_demo.cpp)
target_link_libraries(pcl_plotter ${PCL_COMMONLIBRARIES} ${PCL_VISUALIZATION_LIBRARIES})
target_link_libraries(pcl_plotter ${PCL_LIBRARIES})
Loading