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

ROS2 Port #2

Merged
merged 11 commits into from
Sep 6, 2023
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
77 changes: 66 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,78 @@
cmake_minimum_required(VERSION 3.10.2)

project(point_cloud_transport_tutorial)

find_package(catkin REQUIRED COMPONENTS cras_cpp_common point_cloud_transport rosbag rosgraph_msgs sensor_msgs topic_tools)
# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

catkin_package()
find_package(ament_cmake_ros REQUIRED)

include_directories(${catkin_INCLUDE_DIRS})
find_package(point_cloud_transport REQUIRED)
find_package(point_cloud_transport_plugins REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rcpputils REQUIRED)
find_package(rosbag2_cpp REQUIRED)
find_package(sensor_msgs REQUIRED)

include_directories(
include
)

# encoder
add_executable(encoder_test src/my_encoder.cpp)
ament_target_dependencies(encoder_test point_cloud_transport rosbag2_cpp sensor_msgs)

# publisher
add_executable(publisher_test src/my_publisher.cpp)
add_dependencies(publisher_test ${catkin_EXPORTED_TARGETS})
target_link_libraries(publisher_test ${catkin_LIBRARIES})
ament_target_dependencies(publisher_test point_cloud_transport rclcpp rcpputils rosbag2_cpp sensor_msgs)

# subscriber
add_executable(subscriber_test src/my_subscriber.cpp)
add_dependencies(subscriber_test ${catkin_EXPORTED_TARGETS})
target_link_libraries(subscriber_test ${catkin_LIBRARIES})
ament_target_dependencies(subscriber_test point_cloud_transport rclcpp sensor_msgs)

# encoder
add_executable(encoder_test src/my_encoder.cpp)
add_dependencies(encoder_test ${catkin_EXPORTED_TARGETS})
target_link_libraries(encoder_test ${catkin_LIBRARIES})
# Install executables
install(
TARGETS
encoder_test
publisher_test
subscriber_test
RUNTIME DESTINATION lib/${PROJECT_NAME}
)

install(
DIRECTORY
resources
DESTINATION share/${PROJECT_NAME}
)

# linting tests
if(BUILD_TESTING)
find_package(ament_cmake_copyright REQUIRED)
find_package(ament_cmake_cppcheck REQUIRED)
find_package(ament_cmake_cpplint REQUIRED)
find_package(ament_cmake_lint_cmake REQUIRED)
find_package(ament_cmake_uncrustify REQUIRED)
find_package(ament_cmake_xmllint REQUIRED)

ament_copyright(EXCLUDE ${_linter_excludes})
ament_cppcheck(
EXCLUDE ${_linter_excludes}
LANGUAGE c++
)
ament_cpplint(EXCLUDE ${_linter_excludes})
ament_lint_cmake()
ament_uncrustify(
LANGUAGE c++
)
ament_xmllint()
endif()


ament_package()
Loading