forked from ctu-vras/point_cloud_transport_plugins
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ros-perception/ros2
Port point_cloud_transport_plugins to ROS2
- Loading branch information
Showing
37 changed files
with
2,352 additions
and
482 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
set -ev | ||
|
||
# Configuration. | ||
export COLCON_WS=~/ws | ||
export COLCON_WS_SRC=${COLCON_WS}/src | ||
export DEBIAN_FRONTEND=noninteractive | ||
export ROS_PYTHON_VERSION=3 | ||
|
||
apt update -qq | ||
apt install -qq -y lsb-release wget curl build-essential | ||
|
||
# Dependencies. | ||
echo "deb http://packages.ros.org/ros2-testing/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-testing.list | ||
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add - | ||
apt-get update -qq | ||
apt-get install -y python3-colcon-common-extensions \ | ||
python3-rosdep python3-vcstool python3-vcstools | ||
|
||
rosdep init | ||
rosdep update | ||
rosdep install --from-paths ./ -i -y -r --rosdistro $ROS_DISTRO $ROSDEP_ARGS | ||
|
||
# Build. | ||
source /opt/ros/$ROS_DISTRO/setup.bash | ||
mkdir -p $COLCON_WS_SRC | ||
cp -r $GITHUB_WORKSPACE $COLCON_WS_SRC | ||
cd $COLCON_WS | ||
echo $1 | ||
wget $1 | ||
vcs import src < point_cloud_transport.repos | ||
rosdep install --from-paths ./ -i -y -r --rosdistro $ROS_DISTRO $ROSDEP_ARGS | ||
colcon build --event-handlers console_direct+ | ||
|
||
# Tests. | ||
colcon test --event-handlers console_direct+ | ||
colcon test-result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: ROS2 CI | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
point_cloud_transport_ci: | ||
name: point_cloud_transport CI | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- docker-image: "ubuntu:22.04" | ||
ros-distro: "rolling" | ||
container: | ||
image: ${{ matrix.docker-image }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Build and Test | ||
run: .github/workflows/build-and-test.sh https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/point_cloud_transport.repos | ||
env: | ||
DOCKER_IMAGE: ${{ matrix.docker-image }} | ||
ROS_DISTRO: ${{ matrix.ros-distro }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"files.associations": { | ||
"algorithm": "cpp", | ||
"memory": "cpp" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Any contribution that you make to this repository will | ||
be under the 3-Clause BSD License, as dictated by that | ||
[license](https://opensource.org/licenses/BSD-3-Clause). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,62 @@ | ||
cmake_minimum_required(VERSION 3.10.2) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
project(draco_point_cloud_transport) | ||
|
||
# Use Draco as a standalone cmake project, it gets built thanks to catkin | ||
# package.xml. | ||
find_package(catkin REQUIRED COMPONENTS | ||
cras_cpp_common | ||
dynamic_reconfigure | ||
message_generation | ||
pluginlib | ||
point_cloud_transport | ||
sensor_msgs | ||
std_msgs) | ||
find_package(ament_cmake REQUIRED) | ||
find_package(pluginlib REQUIRED) | ||
find_package(point_cloud_interfaces REQUIRED) | ||
find_package(point_cloud_transport REQUIRED) | ||
find_package(rclcpp REQUIRED) | ||
find_package(sensor_msgs REQUIRED) | ||
find_package(std_msgs REQUIRED) | ||
|
||
# There are some find_package/naming issues due to name draco/Draco mismatch. | ||
# Currently, with caktin tools only DracoConfig.cmake is found with just two | ||
# variables defined, draco_INCLUDE_DIR and draco_LIBRARY_DIR. In that case we | ||
# try to reconstruct the rest from FindDraco.cmake (module mode). | ||
find_package(Draco REQUIRED) | ||
if(draco_INCLUDE_DIR) | ||
set(draco_FOUND TRUE) | ||
set(draco_LIBRARY_DIRS "${draco_LIBRARY_DIR}") | ||
find_path(draco_INCLUDE_DIRS draco/point_cloud/point_cloud.h PATHS "${draco_INCLUDE_DIR}/..") | ||
find_library(draco_LIBRARIES NAMES draco PATHS "${draco_LIBRARY_DIR}") | ||
message("Draco found: ${draco_INCLUDE_DIRS}, ${draco_LIBRARIES}") | ||
endif() | ||
|
||
add_message_files(FILES | ||
CompressedPointCloud2.msg | ||
) | ||
|
||
generate_messages(DEPENDENCIES | ||
set(dependencies | ||
pluginlib | ||
point_cloud_interfaces | ||
point_cloud_transport | ||
rclcpp | ||
sensor_msgs | ||
std_msgs | ||
) | ||
|
||
generate_dynamic_reconfigure_options(cfg/DracoPublisher.cfg cfg/DracoSubscriber.cfg) | ||
|
||
catkin_package( | ||
INCLUDE_DIRS include | ||
LIBRARIES ${PROJECT_NAME} | ||
CATKIN_DEPENDS message_runtime point_cloud_transport sensor_msgs std_msgs | ||
) | ||
|
||
include_directories(include ${catkin_INCLUDE_DIRS} SYSTEM ${draco_INCLUDE_DIRS}) | ||
include_directories(include ${DRACO_INCLUDE_DIR}) | ||
|
||
set(SOURCE_FILES | ||
add_library(${PROJECT_NAME} | ||
SHARED | ||
src/cloud.cpp | ||
src/draco_publisher.cpp | ||
src/draco_subscriber.cpp | ||
) | ||
|
||
add_library(${PROJECT_NAME} | ||
${SOURCE_FILES} | ||
) | ||
add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS}) | ||
target_link_libraries(${PROJECT_NAME} PUBLIC ${catkin_LIBRARIES} PRIVATE ${draco_LIBRARIES}) | ||
|
||
add_library(${PROJECT_NAME}_plugin | ||
${SOURCE_FILES} | ||
src/manifest.cpp | ||
) | ||
add_dependencies(${PROJECT_NAME}_plugin ${${PROJECT_NAME}_EXPORTED_TARGETS}) | ||
target_link_libraries(${PROJECT_NAME}_plugin PUBLIC ${catkin_LIBRARIES} PRIVATE ${draco_LIBRARIES}) | ||
class_loader_hide_library_symbols(${PROJECT_NAME}_plugin) | ||
|
||
install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_plugin | ||
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} | ||
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} | ||
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} | ||
) | ||
target_link_libraries(${PROJECT_NAME} ${DRACO_LIBRARY}) | ||
|
||
install(DIRECTORY include/${PROJECT_NAME}/ | ||
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} | ||
FILES_MATCHING PATTERN "*.h" | ||
) | ||
ament_target_dependencies(${PROJECT_NAME} ${dependencies}) | ||
|
||
install(FILES draco_plugins.xml | ||
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} | ||
install(TARGETS ${PROJECT_NAME} | ||
ARCHIVE DESTINATION lib | ||
LIBRARY DESTINATION lib | ||
RUNTIME DESTINATION lib/${PROJECT_NAME} | ||
) | ||
|
||
if (CATKIN_ENABLE_TESTING) | ||
find_package(roslint REQUIRED) | ||
|
||
# catkin_lint - checks validity of package.xml and CMakeLists.txt | ||
# ROS buildfarm calls this without any environment and with empty rosdep cache, | ||
# so we have problems reading the list of packages from env | ||
# see https://github.com/ros-infrastructure/ros_buildfarm/issues/923 | ||
if(DEFINED ENV{ROS_HOME}) | ||
#catkin_lint: ignore_once env_var | ||
set(ROS_HOME "$ENV{ROS_HOME}") | ||
else() | ||
#catkin_lint: ignore_once env_var | ||
set(ROS_HOME "$ENV{HOME}/.ros") | ||
endif() | ||
#catkin_lint: ignore_once env_var | ||
if(DEFINED ENV{ROS_ROOT} AND EXISTS "${ROS_HOME}/rosdep/sources.cache") | ||
roslint_custom(catkin_lint "-W2" .) | ||
endif() | ||
|
||
# Roslint C++ - checks formatting and some other rules for C++ files | ||
|
||
file(GLOB_RECURSE ROSLINT_INCLUDE include/*.h include/*.hpp) | ||
file(GLOB_RECURSE ROSLINT_SRC src/*.cpp src/*.hpp src/*.h) | ||
#file(GLOB_RECURSE ROSLINT_TEST test/*.cpp) | ||
install( | ||
DIRECTORY include/${PROJECT_NAME}/ | ||
DESTINATION include/${PROJECT_NAME} | ||
) | ||
|
||
set(ROSLINT_CPP_OPTS "--extensions=h,hpp,hh,c,cpp,cc;--linelength=120;--filter=\ | ||
-build/header_guard,-readability/namespace,-whitespace/braces,-runtime/references,\ | ||
-build/c++11,-readability/nolint,-readability/todo,-legal/copyright,-build/namespaces") | ||
roslint_cpp(${ROSLINT_INCLUDE} ${ROSLINT_SRC}) | ||
pluginlib_export_plugin_description_file(point_cloud_transport draco_plugins.xml) | ||
|
||
roslint_add_test() | ||
if(BUILD_TESTING) | ||
find_package(ament_lint_auto REQUIRED) | ||
ament_lint_auto_find_test_dependencies() | ||
endif() | ||
|
||
ament_export_include_directories(include) | ||
ament_export_libraries(${PROJECT_NAME}) | ||
ament_export_dependencies(${dependencies}) | ||
ament_package() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.