Skip to content

Commit

Permalink
ROS2 Port (#2)
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Hernández Cordero <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
  • Loading branch information
john-maidbot and ahcorde authored Sep 6, 2023
1 parent 5e005fb commit 85d28ba
Show file tree
Hide file tree
Showing 9 changed files with 704 additions and 389 deletions.
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

0 comments on commit 85d28ba

Please sign in to comment.